use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class BackendEntityViewGeneratorTest method testBackendEntityViewGenerator_HotrodTrace.
@Test
public void testBackendEntityViewGenerator_HotrodTrace() throws IOException {
StructuredTrace trace = TestUtilities.getSampleHotRodTrace();
BackendEntityViewGenerator backendEntityViewGenerator = new BackendEntityViewGenerator();
List<BackendEntityView> backendEntityViews = backendEntityViewGenerator.process(trace);
List<Event> computedBackendEvents = getEventsWithBackendEntity(trace);
assertEntity(backendEntityViews, computedBackendEvents);
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class SpanEventViewGeneratorTest method createMockEventWithAttribute.
private Event createMockEventWithAttribute(String key, String value) {
Event e = mock(Event.class);
when(e.getAttributes()).thenReturn(Attributes.newBuilder().setAttributeMap(Map.of(key, AttributeValue.newBuilder().setValue(value).build())).build());
when(e.getEnrichedAttributes()).thenReturn(null);
return e;
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class SpanEventViewGeneratorTest method testGetRequestUrl.
@Test
public void testGetRequestUrl() {
Event e = mock(Event.class);
when(e.getAttributes()).thenReturn(Attributes.newBuilder().setAttributeMap(Map.of("http.server_name", AttributeValue.newBuilder().setValue("0.0.0.0").build(), "net.host.port", AttributeValue.newBuilder().setValue("8000").build(), "http.route", AttributeValue.newBuilder().setValue("/list").build(), "http.method", AttributeValue.newBuilder().setValue("GET").build(), "http.scheme", AttributeValue.newBuilder().setValue("http").build(), "http.host", AttributeValue.newBuilder().setValue("34.33.33.33:8000").build(), "http.target", AttributeValue.newBuilder().setValue("/list?url=www.google.com").build())).build());
Assertions.assertEquals("http://34.33.33.33:8000/list?url=www.google.com", spanEventViewGenerator.getRequestUrl(e, Protocol.PROTOCOL_HTTP));
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class SpanEventViewGeneratorTest method test_getRequestUrl_grpcProctol_shouldReturnEnrichedAttribute.
@Test
public void test_getRequestUrl_grpcProctol_shouldReturnEnrichedAttribute() {
Event event = mock(Event.class);
when(event.getAttributes()).thenReturn(Attributes.newBuilder().setAttributeMap(Map.of("grpc.request.url", AttributeValue.newBuilder().setValue("Recv.hipstershop.AdService").build())).build());
when(event.getEventName()).thenReturn("Sent.hipstershop.AdService.GetAds");
assertEquals("Recv.hipstershop.AdService", spanEventViewGenerator.getRequestUrl(event, Protocol.PROTOCOL_GRPC));
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class SpanEventViewGeneratorTest method testGetRequestUrl_urlAndPathIsAbsent.
@Test
public void testGetRequestUrl_urlAndPathIsAbsent() {
Event event = mock(Event.class);
Assertions.assertNull(spanEventViewGenerator.getRequestUrl(event, Protocol.PROTOCOL_HTTP));
}
Aggregations