Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python client can not set metadata on metric #393

Open
pakokol opened this issue Aug 20, 2024 · 0 comments
Open

Python client can not set metadata on metric #393

pakokol opened this issue Aug 20, 2024 · 0 comments

Comments

@pakokol
Copy link

pakokol commented Aug 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant