-
Notifications
You must be signed in to change notification settings - Fork 485
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
[Regression]: opentelemetry_sdk::TracerProvider::span_processors no longer public #2060
Comments
Though, the use-case is not very clear. So, the HTTP server receives the span-data as POST request, and it want to directly invoke SpanProcessor::on_start() and SpanProcessor::on_end() on that to further export to OTLP Collector ? |
I'll clarify my use-case a bit more. I work on a website for browser games. The architecture is such that each game has its own web server, and there is one extra server for platform features, such as user accounts or logs. The games are built such that they only talk to their DB or the platform server, never to any outside services. This helps with development as you can very easily run everything locally and don't have to deal with various integrations, they're all abstracted away. For logs, we use OpenTelemetry as it has SDKs for many environments and allows us to use the same framework everywhere. It also has a solid model. The platform server is implemented in Rust and uses When the platform starts, it reads its config and builds a tracer provider and configures it with the right exporters. In production we use the An extra feature of the platform server is that it implements the OTLP collector API. It means that game servers can send all their traces to the platform server: the platformer is the only place were exporters are actually configured. This is also used to implement authentication, rate limiting and ensure that the traces from each game have the proper attributes. This handler is the proxy that I'm talking about in my first message. At its core, all it does is: let span_processors: &[Box<dyn SpanProcessor>] = tracer_provider.span_processors();
let spans: Vec<SpanData> = read_payload_and_do_checks();
for span in spans {
for processor in span_processors {
processor.on_end(span.clone());
}
} And finally here is a diagram summarizing how it works graph LR;
subgraph game
gameCode --> gameTracer;
gameTracer --> gameOtlpExporter;
end
subgraph platform
pfCode --> pfTracer;
pfTracer --> pfSpanProcessor;
pfOtlpHandler --> pfSpanProcessor;
pfSpanProcessor --> pfExporter;
end
subgraph telemetryBackend
stdoutJson;
stdoutHuman;
grpcCollector;
end
gameOtlpExporter --> pfOtlpHandler;
pfExporter --> stdoutJson;
pfExporter --> stdoutHuman;
pfExporter --> grpcCollector;
As a summary, I would like a way to use the tracer provider to export fully built Regarding Otel Spec, my understanding is that they define a baseline recommended API but don't forbid you from exposing extra methods. As a meta commentary, I would appreciate if the crate and libs remained modular and exposed utilities without forcing you to go through extra abstractions. For example the traceparent parsing and deserialization could be a pure method instead of also being entangled with retrieval from the propagator, but that's off-topic. |
Thanks @demurgos for the details, it gives more clarity now. |
I've been looking into it a bit more. I was able to solve my issue at a lower level. Instead of passing my exporters directly to the tracer provider builder using This feels cleaner overall, even if there's the extra Based on this, my request would be to just expose |
This commit update the visibility of the method `SimpleSpanProcessor::new` from `pub(crate)` to `pub`. This enables consumers to create `SimpleSpanProcessor` values for use with `trace::provider::Builder::with_span_processor`. In particular, this fixes a consistency issue: the `BatchSpanProcessor` struct may already be built thanks to its `pub` builder. With this change, both processors in this repo may be built manually. Closes open-telemetry#2060
This commit update the visibility of the method `SimpleSpanProcessor::new` from `pub(crate)` to `pub`. This enables consumers to create `SimpleSpanProcessor` values for use with `trace::provider::Builder::with_span_processor`. In particular, this fixes a consistency issue: the `BatchSpanProcessor` struct may already be built thanks to its `pub` builder. With this change, both processors in this repo may be built manually. Closes open-telemetry#2060
I'm considering whether we should also remove the |
Agreed that these methods are not that useful. They could be removed, but it's a more involved change as it would also require updating every place where it's currently used. |
What happened?
PR #1755 did some API clean-ups, but it was too aggressive and turned some useful APIs private. In particular
opentelemetry_sdk::TracerProvider::span_processors
waspub
but is now onlypub(crate)
.I have an HTTP server that acts as an OTLP proxy. A tracer provider is configured with exporters. This tracers is then used either to directly write traces for the main server, or to forward traces received through
POST /v1/traces/
.To forward already existing spans received through OTLP, you need access to the
span_processors
. This was previously exposed byopentelemetry_sdk::TracerProvider::span_processors
in version0.23.0
but since version0.24.0
it is no longer exposed.Please expose this method so it is possible to wrap a tracer provider into a higher level tracer provider adapter.
API Version
0.24.0
SDK Version
0.24.1
What Exporter(s) are you seeing the problem on?
OTLP
Relevant log output
The text was updated successfully, but these errors were encountered: