opentelemetry-java icon indicating copy to clipboard operation
opentelemetry-java copied to clipboard

Fix serialization of arrays in prometheus exporter

Open trask opened this issue 7 months ago • 2 comments

The spec says:

For protocols that do not natively support non-string values, non-string values SHOULD be represented as JSON-encoded strings.

but it looks like the Prometheus exporter calls only Object.toString():

https://github.com/open-telemetry/opentelemetry-java/blob/9ac678e81bce7c12820acdb846d22d7957b8b15f/exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Serializer.java#L502

trask avatar Nov 15 '23 22:11 trask

Just FYI: I started working on a PR for #5940, and that will replace the Serializer class. I'm confident I can get the PR done next week.

fstab avatar Nov 17 '23 15:11 fstab

Quick update: If #6015 gets merged this code will be moved to Otel2PrometheusConverter.convertAttributes(). Still the same issue though, #6015 also calls value.toString().

fstab avatar Nov 27 '23 08:11 fstab