@@ -595,6 +595,7 @@ def handleFileStarted(self, file, **extra):
595
595
file ['totalStatusLinesInFile' ] = 0
596
596
597
597
file ['startupStanzas' ] = [{}]
598
+ file ['annotations' ] = []
598
599
file ['inStartupStanza' ] = False
599
600
600
601
file ['connectionMessages' ] : List = []
@@ -781,6 +782,12 @@ def decideColumns(status):
781
782
782
783
seconds = status ['epoch secs' ] # floating point epoch seconds
783
784
785
+ if (not previousStatus ) or (previousStatus ['restarts' ] != len (file ['startupStanzas' ])):
786
+ if file ['startupStanzas' ][- 1 ].get ('startTime' ): # this is the only place we can add the annotation given we must associated it with a timestamp that's in the data series
787
+ file ['annotations' ].append ({'x' : line .getDateTime (), 'shortText' :'start' , 'width' :40 ,
788
+ 'text' : f"Correlator process { 'started' if len (file ['startupStanzas' ])== 1 else 'restart #%s' % (len (file ['startupStanzas' ])- 1 )} " })
789
+
790
+
784
791
if previousStatus is None :
785
792
if file ['startTime' ] is not None :
786
793
secsSinceLast = status ['epoch secs' ]- file ['startTime' ].replace (tzinfo = datetime .timezone .utc ).timestamp ()
@@ -1667,7 +1674,7 @@ def v(val, cls='overview-value', fmt=None): # values are escaped then put into a
1667
1674
ss = file ['startupStanzas' ][stanzaNum ]
1668
1675
1669
1676
ov ['Process id:' ] = f"{ v (ss .get ('pid' ) or '?' ,cls = 'overview-pid overview-value' )} "
1670
- if stanzaNum > 0 : ov ['Process id:' ]+= " " + v (f"restart #{ stanzaNum + 1 } " )+ f" at { v (ss .get ('startTime' ))} (line { ss ['startLineNumber' ]} )"
1677
+ if stanzaNum > 0 : ov ['Process id:' ]+= " " + v (f"restart #{ stanzaNum } " )+ f" at { v (ss .get ('startTime' ))} (line { ss ['startLineNumber' ]} )"
1671
1678
1672
1679
ov ['Apama version:' ] = f"{ v (ss .get ('apamaVersion' , '?' ))} { ', apama-ctrl: ' + v (file ['apamaCtrlVersion' ]) if file .get ('apamaCtrlVersion' ) else '' } ; running on { v (ss .get ('OS' ))} "
1673
1680
ov ['Log timezone:' ] = f"{ v (ss .get ('utcOffset' ) or '?' )} " + (f" ({ v (ss .get ('timezoneName' ))} )" if ss .get ('timezoneName' ) else '' )
@@ -1935,8 +1942,16 @@ def writeOverviewHTMLForAllFiles(self, overviewHTML, **extra):
1935
1942
shutil .copyfileobj (datafile , out )
1936
1943
os .remove (tmpfile )
1937
1944
out .write ('],\n ' + json .dumps (options )[:- 1 ]+ ',"legendFormatter":legendFormatter}' + '\n );\n ' )
1938
- out .write ('\n charts.push(g); </script>\n ' )
1945
+ out .write ('\n charts.push(g);\n ' )
1946
+ if c == 'rates' :
1947
+ for a in file ['annotations' ]:
1948
+ dt = a ['x' ]
1949
+ a ['x' ] = f"new Date({ dt .year } ,{ dt .month - 1 } ,{ dt .day } ,{ dt .hour } ,{ dt .minute } ,{ dt .second } ).getTime()"
1950
+ a .update ({'series' :'rx /sec' , 'attachAtBottom' :True })
1951
+ out .write ('g.setAnnotations(' + re .sub ('"(new [^"]*)"' , "\\ 1" , json .dumps (file ['annotations' ])+ ')' ))
1952
+ out .write ('</script>\n ' )
1939
1953
1954
+
1940
1955
out .write (self .HTML_END )
1941
1956
if os .path .exists (os .path .join (self .outputdir , 'tmp' )):
1942
1957
shutil .rmtree (os .path .join (self .outputdir , 'tmp' ))
0 commit comments