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 metrics exporter based on enviornment variables #4551

Open
4 tasks
pichlermarc opened this issue Mar 18, 2024 · 4 comments
Open
4 tasks
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 MetricReader/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 metric reader is configured by the user:

@Prashansa-K
Copy link

@pichlermarc I would like to work on this. I have used this package in the past.

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

@Prashansa-K thanks for picking this up. It's yours 🙂

@Prashansa-K
Copy link

Prashansa-K commented May 7, 2024

@pichlermarc
I have some doubts here.

  1. In first action item from the description mentions "use OTEL_METRICS_EXPORTER environment variable to determine an exporter and add it to the MeterProvider that's created by NodeSDK",
    However, as I see the code, addMetricReader() method is deprecated and would be removed in v2. It is suggests to use the MeterProvider constructor here.
    So, should we keep creating new MeterProvider objects here based on the exporters provided via env variable?

  2. I am assuming that we can provide >1 metric exporters via env configurations, just like trace exporters. Is that correct? I couldn't find a clarification for this in the specification document.

@pichlermarc
Copy link
Member Author

So, should we keep creating new MeterProvider objects here based on the exporters provided via env variable?

If the env var is set, only create a single MeterProvider and add all MetricReaders to that MeterProvider via the constructor option (it's an array). That means that creation of the exporters with auto-paired MetricReaders has to happen before instantiating a MeterProvider.

I am assuming that we can provide >1 metric exporters via env configurations, just like trace exporters. Is that correct? I couldn't find a clarification for this in the specification document.

That's correct. 🙂 The specification reads:

The implementation MAY accept a comma-separated list to enable setting multiple exporters.

so that's applicable to all exporter selection env vars.

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

No branches or pull requests

2 participants