Search in sources :

Example 36 with Event

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);
}
Also used : StructuredTrace(org.hypertrace.core.datamodel.StructuredTrace) Event(org.hypertrace.core.datamodel.Event) BackendEntityView(org.hypertrace.viewgenerator.api.BackendEntityView) Test(org.junit.jupiter.api.Test)

Example 37 with Event

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;
}
Also used : Event(org.hypertrace.core.datamodel.Event)

Example 38 with Event

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));
}
Also used : Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 39 with Event

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));
}
Also used : Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 40 with Event

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));
}
Also used : Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Aggregations

Event (org.hypertrace.core.datamodel.Event)304 Test (org.junit.jupiter.api.Test)257 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)54 StructuredTrace (org.hypertrace.core.datamodel.StructuredTrace)54 Attributes (org.hypertrace.core.datamodel.Attributes)41 Entity (org.hypertrace.entity.data.service.v1.Entity)27 HashMap (java.util.HashMap)25 AbstractAttributeEnricherTest (org.hypertrace.traceenricher.enrichment.enrichers.AbstractAttributeEnricherTest)17 ByteBuffer (java.nio.ByteBuffer)13 BackendInfo (org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo)13 StructuredTraceGraph (org.hypertrace.core.datamodel.shared.StructuredTraceGraph)12 TestUtil.buildAttributeValue (org.hypertrace.traceenricher.TestUtil.buildAttributeValue)11 AttributeMetadata (org.hypertrace.core.attribute.service.v1.AttributeMetadata)10 SemanticConventionTestUtil.buildAttributes (org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes)8 Edge (org.hypertrace.core.datamodel.Edge)7 Entity (org.hypertrace.core.datamodel.Entity)7 HashSet (java.util.HashSet)6 List (java.util.List)6 Map (java.util.Map)6 ArrayList (java.util.ArrayList)5