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

Invalid expectations of JSON format for Jaeger remote sampling strategies #3126

Closed
3 of 5 tasks
yurishkuro opened this issue Jan 21, 2023 · 4 comments
Closed
3 of 5 tasks
Assignees
Labels
spec:trace Related to the specification/trace directory

Comments

@yurishkuro
Copy link
Member

yurishkuro commented Jan 21, 2023

What are you trying to achieve?

Make OpenTelemetry SDKs work with Jaeger remote sampling (raised in discussion jaegertracing/jaeger#4142).

Problem

The OpenTelemetry specification did not fully specify the requirements for samplers that support Jaeger remote sampling protocol. Specifically, it referred to gRPC sampling.proto making it look like this is the format that samplers must support. However, this is not the protocol that was used by the original Jaeger SDK samplers.

A bit of history:

  • At inception the Jaeger backend used Thrift v0.9.2 as the main RPC format. Since samplers ran in client space and did not always have access to Thrift libs, they used JSON format for the payload, which was produced by the backend by serializing Thrift objects as JSON. The strategies were served from jaeger_agent::5778/ endpoint, and the output could like like this: {"strategyType":0, "probabilisticSampling":{"samplingRate":1}}. Note that the strategyType enum is represented as a number. Also note that the agents only served the endpoint, but the actual strategy for a service was determined by the Jaeger collector, and agents simply proxied the SDKs HTTP requests to collector's Thrift endpoint.
  • Later the Jaeger backend was upgraded to Thrift v0.9.3, which made a breaking change in JSON serialization by returning enum names instead of enum numbers. The new format would look like this: {"strategyType":"PROBABILISTIC", "probabilisticSampling":{"samplingRate":1}}. The Jaeger SDKs were upgraded to parse this format, but to maintain backwards compatibility with existing SDKs in production the new format was instead exposed at a new endpoint jaeger_agent::5778/sampling. The / endpoint still continued to return the old format.
  • Later the Jaeger backend moved to gRPC as the main RPC format, including all communications between the agents and the collectors. This is when gRPC sampling.proto was introduced, but it was not used by any of Jaeger SDKs, and the JSON format that could be inferred from this proto definition was never used by any Jaeger components.

The current state in OpenTelemetry:

How to proceed from here

@yurishkuro yurishkuro added the spec:trace Related to the specification/trace directory label Jan 21, 2023
@yurishkuro
Copy link
Member Author

cc @TommyCpp (Rust SDK)
cc @anuraaga (Java SDK)
cc @kvrhdn (Go SDK)

@yurishkuro
Copy link
Member Author

cc @jpkrohling (Collector)

@TommyCpp
Copy link
Contributor

TommyCpp commented Jan 24, 2023

Rust implementation uses the HTTP response as JSON based on proto, it expects the enum to be string. So the example response {"strategyType":"PROBABILISTIC", "probabilisticSampling":{"samplingRate":1}} should work for Rust jaeger remote sampler. So the proposed change should work for us.

We can support encoding enum as integer too.

@jpkrohling
Copy link
Member

cc @frzifus, as the code owner for Jaeger components in the collector

yurishkuro added a commit to jaegertracing/jaeger that referenced this issue Jan 24, 2023
## Which problem is this PR solving?
Related to
open-telemetry/opentelemetry-specification#3126

## Short description of the changes
- changes the main `/sampling` endpoint to use Protobuf-based JSON
marshaling instead of Thrift-based
- adds unit tests to validate that the new endpoint is backwards
compatible with Thrift-based serialization
- opens the path to remove Thrift-based sampling data model throughout
the codebase

Signed-off-by: Yuri Shkuro <github@ysh.us>
yurishkuro added a commit to jaegertracing/documentation that referenced this issue Jan 26, 2023
## Which problem is this PR solving?
- Related to
open-telemetry/opentelemetry-specification#3126

## Short description of the changes
- Describe remote sampling API as official / stable, with examples.
- Mark `/` endpoint on the agent as deprecated / not recommended.
- Replace references to "Jaeger clients" with general "SDKs" where
appropriate.
- Add more warnings that Jaeger clients are deprecated.
- Mention OTLP/JSON format as accepted.
- Fix the positioning of the `Copy` button in the code snippets.
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this issue Feb 22, 2023
…#4173)

## Which problem is this PR solving?
Related to
open-telemetry/opentelemetry-specification#3126

## Short description of the changes
- changes the main `/sampling` endpoint to use Protobuf-based JSON
marshaling instead of Thrift-based
- adds unit tests to validate that the new endpoint is backwards
compatible with Thrift-based serialization
- opens the path to remove Thrift-based sampling data model throughout
the codebase

Signed-off-by: Yuri Shkuro <github@ysh.us>
shubbham1215 pushed a commit to shubbham1215/jaeger that referenced this issue Mar 5, 2023
…#4173)

## Which problem is this PR solving?
Related to
open-telemetry/opentelemetry-specification#3126

## Short description of the changes
- changes the main `/sampling` endpoint to use Protobuf-based JSON
marshaling instead of Thrift-based
- adds unit tests to validate that the new endpoint is backwards
compatible with Thrift-based serialization
- opens the path to remove Thrift-based sampling data model throughout
the codebase

Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: shubbham1215 <sawaikershubham@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:trace Related to the specification/trace directory
Projects
None yet
Development

No branches or pull requests

4 participants