Skip to content

refactor!(otlp-grpc-exporter-base): remove headers from gRPC config type#6487

Merged
dyladan merged 7 commits intoopen-telemetry:mainfrom
pratik50:fix/grpc-exporter-remove-headers
Mar 11, 2026
Merged

refactor!(otlp-grpc-exporter-base): remove headers from gRPC config type#6487
dyladan merged 7 commits intoopen-telemetry:mainfrom
pratik50:fix/grpc-exporter-remove-headers

Conversation

@pratik50
Copy link
Copy Markdown
Contributor

Fixes #5520

if you pass headers when using gRPC exporter, it just gets silently ignored. no error, nothing. pretty confusing for users.

turns out OTLPGRPCExporterConfigNode was extending OTLPExporterConfigBase which has headers in it (that's for HTTP only). gRPC doesn't use HTTP headers, it uses metadata instead.

Short description of the changes

removed extends OTLPExporterConfigBase from OTLPGRPCExporterConfigNode
manually added only the fields gRPC actually needs (url, concurrencyLimit, timeoutMillis)
removed the diag.warn for headers since TS will catch it at compile time now

all 3 exporters (trace, metrics, logs) import this type from base so they're all fixed with this one change

Type of change

  • Breaking change

passing headers will now be a TS compile error instead of silently doing nothing. i think this is fine since it was never actually working anyway users should use metadata for gRPC

How Has This Been Tested?

existing tests for all packages pass:

  • otlp-grpc-exporter-base
  • exporter-trace-otlp-grpc
  • opentelemetry-exporter-metrics-otlp-grpc
  • exporter-logs-otlp-grpc

Checklist:

  • Followed the style guidelines of this project
  • Unit tests pass
  • Documentation has been updated

@pratik50 pratik50 requested a review from a team as a code owner March 10, 2026 16:11
Copy link
Copy Markdown
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing against the actual code change but the CHANGELOG entry is wrong and package-lock is unnecessarily changed.

Comment thread package-lock.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change

Comment thread CHANGELOG.md Outdated
* fix(opentelemetry-instrumentation): improve `_warnOnPreloadedModules` function not to show warning logs when the module is not marked as loaded [#6095](https://github.com/open-telemetry/opentelemetry-js/pull/6095) @rlj1202
* fix(sdk-trace-base): derive internal `SpanOptions` from API type to prevent drift [#6478](https://github.com/open-telemetry/opentelemetry-js/pull/6478) @overbalance
* fix(span): enforce `attributePerEventCountLimit`, `attributePerLinkCountLimit`, `linkCountLimit`, and `attributeValueLengthLimit` for event/link attributes [#6479](https://github.com/open-telemetry/opentelemetry-js/pull/6479) @overbalance
* fix(otlp-grpc-exporter-base): remove `headers` from gRPC exporter config type, passing headers now results in a compile-time error instead of being silently ignored [#6487](https://github.com/open-telemetry/opentelemetry-js/pull/6487)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong place and replaces an existing entry rather than creating a new one. This should be under the :breaking: header in experimental/CHANGELOG.md. It is also not a bugfix so i'd consider switching this to be a refactor! type.

@pratik50
Copy link
Copy Markdown
Contributor Author

@dyladan thanks for the review!
Fixed both moved the CHANGELOG entry to experimental/CHANGELOG.md under boom: Breaking Changes and reverted the package-lock.json changes.

Comment thread CHANGELOG.md

* fix(opentelemetry-instrumentation): improve `_warnOnPreloadedModules` function not to show warning logs when the module is not marked as loaded [#6095](https://github.com/open-telemetry/opentelemetry-js/pull/6095) @rlj1202
* fix(sdk-trace-base): derive internal `SpanOptions` from API type to prevent drift [#6478](https://github.com/open-telemetry/opentelemetry-js/pull/6478) @overbalance
* fix(span): enforce `attributePerEventCountLimit`, `attributePerLinkCountLimit`, `linkCountLimit`, and `attributeValueLengthLimit` for event/link attributes [#6479](https://github.com/open-telemetry/opentelemetry-js/pull/6479) @overbalance
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this unintended change

Comment on lines +13 to +15
url?: string;
concurrencyLimit?: number;
timeoutMillis?: number;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These typically come from OTLPExporterConfigBase. If they're removed here we risk them becoming out of sync. It would be better to remove the bad header property from the base and add it specifically to the HTTP exporters. Alternatively you could use Omit<T, K> to remove it from the parent class before using it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to Omit<OTLPExporterConfigBase, 'headers'> and All tests passed. Pls review it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, IMO it's a positive thing that they diverge:

  • they're different exporters and the same options (url in particular) behave differently based on whether they're used for gRPC or http, which makes them hard to document.
  • we also don't consume OTLPGRPCExporterConfigNode as OTLPExporterConfigBase anywhere anymore.
  • it makes it less likely that things are added to the base that unintentionally get added to the gRPC exporter's public API which can confuse users (like what happened to headers in this case).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense! So should I revert back to the original approach (manually listing the fields with TS types) and drop the Omit change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do that in a follow up PR, your current change addresses what the linked issue was about. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.73%. Comparing base (de02086) to head (6241597).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6487   +/-   ##
=======================================
  Coverage   95.73%   95.73%           
=======================================
  Files         364      364           
  Lines       11826    11826           
  Branches     2765     2765           
=======================================
  Hits        11322    11322           
  Misses        504      504           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with the current change % this blocking comment, as the current change addresses the original intent of the linked issue.

We can discuss not having OTLPGRPCExporterConfigNode extend OTLPExporterConfigBase in a follow-up, but it's not necessary to do right now.

@pratik50
Copy link
Copy Markdown
Contributor Author

All issues fixed, ready for re-review!

@pichlermarc pichlermarc requested a review from dyladan March 11, 2026 11:56
@dyladan dyladan added this pull request to the merge queue Mar 11, 2026
@dyladan dyladan changed the title fix(otlp-grpc-exporter-base): remove headers from gRPC config type refactor!(otlp-grpc-exporter-base): remove headers from gRPC config type Mar 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 11, 2026
@dyladan dyladan added this pull request to the merge queue Mar 11, 2026
Merged via the queue into open-telemetry:main with commit 17e9f91 Mar 11, 2026
27 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Mar 11, 2026

Thank you for your contribution @pratik50! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@opentelemetry/exporter-trace-otlp-grpc ignores headers

3 participants