-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
status of the inconsistency between otlp http json format and protocol specification #1924
Comments
So looking into this, there doesn't seem to be a way to override the output of a field with the google jsonPB. We would have to explore other marshalers to be able to fix this. I kinda think that we should just drop support of http/josn, and maybe try to get a more comprehensive fix by changing the spec. |
indeed. opentelemetry-collector uses As for dropping support of http/json, I'm not sure about this either. Maybe in some scenario the users would want http/json even if in most of the cases they should be able to http/protobuf instead. (one advantage of json is that its easier to debug/poke around and getting started). For completeness sake I think if the specification permits it, the sdk should try its best to support it. If the decision is to not support http/json, maybe in the docs we can clearly state this (currently there's a JSON marshal in otlphttp which will make the users think this is supported, which can cause some confusion) |
It looks like Google's GRPC for Go doesn't allow custom types. So we can't use that and change TraceID and SpanID to put out the hex string that the collector (and other implementations) expect. Options:
|
With regards to dropping support for @tigrannajaryan do you have any insight about how we can solve this issue? |
This is a valid approach, especially given that otlp/json is not even declared stable yet. For those who really need it they can use an intermediary Collector to receive/export otlp/json for now. Long-term I think it would still be useful to support otlp/json in SDKs. I don't know if we will make it a mandatory requirement in the spec (probably not). It is probably not very complicated to just to do the json encoding/decoding manually via https://golang.org/pkg/encoding/json/ without relying on the Protobuf library. |
Notes from SIG meeting:
|
The old OTLP exporter was removed in #1990 and the new HTTP OTLP clients will not support JSON serialization unless and until we have a resolution for this issue. Since that support is optional and there is no longer an inconsistency, I am closing this issue. |
Description
For httpjson format, the specification states that trace_id and span_id should not use base64 encoding and should use case insensitive hex encoding. However the current implementation seems to use default protobuf json encoding (which base64-ed trace_id and span_id).
I see http json is experimental currently so is the specification about this part subject to change? or should we fix the json encoding part? Currently the sdk encode trace_id/span_id using base64 so it actually can not send span to the otlp receiver.
Environment
Steps To Reproduce
example/otel-collector/main.go
to useotlphttp
instead ofotlpgrpc
, remove grpc specific option, add marshal json optionExpected behavior
span send successfully
Actual behavior
log shows status 400, manually check reveals that its because of "invald length for ID".
patch
patch of the modified example file:
The text was updated successfully, but these errors were encountered: