fix(sdk-node): pass OTLP HTTP metric config#6666
Conversation
Signed-off-by: cyphercodes <cyphercodes@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6666 +/- ##
=======================================
Coverage 94.92% 94.93%
=======================================
Files 377 377
Lines 12817 12840 +23
Branches 2924 2929 +5
=======================================
+ Hits 12167 12190 +23
Misses 650 650
🚀 New features to boost your workflow:
|
|
|
||
| type OtlpHttpMetricExporterConfigModel = NonNullable< | ||
| PeriodicMetricReaderConfigModel['exporter']['otlp_http'] | ||
| >; |
There was a problem hiding this comment.
nit: This type could be exported from the configuration package and used directly.
| } | ||
|
|
||
| function getMetricExporterTemporalityPreference( | ||
| temporalityPreference: OtlpHttpMetricExporterConfigModel['temporality_preference'] |
There was a problem hiding this comment.
nit: Likewise, we could add an ExporterTemporalityPreferenceConfigModel export from the configuration package.
| ); | ||
| }); | ||
|
|
||
| it('passes OTLP HTTP metric exporter connection options from configuration', async function () { |
There was a problem hiding this comment.
nit: Move this it(...) case to a new describe('getPeriodicMetricReaderFromConfiguration', ... section. If I read this correctly, this is currently in the getBatchLogRecordProcessorConfigFromEnv describe block.
| }); | ||
|
|
||
| assert.ok(reader); | ||
| const exporter = getMetricExporterInternals(reader); |
There was a problem hiding this comment.
Could the same thing be accomplished with a type assertion to any? E.g.:
| const exporter = getMetricExporterInternals(reader); | |
| const exporter = (reader as any)._exporter; |
I guess I'm expressing a personal preference to avoid defining interface FooInterals types that give the veneer of type safety for spelunking into internal object details.
MikeGoldsmith
left a comment
There was a problem hiding this comment.
This looks good to me, thanks @cyphercodes.
A gap I still see, that I tried to resolve in my accidental duplicate PR (#6707), is the gRPC metric exporter only passes compression. It's missing endpoint, timeout, credentials (TLS), and metadata (headers) — same properties you're now passing for HTTP. This matches the pattern in the trace exporter gRPC path (#6705).
I'd be happy to do a follow-up for the gRPC parameters if you'd prefer to keep this PR scoped to HTTP.
|
Hey @cyphercodes do you still plan on working on this PR? |
|
Updated this PR to resolve the merge conflict with current What changed:
Local verification:
|
|
@cyphercodes did you see my message regarding the other paramters to the grpc exporter constructor? Please confirm you don't intend to add them here, and I can do them in a follow-up PR. |
|
Updated this PR against current Also confirming the gRPC metric exporter constructor params are intentionally left out of this PR to keep this focused on the OTLP HTTP metric config path. Happy for those to be handled in a follow-up PR. Local verification:
|
MikeGoldsmith
left a comment
There was a problem hiding this comment.
Looks good to me. We can do the follow-up work for additional constructor params in a new PR.H
|
[I'd had a number of nits in my review from 3w ago. Did you intended to look into those? |
|
|
||
| ### :bug: Bug Fixes | ||
|
|
||
| * fix(sdk-node): pass OTLP HTTP metric exporter configuration from declarative config [#6665](https://github.com/open-telemetry/opentelemetry-js/issues/6665) @cyphercodes |
There was a problem hiding this comment.
This now needs to move up to the unreleased section.
Signed-off-by: cyphercodes <cyphercodes@users.noreply.github.com>
|
Updated this PR to resolve the current merge conflict with What changed:
Local verification:
|
|
Hi @cyphercodes, there were several comments added by Trent and Mike that you still need to address, your latest commit is merging with master but not addressing any of them. I also want to take this opportunity for a reminder of OpenTelemetry Generative AI Contribution Policy. The policy allows AI-assisted contributions, but contributors remain responsible for understanding, validating, and meaningfully owning the work they submit. That includes replying on PRs, we would like to hear directly from you, specially replying to other humans that are taking the time to review your contribution, so please avoid just copying AI generated output that don't add value to the conversation. Thank you! |
|
There has been no activity in this PR, so I will go ahead and close without merging. @MikeGoldsmith do you want to take over? Let me know if so, and if you want to make changes on top of this PR (in this case I will leave it open) or just create a new one |
…ttp-metric-config # Conflicts: # experimental/packages/opentelemetry-sdk-node/test/utils.test.ts
|
Updated this PR against current |
|
Sorry @cyphercodes, #6814 superseded this and has merged. The linked issue is now closed so I think we should close this PR too. |
|
Closing this issue, per @MikeGoldsmith latest comment |
Which problem is this PR solving?
Fixes #6665.
startNodeSDKwas creating OTLP HTTP metric exporters from declarative config with only compression wired through, so settings such as endpoint, headers, timeout, TLS, temporality, and histogram aggregation were ignored.Short description of the changes
headers_listand structuredheaders, with structured headers taking precedence.Type of change
How Has This Been Tested?
cd experimental/packages/opentelemetry-sdk-node && npm run lintcd experimental/packages/opentelemetry-sdk-node && npm run compilecd experimental/packages/opentelemetry-sdk-node && npm test -- --grep "passes OTLP HTTP metric exporter"cd experimental/packages/opentelemetry-sdk-node && npm test(190 passing, 3 pending)npx markdownlint-cli2 experimental/CHANGELOG.mdgit diff --checkChecklist: