Request Metrics.go convertField to add addional array types
#13.041 aperta il 5 apr 2023
Metriche repository
- Star
- (9892 star)
- Metriche merge PR
- (Merge medio 2g 12h) (136 PR mergiate in 30 g)
Descrizione
Use Case
I have an OPC UA server that provides array data as []int32 []float64 and []string.
For me I changed/added metric.go (function convertField) as following:
+ case []int32:
+ return []int32(v)
+ case []string:
+ return []string(v)
+ case []float64:
+ return []float64(v)
case *int16:
if v != nil {
return int64(*v)
This works for output.File with type JSON. I do not know the side effects, but may be it helps others... or someone could check it for side effects...
metrics_int32_float32_string_array.patch
Expected behavior
I want to output also array-type OPC UA data to (JSON) files. (only one I tested, may be works also with other plugins)
Actual behavior
Without the mentioned patch it does not store the array values to the file.
The function convertField returns nil for []int32 []float64 and []string so that the field is not written to output.
Additional info
No response