Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions python/core/sparkplug_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ def initTemplateMetric(payload, name, alias, templateRef):
# Helper method for adding metrics to a container which can be a
# payload or a template
######################################################################
def addMetric(container, name, alias, type, value, timestamp=int(round(time.time() * 1000))):
def addMetric(container, name, alias, type, value, timestamp=None):
if timestamp is None:
timestamp = int(round(time.time() * 1000))
metric = container.metrics.add()
if name is not None:
metric.name = name
Expand Down Expand Up @@ -317,13 +319,15 @@ def addHistoricalMetric(container, name, alias, type, value):
# Helper method for adding metrics to a container which can be a
# payload or a template
######################################################################
def addNullMetric(container, name, alias, type):
def addNullMetric(container, name, alias, type, timestamp=None):
if timestamp is None:
timestamp = int(round(time.time() * 1000))
metric = container.metrics.add()
if name is not None:
metric.name = name
if alias is not None:
metric.alias = alias
metric.timestamp = int(round(time.time() * 1000))
metric.timestamp = timestamp
metric.is_null = True

# print( "Type: " + str(type))
Expand Down