Skip to content
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

[samplers/jaegerremote] Invalid expectation of JSON format #3184

Closed
yurishkuro opened this issue Jan 26, 2023 · 2 comments · Fixed by #3183
Closed

[samplers/jaegerremote] Invalid expectation of JSON format #3184

yurishkuro opened this issue Jan 26, 2023 · 2 comments · Fixed by #3183
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request

Comments

@yurishkuro
Copy link
Member

yurishkuro commented Jan 26, 2023

Background

Originated from open-telemetry/opentelemetry-specification#3126

The official Jaeger remote sampling protocol returns strategyType enums as strings. Both jaeger_agent:5778/sampling and jaeger_collector:14268/api/sampling endpoints return that format. OTel Collector also returns the same format (code, unit test). There is another, long-deprecated, format with enums as numbers, which is historically returned from jaeger_agent:5778/ endpoint (only very early versions of Jaeger SDKs have used this in 2015, before Thrift 0.9.3 was released):

# official
$ curl "http://localhost:5778/sampling?service=foo"
{"strategyType":"PROBABILISTIC","probabilisticSampling":{"samplingRate":1}}

# deprecated, legacy
$ curl "http://localhost:5778/?service=foo"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}

Problem

This extension expects the legacy format with enums as numbers, as demonstrated by this PR: #3183. Thus the SDK extension is completely incompatible with the OTel Collector's extension jaegerremotesampling, and is only compatible with the legacy endpoint in Jaeger Agent.

Proposed Solution

  • Option 1: fix this extension to expect the official format (potentially breaking change for existing deployments)
  • Option 2: add a configuration option
  • Option 3: sniff the payload and recognize both formats (e.g., the way Jaeger generates the legacy format is by first rendering the official format and then doing a dump string substitution to replace string enums with numbers). I would go the other way in this change, numbers to strings, so that official gRPC JSON parsing could be used.
@yurishkuro
Copy link
Member Author

cc @tttoad @vuuihc @kvrhdn - any thoughts?

@yurishkuro
Copy link
Member Author

I went with a variant of Option 3 by using gogoproto/jsonpb parser that understands both enum formats: #3183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request
Projects
None yet
1 participant