Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions exporters/prometheus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ dependencies {
implementation("io.prometheus:prometheus-metrics-exporter-httpserver") {
exclude(group = "io.prometheus", module = "prometheus-metrics-exposition-formats")
}
implementation("io.prometheus:prometheus-metrics-exposition-textformats")
implementation("io.prometheus:prometheus-metrics-exposition-formats-no-protobuf")

compileOnly("com.google.auto.value:auto-value-annotations")

annotationProcessor("com.google.auto.value:auto-value")

testImplementation(project(":sdk:testing"))
testImplementation("io.opentelemetry.proto:opentelemetry-proto")
testImplementation("io.prometheus:prometheus-metrics-exposition-formats-no-protobuf")
testImplementation("com.sun.net.httpserver:http")
testImplementation("com.google.guava:guava")
testImplementation("com.linecorp.armeria:armeria")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,25 @@ void fetchOpenMetrics() {
+ "# EOF\n");
}

@Test
void fetchProtobuf() {
AggregatedHttpResponse response =
client
.execute(
RequestHeaders.of(
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..

.aggregate()
.join();
assertThat(response.status()).isEqualTo(HttpStatus.OK);
assertThat(response.headers().get(HttpHeaderNames.CONTENT_TYPE))
.isEqualTo(
"application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited");
// don't decode the protobuf, just verify it doesn't throw an exception
}

@SuppressWarnings("ConcatenationWithEmptyString")
@Test
void fetchFiltered() {
Expand Down
4 changes: 3 additions & 1 deletion sdk-extensions/autoconfigure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ testing {
implementation(project(":exporters:logging-otlp"))
implementation(project(":exporters:otlp:all"))
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") {

}
implementation(project(":exporters:zipkin"))
implementation(project(":sdk:testing"))
implementation(project(":sdk:trace-shaded-deps"))
Expand Down
Loading