Search in sources :

Example 6 with Event

use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.

the class EnrichedSpanUtilsTest method testGetBackendDestination_empty.

@Test
public void testGetBackendDestination_empty() {
    Event e = mock(Event.class);
    String backend_destination = EnrichedSpanUtils.getBackendDestination(e);
    assertNull(backend_destination);
}
Also used : Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 7 with Event

use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.

the class EnrichedSpanUtilsTest method testGetSpaceIds_empty.

@Test
public void testGetSpaceIds_empty() {
    Event e = mock(Event.class);
    List<String> spaceIds = EnrichedSpanUtils.getSpaceIds(e);
    assertEquals(emptyList(), spaceIds);
}
Also used : Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 8 with Event

use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.

the class EnrichedSpanUtilsTest method testGetEnrichedAttributesForPrefixAttributeKey.

@Test
public void testGetEnrichedAttributesForPrefixAttributeKey() {
    Event event = createMockEventWithEnrichedAttribute("prefix.hello", "world");
    Map<String, AttributeValue> filteredMap = SpanAttributeUtils.getAttributesWithPrefixKey(event, "prefix");
    assertEquals("world", filteredMap.get("prefix.hello").getValue());
}
Also used : AttributeValue(org.hypertrace.core.datamodel.AttributeValue) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 9 with Event

use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.

the class EnrichedSpanUtilsTest method createMockEventWithNoAttributes.

private Event createMockEventWithNoAttributes() {
    Event e = mock(Event.class);
    when(e.getAttributes()).thenReturn(null);
    when(e.getEnrichedAttributes()).thenReturn(null);
    return e;
}
Also used : Event(org.hypertrace.core.datamodel.Event)

Example 10 with Event

use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.

the class EnrichedSpanUtilsTest method getRequestSize_httpProtocol_noSize.

@Test
public void getRequestSize_httpProtocol_noSize() {
    Event e = createMockEventWithEnrichedAttribute("PROTOCOL", "HTTP");
    when(e.getAttributes()).thenReturn(Attributes.newBuilder().setAttributeMap(new HashMap<>()).build());
    Optional<Integer> requestSize = EnrichedSpanUtils.getRequestSize(e);
    assertTrue(requestSize.isEmpty());
}
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