Skip to content

Conversation

@zeitlinger
Copy link
Member

Fixes #7659

@zeitlinger zeitlinger requested a review from a team as a code owner September 17, 2025 07:46
@zeitlinger zeitlinger self-assigned this Sep 17, 2025
@zeitlinger zeitlinger changed the title Update Prometheus Exporter dependencies to use no-protobuf formats Update Prometheus Exporter dependencies to use no-protobuf formats (and adds test) Sep 17, 2025
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7664   +/-   ##
=========================================
  Coverage     90.06%   90.06%           
  Complexity     7104     7104           
=========================================
  Files           805      805           
  Lines         21484    21484           
  Branches       2093     2093           
=========================================
  Hits          19349    19349           
  Misses         1472     1472           
  Partials        663      663           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jack-berg
Copy link
Member

Here's the runtime classpath back in 1.50.0:

runtimeClasspath - Runtime classpath of source set 'main'.
+--- project :sdk:metrics
|    +--- project :api:all
|    |    \--- project :context
|    \--- project :sdk:common
|         \--- project :api:all (*)
+--- project :dependencyManagement
|    +--- com.fasterxml.jackson:jackson-bom:{strictly 2.19.0} -> 2.19.0
|    +--- com.google.guava:guava-bom:{strictly 33.4.8-jre} -> 33.4.8-jre
|    +--- com.google.protobuf:protobuf-bom:{strictly 4.30.2} -> 4.30.2
|    +--- com.squareup.okhttp3:okhttp-bom:{strictly 4.12.0} -> 4.12.0
|    +--- com.squareup.okio:okio-bom:{strictly 3.11.0} -> 3.11.0
|    +--- io.grpc:grpc-bom:{strictly 1.72.0} -> 1.72.0
|    +--- io.netty:netty-bom:{strictly 4.2.1.Final} -> 4.2.1.Final
|    +--- io.zipkin.brave:brave-bom:{strictly 6.2.0} -> 6.2.0
|    +--- io.zipkin.reporter2:zipkin-reporter-bom:{strictly 3.5.0} -> 3.5.0
|    +--- org.assertj:assertj-bom:{strictly 3.27.3} -> 3.27.3
|    +--- org.testcontainers:testcontainers-bom:{strictly 1.21.0} -> 1.21.0
|    +--- org.snakeyaml:snakeyaml-engine:{strictly 2.9} -> 2.9
|    +--- io.prometheus:prometheus-metrics-exporter-httpserver:1.3.6 (c)
|    \--- io.prometheus:prometheus-metrics-exposition-formats:1.3.6 (c)
+--- project :exporters:common
|    +--- project :api:all (*)
|    \--- project :sdk-extensions:autoconfigure-spi
|         \--- project :sdk:all
|              +--- project :api:all (*)
|              +--- project :sdk:common (*)
|              +--- project :sdk:trace
|              |    +--- project :api:all (*)
|              |    \--- project :sdk:common (*)
|              +--- project :sdk:metrics (*)
|              \--- project :sdk:logs
|                   +--- project :api:all (*)
|                   \--- project :sdk:common (*)
+--- project :sdk-extensions:autoconfigure-spi (*)
\--- io.prometheus:prometheus-metrics-exporter-httpserver -> 1.3.6
     \--- io.prometheus:prometheus-metrics-exporter-common:1.3.6
          +--- io.prometheus:prometheus-metrics-model:1.3.6
          +--- io.prometheus:prometheus-metrics-exposition-textformats:1.3.6
          |    +--- io.prometheus:prometheus-metrics-model:1.3.6
          |    \--- io.prometheus:prometheus-metrics-config:1.3.6
          \--- io.prometheus:prometheus-metrics-exposition-formats:1.3.6
               \--- io.prometheus:prometheus-metrics-exposition-textformats:1.3.6 (*)

And here's the classpath as of this PR:

runtimeClasspath - Runtime classpath of source set 'main'.
+--- project :sdk:metrics
|    +--- project :api:all
|    |    \--- project :context
|    |         \--- project :common
|    \--- project :sdk:common
|         \--- project :api:all (*)
+--- project :dependencyManagement
|    +--- com.fasterxml.jackson:jackson-bom:{strictly 2.20.0} -> 2.20.0
|    +--- com.google.guava:guava-bom:{strictly 33.4.8-jre} -> 33.4.8-jre
|    +--- com.google.protobuf:protobuf-bom:{strictly 4.32.1} -> 4.32.1
|    |    \--- com.google.protobuf:protobuf-java:4.32.1 (c)
|    +--- com.squareup.okhttp3:okhttp-bom:{strictly 5.1.0} -> 5.1.0
|    +--- com.squareup.okio:okio-bom:{strictly 3.16.0} -> 3.16.0
|    +--- io.grpc:grpc-bom:{strictly 1.75.0} -> 1.75.0
|    +--- io.netty:netty-bom:{strictly 4.2.6.Final} -> 4.2.6.Final
|    +--- io.zipkin.brave:brave-bom:{strictly 6.3.0} -> 6.3.0
|    +--- io.zipkin.reporter2:zipkin-reporter-bom:{strictly 3.5.1} -> 3.5.1
|    +--- org.assertj:assertj-bom:{strictly 3.27.4} -> 3.27.4
|    +--- org.testcontainers:testcontainers-bom:{strictly 1.21.3} -> 1.21.3
|    +--- org.snakeyaml:snakeyaml-engine:{strictly 2.10} -> 2.10
|    +--- io.prometheus:prometheus-metrics-exporter-httpserver:1.3.10 (c)
|    \--- io.prometheus:prometheus-metrics-exposition-formats-no-protobuf:1.3.10 (c)
+--- project :exporters:common
|    +--- project :api:all (*)
|    \--- project :sdk-extensions:autoconfigure-spi
|         \--- project :sdk:all
|              +--- project :api:all (*)
|              +--- project :sdk:common (*)
|              +--- project :sdk:trace
|              |    +--- project :api:all (*)
|              |    \--- project :sdk:common (*)
|              +--- project :sdk:metrics (*)
|              \--- project :sdk:logs
|                   +--- project :api:all (*)
|                   \--- project :sdk:common (*)
+--- project :sdk-extensions:autoconfigure-spi (*)
+--- io.prometheus:prometheus-metrics-exporter-httpserver -> 1.3.10
|    \--- io.prometheus:prometheus-metrics-exporter-common:1.3.10
|         +--- io.prometheus:prometheus-metrics-model:1.3.10
|         \--- io.prometheus:prometheus-metrics-exposition-textformats:1.3.10
|              +--- io.prometheus:prometheus-metrics-model:1.3.10
|              \--- io.prometheus:prometheus-metrics-config:1.3.10
\--- io.prometheus:prometheus-metrics-exposition-formats-no-protobuf -> 1.3.10
     +--- io.prometheus:prometheus-metrics-exposition-textformats:1.3.10 (*)
     \--- com.google.protobuf:protobuf-java:4.31.1 -> 4.32.1

Notably, the com.google.protobuf:protobuf-java transitive dependency is new, which I what I believe I was trying to avoid in this comment and associated commit.

What's going on here? How was protobuf export supported previously without the com.google.protobuf:protobuf-java dependency? Was it possibly coming as a transitive dependency from elsewhere?

@zeitlinger
Copy link
Member Author

How was protobuf export supported previously without the com.google.protobuf:protobuf-java dependency?

  • protobuf was shaded previously
  • now you have a choice of using the bundled protobuf or without shading (prometheus-metrics-exposition-formats-no-protobuf)

@jack-berg
Copy link
Member

Got it thanks for the context.

Ok, so we have a decision to make. Do we (opentelemetry-java) want to make protobuf serialization opt-in or opt-out? When protobuf was shaded, we had no choice. I lean towards opt-out (which is what this PR does), since an opt-in strategy makes it cumbersome to use protobuf + prometheus + otel java agent.

implementation(project(":exporters:prometheus"))
implementation("io.prometheus:prometheus-metrics-exporter-httpserver")
implementation("io.prometheus:prometheus-metrics-exporter-httpserver") {
exclude(group = "io.prometheus", module = "prometheus-metrics-exposition-formats")
Copy link
Member

Choose a reason for hiding this comment

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

What is the goal of this exclusion?

Copy link
Member Author

Choose a reason for hiding this comment

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

it aligns the classpath with what is used for compile - see

implementation("io.prometheus:prometheus-metrics-exporter-httpserver") {

HttpMethod.GET,
"/metrics",
HttpHeaderNames.ACCEPT,
"Accept: application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily"))
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't see - this just didn't fail, because the dependency in question has been added the test classpath..

@zeitlinger
Copy link
Member Author

I lean towards opt-out

I agree - make it easy to use by default

@zeitlinger
Copy link
Member Author

@jack-berg @jkwatson as agreed (in SIG), we'll create a patch release once this is merged

@jkwatson jkwatson merged commit 04015cd into open-telemetry:main Sep 18, 2025
29 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 18, 2025
@zeitlinger zeitlinger deleted the prom-protobuf-fix branch September 19, 2025 12:42
the-clam pushed a commit to the-clam/opentelemetry-java that referenced this pull request Nov 6, 2025
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.

v1.51 breaks prometheus protobuf format (native histogram support)

3 participants