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

OpenTelemetry Propagators should run independently of Tracer Exporters #4480

Open
1 of 2 tasks
ruiengana opened this issue Feb 13, 2024 · 8 comments
Open
1 of 2 tasks
Labels
feature-request needs:refinement This issue needs to be refined/broken apart into sub-issues before implementation pkg:sdk-node stale

Comments

@ruiengana
Copy link

ruiengana commented Feb 13, 2024

Currently if you initiate the SDK with only Propagators and not Tracer Exporters the propagators are never called. This is because it's assumed the only behaviour for Propagators are dependent of Tracing. Well this is not fully accurate, there are propagators that are related to Tracing and others that are related to Logging (for correlation purposes).

Found this definition of OpenTelemetry.

OpenTelemetry provides a single, open source standard and a set of technologies to capture and export metrics, traces, and logs from your cloud-native applications and infrastructure.

From above definition and knowing that the current state of the project still doesn't include Logs Exporters, I don't understand why limit the usage of Propagators only for Tracing purposes when this instrumentation is required for also Logging purposes, even when Log Exporters are done elsewhere.

  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first
@pichlermarc
Copy link
Member

Is this a feature request for the @opentelemetry/sdk-node package?
There is a propagator API that let's you set propagators independently of whether you're using trace or logs.

@ruiengana
Copy link
Author

Is this a feature request for the @opentelemetry/sdk-node package?

There is a propagator API that let's you set propagators independently of whether you're using trace or logs.

Yes, potentially.

How would you instrument Propagation without the SDK?

@pichlermarc
Copy link
Member

pichlermarc commented Feb 23, 2024

That depends on what you mean by it "instrument Propagation" 🤔

Instrumentations use the Propagator API and the Context API to propagate W3C trace context for example. For that to work you need to register a context manager to the context API from @opentelemetry/api, and a propagator via the propagator API from @opentelemetry/api. Which one that is will depend on what you want to propagate (W3C trace context or something else). Then you also need to enable an instrumentation (for example @opentelemetry/instrumentation-http or @opentelemetry/instrumentation-grpc, depending on where you need your context propagated to and that will inject it into your requests and responses). The instrumentation will also try to create Spans, but if there's no Trace SDK registered with the API it'll just be a no-op.

If there's no instrumentation for the package that you're using, however, you'll have to inject it manually (using propagation and context APIs).

I believe you're trying to ask for the following feature:
When using NodeSDK and only setting up Logging, it should automatically register a context manager and propagator so that these two features would work just like when configuring NodeSDK with only Tracing.

Is that correct? 🙂

@ruiengana
Copy link
Author

ruiengana commented Feb 23, 2024

That depends on what you mean by it "instrument Propagation" 🤔

Instrumentations use the Propagator API and the Context API to propagate W3C trace context for example. For that to work you need to register a context manager to the context API from @opentelemetry/api, and a propagator via the propagator API from @opentelemetry/api. Which one that is will depend on what you want to propagate (W3C trace context or something else). Then you also need to enable an instrumentation (for example @opentelemetry/instrumentation-http or @opentelemetry/instrumentation-grpc, depending on where you need your context propagated to and that will inject it into your requests and responses). The instrumentation will also try to create Spans, but if there's no Trace SDK registered with the API it'll just be a no-op.

If there's no instrumentation for the package that you're using, however, you'll have to inject it manually (using propagation and context APIs).

I believe you're trying to ask for the following feature: When using NodeSDK and only setting up Logging, it should automatically register a context manager and propagator so that these two features would work just like when configuring NodeSDK with only Tracing.

Is that correct? 🙂

Yes, that's exactly it! Just to confirm, by "using NodeSDK only for Logging" you mean NodeSDK without tracing exporters defined in the constructor.

In essence the Logging features of NodeSDK (which Propagators are part of) should not have any dependency of the Tracing features of NodeSDK. They should be able to configure and use independently of each other.

Hope this makes sense 🙂

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Apr 29, 2024
@pichlermarc pichlermarc added feature-request pkg:sdk-node needs:refinement This issue needs to be refined/broken apart into sub-issues before implementation and removed stale labels Apr 29, 2024
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jul 15, 2024
@ilmari
Copy link

ilmari commented Jul 24, 2024

This also breaks when the trace exporter is configured via the environment, rather than using arguments to the NodeSDK constructor, because the propagator option to the traceProvider.register() call comes from this._traceProviderConfig which is only set when traceExporter, spanProcessor, or spanProcessors is passed to the constructor.

@github-actions github-actions bot removed the stale label Aug 12, 2024
Copy link

github-actions bot commented Nov 4, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request needs:refinement This issue needs to be refined/broken apart into sub-issues before implementation pkg:sdk-node stale
Projects
None yet
Development

No branches or pull requests

3 participants