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

UInt64 reading problem #70

Closed
petrosinoE80 opened this issue Feb 16, 2024 · 3 comments
Closed

UInt64 reading problem #70

petrosinoE80 opened this issue Feb 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@petrosinoE80
Copy link

petrosinoE80 commented Feb 16, 2024

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!

@SeppPenner SeppPenner self-assigned this Feb 16, 2024
@SeppPenner SeppPenner added the bug Something isn't working label Feb 16, 2024
@SeppPenner
Copy link
Owner

This is an issue still, yes. I hope to fix all these shitty issues until tomorrow. The latent code on master already has tests prepared already.

@SeppPenner
Copy link
Owner

This problem is discussed in eclipse-sparkplug/sparkplug#114. It seems, like we need to cast / convert the values explicitely in V3.0 (Which I don't think makes sense, but will not work else)...

@SeppPenner
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants