Skip to content

Python client can not set metadata on metric #393

@pakokol

Description

@pakokol

I have been trying to set the metadata for a metric in the Python client library. Would anyone be able to help me with this?

My testing code for creating payload is:

# Publish birth for first metric
 print('Publish birth')
 columns = ["Timestamp", "ACC_X"]
 types = [DataSetDataType.UInt64, DataSetDataType.Double]
 # Periodically publish some new data
 payload = getDdataPayload()

 metaData_dsc = "My metadata description"
 payload.MetaData.description = metaData_dsc
 payload.MetaData.content_type = "xml"
 payload.MetaData.size = len(metaData_dsc)

 name = "Test metric"
 alias = 0
 metric = payload.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.datatype = MetricDataType.DataSet

 # Set up the dataset
 metric.dataset_value.num_of_columns = len(types)
 metric.dataset_value.columns.extend(columns)
 metric.dataset_value.types.extend(types)

 byteArray = bytearray(payload.SerializeToString())

In the debugger, I can see that the values for MetaData are set, but when serializing they are omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions