Skip to content

fix(ops): group OpenTelemetry module upgrades and sync semconv imports in Go files - #2015

Open
bwplotka wants to merge 1 commit into
mainfrom
gmpctl-otel-fix
Open

fix(ops): group OpenTelemetry module upgrades and sync semconv imports in Go files#2015
bwplotka wants to merge 1 commit into
mainfrom
gmpctl-otel-fix

Conversation

@bwplotka

@bwplotka bwplotka commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes vulnerability updates for OpenTelemetry modules in gmpctl:

  1. Simultaneous Module Upgrades Across Dependency Tree: Uses go list -m all to discover all direct and indirect go.opentelemetry.io/otel* modules (such as otel/trace, otel/sdk, otel/metric, etc.) and upgrades them simultaneously to avoid version drift and partial module upgrades.
  2. Dynamic semconv Import Synchronization: Dynamically queries the exact semconv package version imported by go.opentelemetry.io/otel/sdk/resource and updates hardcoded semconv imports in .go files. This prevents conflicting Schema URL errors during tracer provider initialization (e.g. failed to install a new tracer provider: error detecting resource: conflicting Schema URL: https://opentelemetry.io/schemas/1.40.0 and https://opentelemetry.io/schemas/1.41.0).

Signed-off-by: bwplotka bwplotka@google.com

Comment thread ops/gmpctl/lib.sh Outdated
Comment on lines +165 to +166
# OpenTelemetry modules share versions and schema URLs across packages (e.g. otel, otel/sdk, otel/trace, otel/metric).
# Upgrade all otel modules present in go.mod together to avoid conflicting schema URL errors.

This comment was marked as outdated.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the vulnerability fixing logic in ops/gmpctl/lib.sh to use go get for updating modules instead of direct sed replacements in go.mod. It also introduces special handling for OpenTelemetry modules to upgrade them simultaneously and align semconv imports to prevent conflicting Schema URL errors. The review feedback highlights potential script crashes due to the use of grep in pipelines under set -o pipefail and set -o errexit when no matches are found, and suggests using awk to safely handle these cases.

Comment thread ops/gmpctl/lib.sh Outdated
Comment thread ops/gmpctl/lib.sh
Comment thread ops/gmpctl/lib.sh
echo "🔄 Updating OpenTelemetry modules simultaneously:${otel_args}..."
go get ${otel_args}

# OpenTelemetry SDK resource detectors (e.g. WithProcessRuntimeDescription, WithTelemetrySDK)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am assuming we can equally in our fork remove the explicit schema at this point? 🤔

Image

https://github.com/GoogleCloudPlatform/prometheus/blob/a24099b1f7e42d86bae4e911d245fdcf932f7cff/tracing/tracing.go#L146

@bwplotka
bwplotka force-pushed the gmpctl-otel-fix branch 3 times, most recently from 6763f5e to 6bca81e Compare July 25, 2026 17:01
…s in Go files

- Uses `go list -m all` to include direct and indirect `go.opentelemetry.io/otel*` modules (such as `otel/trace`, `otel/sdk`, `otel/metric`) in simultaneous upgrades.
- Dynamically queries the exact `semconv` package version imported by `go.opentelemetry.io/otel/sdk/resource` and updates hardcoded `semconv` imports across Go files to match.

Signed-off-by: bwplotka <bwplotka@google.com>
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.

1 participant