Skip to content

feat(otlp-grpc-exporter): add gRPC channelOptions as config parameter#6332

Open
vitorvasc wants to merge 5 commits intoopen-telemetry:mainfrom
vitorvasc:otlp-grpc-exporter-channeloptions
Open

feat(otlp-grpc-exporter): add gRPC channelOptions as config parameter#6332
vitorvasc wants to merge 5 commits intoopen-telemetry:mainfrom
vitorvasc:otlp-grpc-exporter-channeloptions

Conversation

@vitorvasc
Copy link
Member

Which problem is this PR solving?

Currently, the GrpcExporterTransport only allows configuring compression and user-agent options. This change exposes the full ChannelOptions interface, enabling users to tune settings such as:

  • Keepalive: grpc.keepalive_time_ms, grpc.keepalive_timeout_ms, grpc.keepalive_permit_without_calls
  • Reconnection: grpc.initial_reconnect_backoff_ms, grpc.max_reconnect_backoff_ms
  • Message size limits: grpc.max_send_message_length, grpc.max_receive_message_length
  • Any other @grpc/grpc-js channel options

Fixes #6231

Short description of the changes

Add channelOptions?: ChannelOptions parameter to the OTLPGRPCExporterConfigNode interface, passing it through the configuration workflow to the gRPC client constructor.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests to ensure channelOptions passes through the configuration pipeline to the gRPC client constructor, with no changes to existing behavior:

  • otlp-grpc-configuration.test.ts - config merging (user > fallback > default)
  • grpc-exporter-transport.test.ts - transport accepts channelOptions
  • convert-legacy-otlp-grpc-options.test.ts - legacy conversion passthrough

Checklist:

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

…nsport interfaces

Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
…channelOptions

Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.55%. Comparing base (0fd543c) to head (363e55a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6332      +/-   ##
==========================================
- Coverage   95.58%   95.55%   -0.04%     
==========================================
  Files         314      315       +1     
  Lines        9590     9607      +17     
  Branches     2221     2228       +7     
==========================================
+ Hits         9167     9180      +13     
- Misses        423      427       +4     
Files with missing lines Coverage Δ
.../configuration/convert-legacy-otlp-grpc-options.ts 71.42% <ø> (ø)
...-base/src/configuration/otlp-grpc-configuration.ts 100.00% <100.00%> (ø)
...-grpc-exporter-base/src/grpc-exporter-transport.ts 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 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.

Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
Comment on lines 34 to +36
compression?: CompressionAlgorithm;
userAgent?: string;
channelOptions?: ChannelOptions;
Copy link
Member Author

Choose a reason for hiding this comment

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

With full ChannelOptions support, the compression and userAgent parameters could potentially be deprecated.

Here's how they could be passed instead:

import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
import { compressionAlgorithms } from '@grpc/grpc-js';

const exporter = new OTLPTraceExporter({
    url: 'otel-collector.example.com:4317',
-	compression: 'gzip',
-	userAgent: 'my-service/1.0.0',
+    channelOptions: {
+        'grpc.primary_user_agent': 'my-service/1.0.0',
+        'grpc.default_compression_algorithm': compressionAlgorithms.gzip,
+        'grpc.keepalive_timeout_ms': 60000,
+        'grpc.keepalive_permit_without_calls': 1,
+        'grpc.initial_reconnect_backoff_ms': 5000,
+        'grpc.max_reconnect_backoff_ms': 5000,
+    },
});

Should we move forward and mark both those attributes as deprecated?

@vitorvasc vitorvasc marked this pull request as ready for review January 23, 2026 11:30
@vitorvasc vitorvasc requested a review from a team as a code owner January 23, 2026 11:30
Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
@Dhruv-Garg79
Copy link

@cjihrig @vitorvasc can we please get this merged?

@cjihrig
Copy link
Contributor

cjihrig commented Feb 16, 2026

@Dhruv-Garg79 this still requires review and approval from a project maintainer.

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.

otlp-grpc-exporter: Expose gRPC ChannelOptions in OTLP gRPC Exporters

3 participants

Comments