claws / aioprometheus

A Prometheus Python client library for asyncio-based applications
174 stars 21 forks source link

Invalid labels will create invalid Metrics page #91

Open AlexanderWells-diamond opened 1 year ago

AlexanderWells-diamond commented 1 year ago

If you attempt to add a label to a metric that is invalid, that label is emitted in the Metrics page.

For example, passing in a labels object of 'pv' : 'CALC\{(A%2)}(BL05J-VA-IOC-02:HEARTBEAT)', will result in an output of: coniql_dropped_updates{pv="CALC\{(A%2)}(BL05J-VA-IOC-02:HEARTBEAT)",type="value"} 0

This sort of thing seems to violate the Escaping section of the OpenMetrics spec. I've observed the same when my Prometheus instance fails to parse the output.

I believe there just needs to be a check added to this function that performs additional validation of the label's contents.