We currently can't fetch the data type for disassociated data streams. This is because the describe asset property API doesn't support querying by alias, instead it requires an asset id and property id. See the following code where the DataType is set to "?"
Since we don't know the data type, when we're building up the frame, we were incorrectly inferring the data type to be a float64 (which is what we infer a field's value type to be by default)
This PR uses an existing utility function to infer the correct data type before we start building up the frame. This existing utility function is already used by other query types, e.g. property value history, that's why those ones were not erroring.
Which issue(s) this PR fixes:
Fixes #270
Special notes for your reviewer:
To test:
Use the external dev account which I created a disassociated data stream with an integer value in
What this PR does / why we need it:
We currently can't fetch the data type for disassociated data streams. This is because the describe asset property API doesn't support querying by alias, instead it requires an asset id and property id. See the following code where the
DataType
is set to"?"
https://github.com/grafana/iot-sitewise-datasource/blob/ef82f351fab5cd8c08c3682e348d4c834aa0f34a/pkg/resource/sitewise.go#L30-L45
Since we don't know the data type, when we're building up the frame, we were incorrectly inferring the data type to be a float64 (which is what we infer a field's value type to be by default)
https://github.com/grafana/iot-sitewise-datasource/blob/ef82f351fab5cd8c08c3682e348d4c834aa0f34a/pkg/framer/fields/util.go#L8-L19
This PR uses an existing utility function to infer the correct data type before we start building up the frame. This existing utility function is already used by other query types, e.g. property value history, that's why those ones were not erroring.
Which issue(s) this PR fixes:
Fixes #270
Special notes for your reviewer:
To test:
Get property value
/test/int/value