Skip to content

Commit d211d01

Browse files
committed
add protobuf test
1 parent 1c5dd50 commit d211d01

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,24 @@ 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("application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited");
257+
// don't decode the protobuf, just verify it doesn't throw an exception
258+
}
259+
242260
@SuppressWarnings("ConcatenationWithEmptyString")
243261
@Test
244262
void fetchFiltered() {

0 commit comments

Comments
 (0)