Skip to content
Snippets Groups Projects
Commit 460879fd authored by Henning Glawe's avatar Henning Glawe
Browse files

add addMatchTelemetry method to backends

actual implementation is only done for JsonParseEventsWriterBackend
parent e97baf24
No related branches found
No related merge requests found
...@@ -338,6 +338,12 @@ class ActiveBackend(object): ...@@ -338,6 +338,12 @@ class ActiveBackend(object):
if self.propagateStartFinishParsing and self.superBackend: if self.propagateStartFinishParsing and self.superBackend:
self.superBackend.finishedParsingSession(parsingStatus, parsingErrors, mainFileUri, parserInfo) self.superBackend.finishedParsingSession(parsingStatus, parsingErrors, mainFileUri, parserInfo)
def addMatchTelemetry(self, match_telemetry, gIndex = -1):
""" should be called for outputting match telemetry data:
input data, together with capture info """
if self.superBackend:
self.superBackend.addMatchTelemetry(match_telemetry, gIndex)
def metaInfoEnv(self): def metaInfoEnv(self):
"""the metaInfoEnv this parser was optimized for""" """the metaInfoEnv this parser was optimized for"""
return self.__metaInfoEnv return self.__metaInfoEnv
......
...@@ -201,6 +201,10 @@ class LocalBackend(object): ...@@ -201,6 +201,10 @@ class LocalBackend(object):
""" """
pass pass
def addMatchTelemetry(self, match_telemetry, gIndex = -1):
""" should be called for outputting match telemetry data:
input data, together with capture info """
pass
#=============================================================================== #===============================================================================
class Results(object): class Results(object):
......
...@@ -235,6 +235,21 @@ class JsonParseEventsWriterBackend(object): ...@@ -235,6 +235,21 @@ class JsonParseEventsWriterBackend(object):
} }
self.__jsonOutput(res) self.__jsonOutput(res)
def addMatchTelemetry(self, match_telemetry, gIndex = -1):
if not self.writeMatchTelemetry:
return
res = {
'event': "matchTelemetry",
'gIndex': gIndex,
'line': match_telemetry['line'],
'lineNr': match_telemetry['lineNr'],
'matcherName': match_telemetry['matcherName'],
'matchFlags': match_telemetry['matchFlags'],
'flat_values': match_telemetry['span_flat'],
'group': match_telemetry['group'],
}
self.__jsonOutput(res)
def convertScalarStringValue(self, metaName, strValue): def convertScalarStringValue(self, metaName, strValue):
"""converts a scalar string value of the given meta info to a python value""" """converts a scalar string value of the given meta info to a python value"""
metaInfo = self.metaInfoEnv().infoKindEl(metaName) metaInfo = self.metaInfoEnv().infoKindEl(metaName)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment