File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
src/test/java/io/opentelemetry/exporter/prometheus
sdk-extensions/autoconfigure Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,14 @@ dependencies {
1515 implementation(" io.prometheus:prometheus-metrics-exporter-httpserver" ) {
1616 exclude(group = " io.prometheus" , module = " prometheus-metrics-exposition-formats" )
1717 }
18- implementation(" io.prometheus:prometheus-metrics-exposition-textformats " )
18+ implementation(" io.prometheus:prometheus-metrics-exposition-formats-no-protobuf " )
1919
2020 compileOnly(" com.google.auto.value:auto-value-annotations" )
2121
2222 annotationProcessor(" com.google.auto.value:auto-value" )
2323
2424 testImplementation(project(" :sdk:testing" ))
2525 testImplementation(" io.opentelemetry.proto:opentelemetry-proto" )
26- testImplementation(" io.prometheus:prometheus-metrics-exposition-formats-no-protobuf" )
2726 testImplementation(" com.sun.net.httpserver:http" )
2827 testImplementation(" com.google.guava:guava" )
2928 testImplementation(" com.linecorp.armeria:armeria" )
Original file line number Diff line number Diff line change @@ -239,6 +239,25 @@ void fetchOpenMetrics() {
239239 + "# EOF\n " );
240240 }
241241
242+ @ Test
243+ void fetchProtobuf () {
244+ AggregatedHttpResponse response =
245+ client
246+ .execute (
247+ RequestHeaders .of (
248+ HttpMethod .GET ,
249+ "/metrics" ,
250+ HttpHeaderNames .ACCEPT ,
251+ "Accept: application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily" ))
252+ .aggregate ()
253+ .join ();
254+ assertThat (response .status ()).isEqualTo (HttpStatus .OK );
255+ assertThat (response .headers ().get (HttpHeaderNames .CONTENT_TYPE ))
256+ .isEqualTo (
257+ "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited" );
258+ // don't decode the protobuf, just verify it doesn't throw an exception
259+ }
260+
242261 @ SuppressWarnings ("ConcatenationWithEmptyString" )
243262 @ Test
244263 void fetchFiltered () {
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ testing {
5252 implementation(project(" :exporters:logging-otlp" ))
5353 implementation(project(" :exporters:otlp:all" ))
5454 implementation(project(" :exporters:prometheus" ))
55- implementation(" io.prometheus:prometheus-metrics-exporter-httpserver" )
55+ implementation(" io.prometheus:prometheus-metrics-exporter-httpserver" ) {
56+ exclude(group = " io.prometheus" , module = " prometheus-metrics-exposition-formats" )
57+ }
5658 implementation(project(" :exporters:zipkin" ))
5759 implementation(project(" :sdk:testing" ))
5860 implementation(project(" :sdk:trace-shaded-deps" ))
You can’t perform that action at this time.
0 commit comments