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

[sdk-node] automatically configure logs exporter based on enviornment variables #4552

Closed
4 tasks
pichlermarc opened this issue Mar 18, 2024 · 5 comments · Fixed by #4740
Closed
4 tasks

[sdk-node] automatically configure logs exporter based on enviornment variables #4552

pichlermarc opened this issue Mar 18, 2024 · 5 comments · Fixed by #4740
Assignees
Labels
needs:code-contribution This feature/bug is ready to implement pkg:sdk-node triage:accepted This feature has been accepted type:feature A feature with no sub-issues to address

Comments

@pichlermarc
Copy link
Member

Currently, we don't auto-configure a LogRecordProcessor/exporter combination when using the @opentelemetry/sdk-node package.
Goal of this issue is to implement exporter selection for metrics based on this specification:

For this issue to be considered done we need to implement the following behavior:

If no log record proccessor is configured by the user:

@mhennoch
Copy link
Contributor

Can assign to me.

@pichlermarc pichlermarc removed the up-for-grabs Good for taking. Extra help will be provided by maintainers label Apr 18, 2024
@pichlermarc
Copy link
Member Author

It's yours 🙂

@evheniyt
Copy link

evheniyt commented Jul 9, 2024

Hi guys, sorry for bothering you, but is it true that currently logs auto instrumentation is not supported for nodejs like we have it for python?

If yes, is PR #4740 implement this?

@trentm
Copy link
Contributor

trentm commented Jul 9, 2024

@evheniyt Recent versions of instrumentation packages for Bunyan, Winston, and Pino do support auto-instrumenting those libraries to support log sending via the Logs Bridge API (https://opentelemetry.io/docs/specs/otel/logs/bridge-api/). However, for that log sending to work, a global LoggerProvider needs to be setup to receive those log records from the instrumented libraries. This issue is about getting the OTel SDK for Node.js (a.k.a. NodeSDK) to automatically register a global LoggerProvider is a way similar to how it registers a default global TracerProvider for tracing.

@trentm
Copy link
Contributor

trentm commented Jul 9, 2024

to automatically register a global LoggerProvider

Currently, when using the NodeSDK, it will only register a global LoggerProvider if you pass in the logRecordProcessor config option. Something like:

const sdk = new NodeSDK({
  // ... other options
  logRecordProcessor: new BatchLogRecordProcessor(new OTLPLogExporter())
});
sdk.start();

(Aside: I notice that the logRecordProcessor option isn't even documented at https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-sdk-node/README.md#configuration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-contribution This feature/bug is ready to implement pkg:sdk-node triage:accepted This feature has been accepted type:feature A feature with no sub-issues to address
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants