Skip to content

Commit 3e491c8

Browse files
committed
Remove prometheus-metrics-shaded-protobuf dependency from the agent
1 parent 145bd88 commit 3e491c8

File tree

3 files changed

+60
-26
lines changed

3 files changed

+60
-26
lines changed

javaagent-tooling/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ dependencies {
3434
implementation("io.opentelemetry:opentelemetry-exporter-otlp")
3535
implementation("io.opentelemetry:opentelemetry-exporter-logging-otlp")
3636

37-
implementation("io.opentelemetry:opentelemetry-exporter-prometheus")
37+
implementation("io.opentelemetry:opentelemetry-exporter-prometheus") {
38+
exclude(group = "io.prometheus", module = "prometheus-metrics-shaded-protobuf")
39+
}
40+
compileOnly("io.prometheus:prometheus-metrics-exposition-formats:1.3.1")
3841
implementation("io.opentelemetry:opentelemetry-exporter-zipkin")
3942

4043
implementation("io.opentelemetry:opentelemetry-sdk-extension-jaeger-remote-sampler")
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.prometheus.metrics.expositionformats;
7+
8+
import io.prometheus.metrics.model.snapshots.MetricSnapshots;
9+
import java.io.IOException;
10+
import java.io.OutputStream;
11+
12+
/**
13+
* Replacement for prometheus protobuf writer that does not depend on any of the protobuf classes.
14+
* This allows us to exclude io.prometheus:prometheus-metrics-shaded-protobuf dependency.
15+
*
16+
* @see <a href="https://github.com/prometheus/client_java/blob/main/prometheus-metrics-exposition-formats/src/main/java/io/prometheus/metrics/expositionformats/PrometheusProtobufWriter.java">PrometheusProtobufWriter</a>
17+
*/
18+
public class PrometheusProtobufWriter implements ExpositionFormatWriter {
19+
20+
@Override
21+
public boolean accepts(String acceptHeader) {
22+
return false;
23+
}
24+
25+
@Override
26+
public void write(OutputStream out, MetricSnapshots metricSnapshots) throws IOException {
27+
throw new UnsupportedOperationException();
28+
}
29+
30+
@Override
31+
public String getContentType() {
32+
throw new UnsupportedOperationException();
33+
}
34+
}

licenses/licenses.md

Lines changed: 22 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)