Skip to content

opentelemetry-exporter-otlp-common: remove dependence on incubating attributes from OTLP exporters#5387

Open
herin049 wants to merge 3 commits into
open-telemetry:mainfrom
herin049:fix/exporter-metrics
Open

opentelemetry-exporter-otlp-common: remove dependence on incubating attributes from OTLP exporters#5387
herin049 wants to merge 3 commits into
open-telemetry:mainfrom
herin049:fix/exporter-metrics

Conversation

@herin049

@herin049 herin049 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Previously, the opentelemetry-exporter-otlp-proto-common package (utilized by the gRPC and Protobuf exporters), made direct use of incubating attributes from opentelemetry.semconv._incubating.* which does not guarantee stability with future versions of this package, despite the loose version constraints in the pyproject.toml. To address this issue, the exporter metrics classes/utilities have been moved to the opentelemetry-exporter-otlp-common package and the incubating/unstable attributes/functions have been included directly into this package, leaving no explicit dependency on the Semconv package. Moving the exporter metrics logic to opentelemetry-exporter-otlp-common is also necessary for adding exporter metrics to the new OTLP JSON exporter (since this exporter can not depend on opentelemetry-exporter-otlp-proto-common).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tox

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

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

@herin049 herin049 marked this pull request as ready for review July 3, 2026 21:26
@herin049 herin049 requested a review from a team as a code owner July 3, 2026 21:26
@herin049 herin049 changed the title exporters: remove dependence on incubating attributes from OTLP exporters opentelemetry-exporter-otlp-common: remove dependence on incubating attributes from OTLP exporters Jul 3, 2026

Copilot AI 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.

Pull request overview

This PR refactors OTLP exporter internal-metrics helpers so OTLP exporters no longer import incubating semconv OTEL component attributes/metrics directly, by moving exporter-metrics utilities into opentelemetry-exporter-otlp-common and duplicating the required semconv constants there.

Changes:

  • Moved exporter-metrics implementation/semconv constants into opentelemetry.exporter.otlp.common._exporter_metrics and updated OTLP exporters to import from the new location.
  • Added opentelemetry-exporter-otlp-common as a dependency where needed (workspace deps, tox envs, and per-package test requirements).
  • Added a changelog entry documenting the fix.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uv.lock Adds opentelemetry-api and opentelemetry-exporter-otlp-common to relevant locked dependency sets.
tox.ini Ensures tox OTLP exporter envs install opentelemetry-exporter-otlp-common.
tests/opentelemetry-test-utils/test-requirements.txt Adds opentelemetry-exporter-otlp-common to test utils requirements.
pyproject.toml Adds opentelemetry-exporter-otlp-common to the workspace dependencies.
exporter/opentelemetry-exporter-otlp/test-requirements.txt Adds opentelemetry-exporter-otlp-common to OTLP exporter tests.
exporter/opentelemetry-exporter-otlp-proto-http/test-requirements.txt Adds opentelemetry-exporter-otlp-common to OTLP proto-http tests.
exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/init.py Switches exporter-metrics imports to otlp.common._exporter_metrics and removes incubating OTEL component attribute import.
exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/init.py Switches exporter-metrics imports to otlp.common._exporter_metrics and removes incubating OTEL component attribute import.
exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/init.py Switches exporter-metrics imports to otlp.common._exporter_metrics and removes incubating OTEL component attribute import.
exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml Adds runtime dependency on opentelemetry-exporter-otlp-common.
exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py Updates tests to use OtelComponentTypeValues from otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements.oldest.txt Regenerates pinned test requirements to include opentelemetry-exporter-otlp-common.
exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements.latest.txt Regenerates pinned test requirements to include opentelemetry-exporter-otlp-common.
exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements.in Adds opentelemetry-exporter-otlp-common to proto-grpc test inputs.
exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/trace_exporter/init.py Updates import of OtelComponentTypeValues to come from otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/metric_exporter/init.py Updates import of OtelComponentTypeValues to come from otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py Switches exporter-metrics imports to otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/init.py Updates import of OtelComponentTypeValues to come from otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml Adds runtime dependency on opentelemetry-exporter-otlp-common.
exporter/opentelemetry-exporter-otlp-common/tests/test_exporter_metrics.py Updates tests to import exporter-metrics from otlp.common._exporter_metrics.
exporter/opentelemetry-exporter-otlp-common/src/opentelemetry/exporter/otlp/common/_exporter_metrics/semconv.py Introduces duplicated semconv constants and meter instrument factories (to avoid incubating semconv imports).
exporter/opentelemetry-exporter-otlp-common/src/opentelemetry/exporter/otlp/common/_exporter_metrics/init.py Rewires exporter-metrics implementation to use the local semconv constants/factories.
exporter/opentelemetry-exporter-otlp-common/pyproject.toml Adds opentelemetry-api dependency (needed for metrics API usage).
docs/getting_started/tests/requirements.txt Adds opentelemetry-exporter-otlp-common to docs getting-started tests requirements.
.changelog/5387.fixed Adds changelog entry for the fix.

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

@lzchen

lzchen commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@herin049

I might have missed the discussion on this but what was the reasoning for this change + #5388?

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants