Skip to content

UInt64 reading problem #70

@petrosinoE80

Description

@petrosinoE80

First, I would like to express my gratitude to all contributors for their invaluable work to this library.

I would like to report an issue I am experiencing during the transmission of UInt64 type metrics. When attempting to set the maximum value as follows:

metric.SetValue(DataType.UInt64, UInt64.MaxValue);

the DataType is instead set to Int64, and I receive a metric of the following type:

"metric": [
{
"name": "metricName",
"alias": 0,
"timestamp": 1708076089783,
"datatype": 4,
"is_historical": false,
"is_transient": false,
"is_null": false,
"metadata": null,
"properties": null,
"long_value": 18446744073709552000
},
...

During reading, the client expects to read a variable of type Int64 ("datatype": 4), which is incompatible with the "long_value" that the metric is intended to represent at that moment. It seems that LongValue is always represented by an Int64 (rather than also being able to be UInt64).

I hope I have explained the issue clearly, and at this point, I would like to inquire if there are any existing workarounds or if I am overlooking something. Thank you very much!

EDIT:
I just figure out that I can force the dataType after setting the value, as follows:

metric.ValueCase = (uint)DataType.UInt64;

However, I will leave this open in case there is a possibility of incorporating this management directly within the SetValue() method. Thank you again!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions