open-telemetry / opentelemetry-php

The OpenTelemetry PHP Library
https://opentelemetry.io/docs/instrumentation/php/
Apache License 2.0
743 stars 186 forks source link

otlp+json enums should be integers #978

Open brettmc opened 1 year ago

brettmc commented 1 year ago

The otel collector currently accepts the string values of ENUMs for json-encoded payloads, but this is now prohibited and will likely be removed in a future collector release:

We currently use protobuf's serializeToJsonString() method to generate JSON payloads, which doesn't expose any options to represent enums as their integer values.

Possible solutions:

Additional context

Protobuf Ruby seems to support FormatEnumsAsIntegers There is a partial implementation in the protobuf php extension for FormatEnumsAsIntegers, but it is not exposed via any public interfaces (and not available in the native library)

Tasks:

brettmc commented 1 year ago

PR against google/protobuf to allow formatting enums as strings for JSON output: https://github.com/protocolbuffers/protobuf/pull/12707

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

brettmc commented 10 months ago

Note that this has been worked around via #1192 until protobuf changes are accepted.