-
Notifications
You must be signed in to change notification settings - Fork 73
Map JSON properties as MQTT labels #172
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
base: master
Are you sure you want to change the base?
Conversation
@@ -24,6 +24,7 @@ func NewJSONObjectExtractor(p Parser) Extractor { | |||
return func(topic string, payload []byte, deviceID string) (MetricCollection, error) { | |||
var mc MetricCollection | |||
parsed := gojsonq.New(gojsonq.SetSeparator(p.separator)).FromString(string(payload)) | |||
rawPayload := gojsonq.New(gojsonq.SetSeparator(p.separator)).FromString(string(payload)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than parse the raw data again, can we avoid cloning altogether or at least clone the object without deserializing again?
I should probably update the README to include this new feature, as well :) |
Here's a pre-built package for your use https://github.com/SuperCoolAlan/mqtt2prometheus/pkgs/container/mqtt2prometheus |
Implements the feature requested here: #74