use of io.micrometer.core.instrument.search.RequiredSearch in project cxf by apache.
the class SpringJaxrsApplicationTest method testJaxrsExceptionMetric.
@Test
public void testJaxrsExceptionMetric() {
final WebTarget target = createWebTarget();
assertThatThrownBy(() -> target.request().delete(String.class)).isInstanceOf(InternalServerErrorException.class).hasMessageContaining("Internal Server Error");
await().atMost(Duration.ofSeconds(1)).ignoreException(MeterNotFoundException.class).until(() -> registry.get("cxf.server.requests").timers(), not(empty()));
RequiredSearch serverRequestMetrics = registry.get("cxf.server.requests");
Map<Object, Object> serverTags = serverRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(serverTags).containsOnly(entry("exception", "UnsupportedOperationException"), entry("method", "DELETE"), entry("operation", "deleteBooks"), entry("uri", "/api/app/library"), entry("outcome", "SERVER_ERROR"), entry("status", "500"));
RequiredSearch clientRequestMetrics = registry.get("cxf.client.requests");
Map<Object, Object> clientTags = clientRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(clientTags).containsOnly(entry("exception", "None"), entry("method", "DELETE"), entry("operation", "UNKNOWN"), entry("uri", "http://localhost:" + port + "/api/app/library"), entry("outcome", "SERVER_ERROR"), entry("status", "500"));
}
use of io.micrometer.core.instrument.search.RequiredSearch in project cxf by apache.
the class SpringJaxrsApplicationTest method testJaxrsProxySuccessMetric.
@Test
public void testJaxrsProxySuccessMetric() {
final LibraryApi api = createApi(port);
try (Response r = api.getBooks(1)) {
assertThat(r.getStatus()).isEqualTo(200);
}
await().atMost(Duration.ofSeconds(1)).ignoreException(MeterNotFoundException.class).until(() -> registry.get("cxf.server.requests").timers(), not(empty()));
RequiredSearch serverRequestMetrics = registry.get("cxf.server.requests");
Map<Object, Object> serverTags = serverRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(serverTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "getBooks"), entry("uri", "/api/app/library"), entry("outcome", "SUCCESS"), entry("status", "200"));
RequiredSearch clientRequestMetrics = registry.get("cxf.client.requests");
Map<Object, Object> clientTags = clientRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(clientTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "getBooks"), entry("uri", "http://localhost:" + port + "/api/app/library"), entry("outcome", "SUCCESS"), entry("status", "200"));
}
use of io.micrometer.core.instrument.search.RequiredSearch in project cxf by apache.
the class SpringJaxrsApplicationTest method testJaxrsFailedMetric.
@Test
public void testJaxrsFailedMetric() {
final WebTarget target = createWebTarget();
assertThatThrownBy(() -> target.path("100").request().get(Book.class)).isInstanceOf(NotFoundException.class).hasMessageContaining("Not Found");
await().atMost(Duration.ofSeconds(1)).ignoreException(MeterNotFoundException.class).until(() -> registry.get("cxf.server.requests").timers(), not(empty()));
RequiredSearch serverRequestMetrics = registry.get("cxf.server.requests");
Map<Object, Object> serverTags = serverRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(serverTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "getBook"), entry("uri", "/api/app/library/{id}"), entry("outcome", "CLIENT_ERROR"), entry("status", "404"));
RequiredSearch clientRequestMetrics = registry.get("cxf.client.requests");
Map<Object, Object> clientTags = clientRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(clientTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "UNKNOWN"), entry("uri", "http://localhost:" + port + "/api/app/library/100"), entry("outcome", "CLIENT_ERROR"), entry("status", "404"));
}
use of io.micrometer.core.instrument.search.RequiredSearch in project cxf by apache.
the class SpringJaxrsApplicationTest method testJaxrsProxyExceptionMetric.
@Test
public void testJaxrsProxyExceptionMetric() {
final LibraryApi api = createApi(port);
assertThatThrownBy(() -> api.deleteBooks()).isInstanceOf(InternalServerErrorException.class).hasMessageContaining("Internal Server Error");
await().atMost(Duration.ofSeconds(1)).ignoreException(MeterNotFoundException.class).until(() -> registry.get("cxf.server.requests").timers(), not(empty()));
RequiredSearch serverRequestMetrics = registry.get("cxf.server.requests");
Map<Object, Object> serverTags = serverRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(serverTags).containsOnly(entry("exception", "UnsupportedOperationException"), entry("method", "DELETE"), entry("operation", "deleteBooks"), entry("uri", "/api/app/library"), entry("outcome", "SERVER_ERROR"), entry("status", "500"));
RequiredSearch clientRequestMetrics = registry.get("cxf.client.requests");
Map<Object, Object> clientTags = clientRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(clientTags).containsOnly(entry("exception", "None"), entry("method", "DELETE"), entry("operation", "deleteBooks"), entry("uri", "http://localhost:" + port + "/api/app/library"), entry("outcome", "SERVER_ERROR"), entry("status", "500"));
}
use of io.micrometer.core.instrument.search.RequiredSearch in project cxf by apache.
the class SpringJaxrsTest method testJaxrsProxySuccessMetric.
@Test
public void testJaxrsProxySuccessMetric() {
final LibraryApi api = createApi(port);
try (Response r = api.getBooks(1)) {
assertThat(r.getStatus()).isEqualTo(200);
}
await().atMost(Duration.ofSeconds(1)).ignoreException(MeterNotFoundException.class).until(() -> registry.get("cxf.server.requests").timers(), not(empty()));
RequiredSearch serverRequestMetrics = registry.get("cxf.server.requests");
Map<Object, Object> serverTags = serverRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(serverTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "getBooks"), entry("uri", "/api/library"), entry("outcome", "SUCCESS"), entry("status", "200"));
RequiredSearch clientRequestMetrics = registry.get("cxf.client.requests");
Map<Object, Object> clientTags = clientRequestMetrics.timer().getId().getTags().stream().collect(toMap(Tag::getKey, Tag::getValue));
assertThat(clientTags).containsOnly(entry("exception", "None"), entry("method", "GET"), entry("operation", "getBooks"), entry("uri", "http://localhost:" + port + "/api/library"), entry("outcome", "SUCCESS"), entry("status", "200"));
}
Aggregations