fix: default to otlp if OTEL_METRICS_EXPORTER is empty#6092
fix: default to otlp if OTEL_METRICS_EXPORTER is empty#6092maryliag merged 5 commits intoopen-telemetry:mainfrom
Conversation
|
|
|
Apologies; all is fixed now. I also had to adjust some other (now incorrect) tests. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6092 +/- ##
==========================================
+ Coverage 95.20% 95.21% +0.01%
==========================================
Files 316 316
Lines 9388 9388
Branches 2166 2168 +2
==========================================
+ Hits 8938 8939 +1
+ Misses 450 449 -1
🚀 New features to boost your workflow:
|
| if (!enabledExporters) { | ||
| return metricReaders; | ||
| } | ||
| const enabledExporters = getStringListFromEnv('OTEL_METRICS_EXPORTER') ?? []; |
There was a problem hiding this comment.
| const enabledExporters = getStringListFromEnv('OTEL_METRICS_EXPORTER') ?? []; | |
| const exportersType = Array.from( | |
| new Set(getStringListFromEnv('OTEL_METRICS_EXPORTER')) | |
| ); |
The function can return an empty array, so the ?? won't work on this case. Also adding a set to remove duplicates.
I'm working on some changes on this file, and this will all be gone, but I think the tests are worth adding, so let's get this fixed too for now :)
There was a problem hiding this comment.
You can pick the tests from my branch and close this MR if it makes more sense to you - or what do you mean with "let's get this fixed too for now"
There was a problem hiding this comment.
I meant that is taking awhile for me to get reviews on my PRs that are changing this, so instead of waiting for my changes to actually get merged, I can approve/merge yours in the meantime, so we can get that fix in (even if this will change later on).
There was a problem hiding this comment.
Just commit my suggestion, resolve the conflict on changelog, and I can get that in 🚀
There was a problem hiding this comment.
Got it. I would though like to defer new Set(...) to your MRs (or at least make it a separate change set) to keep this one minimal
The second comment didn't load initially 🙂 Will fix
There was a problem hiding this comment.
Will wait for the tests to pass later today :)
Thanks for adding the changes
Short description of the changes
The
OTEL_METRICS_EXPORTERvariable should default tootlp. It currently, if not specified, does nothing.Type of change
This could potentially be considered a breaking change if a user produces metrics without configuring
OTEL_METRICS_EXPORTER. What previously did nothing will now error withconnect ECONNREFUSED 127.0.0.1:4318when the SDK is shut down and metrics are flushed.How Has This Been Tested?
Checklist: