Skip to content

[extension/jaegerremotesampling] disable grpc#48440

Open
ansh0014 wants to merge 17 commits into
open-telemetry:mainfrom
ansh0014:jrs-disable-grpc-45944
Open

[extension/jaegerremotesampling] disable grpc#48440
ansh0014 wants to merge 17 commits into
open-telemetry:mainfrom
ansh0014:jrs-disable-grpc-45944

Conversation

@ansh0014
Copy link
Copy Markdown

Fixes #45944

Problem

The jaegerremotesampling extension always starts a gRPC server on a default port, even when not needed. This causes port conflicts with other components like jaegerreceiver that bind the same port, with no way to disable it via config.

Changes

  • Wrap GRPCServerConfig in configoptional.Optional so users can omit the gRPC server entirely
  • gRPC is now disabled by default using configoptional.None — only starts when explicitly configured
  • Start gRPC server only when explicitly configured via HasValue()
  • Update validation to require at least one of HTTP or gRPC
  • Update schema and tests to reflect optional gRPC config
  • Fix formatting with gofmt

Testing

go test ./... # from extension/jaegerremotesampling

@yurishkuro addressed all Copilot feedback — gRPC disabled by default and formatting fixed. Would appreciate a re-review!

Copilot AI review requested due to automatic review settings May 16, 2026 19:13
@ansh0014 ansh0014 requested a review from a team as a code owner May 16, 2026 19:13
@ansh0014 ansh0014 requested a review from dehaansa May 16, 2026 19:13
@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • First-time contributors should have at most one PR not marked as draft until their first PR is merged.
  • If your change isn't one of our priority components, reviews may take more time.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help or struggle to move your PR forward, raise the topic on #otel-collector-dev or a Collector SIG meeting.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Makes the jaegerremotesampling extension's gRPC server optional by wrapping GRPCServerConfig in configoptional.Optional, removing the always-on default that bound port 14250 and conflicted with jaegerreceiver. The gRPC server is now only started when the user explicitly configures grpc: in their YAML; validation still requires at least one of HTTP or gRPC to be set.

Changes:

  • Type Config.GRPCServerConfig switched from *configgrpc.ServerConfig to configoptional.Optional[configgrpc.ServerConfig], with default configoptional.None[...]().
  • Start now uses HasValue()/Get() instead of nil-checking the pointer; Validate updated accordingly.
  • Tests adjusted to construct optional gRPC configs via configoptional.Some(...); added duplicate TestConfigValidate and a chloggen entry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extension/jaegerremotesampling/config.go Make GRPCServerConfig optional and update validation to use HasValue().
extension/jaegerremotesampling/factory.go Drop default gRPC endpoint; initialize with configoptional.None.
extension/jaegerremotesampling/extension.go Start gRPC server only when HasValue() is true.
extension/jaegerremotesampling/config_test.go Update expected configs; add new TestConfigValidate cases.
extension/jaegerremotesampling/factory_test.go Update default-config expectation to configoptional.None.
extension/jaegerremotesampling/extension_test.go Construct gRPC config via configoptional.Some in test helpers.
.chloggen/jaegerremotesampling-port-validation.yaml Add changelog entry (note does not match actual change).
Comments suppressed due to low confidence (1)

.chloggen/jaegerremotesampling-port-validation.yaml:11

  • The changelog note describes adding "validation to detect port conflicts between HTTP and gRPC servers," but the PR does not introduce any port conflict detection. The actual change makes the gRPC server optional and disabled by default. The note and subtext should accurately describe what this PR does (disabling gRPC by default / making it opt-in) so users reading the release notes understand the behavior change.
note: Add validation to detect port conflicts between HTTP and gRPC servers
issues: [45944]
subtext: |
  The jaegerremotesampling extension now validates that HTTP and gRPC servers
  are configured on different ports during configuration loading. This prevents
  runtime port binding failures and provides clear, actionable error messages
  when misconfigurations are detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .chloggen/jaegerremotesampling-port-validation.yaml Outdated
Comment on lines +117 to +193

func TestConfigValidate(t *testing.T) {
tests := []struct {
name string
config Config
expectedErr error
}{
{
name: "valid config with both protocols",
config: Config{
HTTPServerConfig: &confighttp.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:5778",
},
},
GRPCServerConfig: configoptional.Some(configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
},
}),
Source: Source{
File: "/etc/strategies.json",
},
},
expectedErr: nil,
},
{
name: "valid config with only gRPC",
config: Config{
GRPCServerConfig: configoptional.Some(configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:14250",
},
}),
Source: Source{
Remote: &configgrpc.ClientConfig{},
},
},
expectedErr: nil,
},
{
name: "valid config with only HTTP",
config: Config{
HTTPServerConfig: &confighttp.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:5778",
},
},
Source: Source{
File: "/etc/strategies.json",
},
},
expectedErr: nil,
},
{
name: "invalid: no protocols configured",
config: Config{
Source: Source{
File: "/etc/strategies.json",
},
},
expectedErr: errAtLeastOneProtocol,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.config.Validate()
if tt.expectedErr != nil {
require.Error(t, err)
assert.ErrorIs(t, err, tt.expectedErr)
} else {
require.NoError(t, err)
}
})
}
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@andrzej-stencel andrzej-stencel changed the title Jrs disable grpc 45944 [extension/jaegerremotesampling] disable grpc 45944 May 18, 2026
@andrzej-stencel andrzej-stencel changed the title [extension/jaegerremotesampling] disable grpc 45944 [extension/jaegerremotesampling] disable grpc May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[extension/jaegerremotesampling] Cannot disable GRPC port

3 participants