Search in sources :

Example 1 with SemanticConventionTestUtil.buildAttributes

use of org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes in project hypertrace-ingester by hypertrace.

the class MessagingSemanticConventionUtilsTest method testGetRabbitmqOperation.

@Test
public void testGetRabbitmqOperation() {
    Event e = mock(Event.class);
    Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OtelMessagingSemanticConventions.MESSAGING_OPERATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("publish")));
    when(e.getAttributes()).thenReturn(attributes);
    Optional<String> v = MessagingSemanticConventionUtils.getMessagingOperation(e);
    assertEquals("publish", v.get());
}
Also used : SemanticConventionTestUtil.buildAttributes(org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes) Attributes(org.hypertrace.core.datamodel.Attributes) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 2 with SemanticConventionTestUtil.buildAttributes

use of org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes in project hypertrace-ingester by hypertrace.

the class MessagingSemanticConventionUtilsTest method testGetKafkaDestination.

@Test
public void testGetKafkaDestination() {
    Event e = mock(Event.class);
    Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OtelMessagingSemanticConventions.MESSAGING_DESTINATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("queueName"), OtelMessagingSemanticConventions.MESSAGING_KAFKA_CONSUMER_GROUP.getValue(), SemanticConventionTestUtil.buildAttributeValue("test")));
    when(e.getAttributes()).thenReturn(attributes);
    Optional<String> v = MessagingSemanticConventionUtils.getMessagingDestinationForKafka(e);
    assertEquals("test.queueName", v.get());
}
Also used : SemanticConventionTestUtil.buildAttributes(org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes) Attributes(org.hypertrace.core.datamodel.Attributes) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 3 with SemanticConventionTestUtil.buildAttributes

use of org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes in project hypertrace-ingester by hypertrace.

the class MessagingSemanticConventionUtilsTest method testGetRabbitmqDestination.

@Test
public void testGetRabbitmqDestination() {
    Event e = mock(Event.class);
    Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OtelMessagingSemanticConventions.MESSAGING_DESTINATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("queueName"), OtelMessagingSemanticConventions.RABBITMQ_ROUTING_KEY.getValue(), SemanticConventionTestUtil.buildAttributeValue("test-key")));
    when(e.getAttributes()).thenReturn(attributes);
    Optional<String> v = MessagingSemanticConventionUtils.getMessagingDestinationForRabbitmq(e);
    assertEquals("test-key.queueName", v.get());
}
Also used : SemanticConventionTestUtil.buildAttributes(org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes) Attributes(org.hypertrace.core.datamodel.Attributes) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 4 with SemanticConventionTestUtil.buildAttributes

use of org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes in project hypertrace-ingester by hypertrace.

the class MessagingSemanticConventionUtilsTest method testGetSqsOperation.

@Test
public void testGetSqsOperation() {
    Event e = mock(Event.class);
    Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OtelMessagingSemanticConventions.MESSAGING_OPERATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("publish")));
    when(e.getAttributes()).thenReturn(attributes);
    Optional<String> v = MessagingSemanticConventionUtils.getMessagingOperation(e);
    assertEquals("publish", v.get());
}
Also used : SemanticConventionTestUtil.buildAttributes(org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes) Attributes(org.hypertrace.core.datamodel.Attributes) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 5 with SemanticConventionTestUtil.buildAttributes

use of org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes in project hypertrace-ingester by hypertrace.

the class MessagingSemanticConventionUtilsTest method testGetSqsDestination.

@Test
public void testGetSqsDestination() {
    Event e = mock(Event.class);
    Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OtelMessagingSemanticConventions.MESSAGING_DESTINATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("queueName")));
    when(e.getAttributes()).thenReturn(attributes);
    Optional<String> v = MessagingSemanticConventionUtils.getMessagingDestination(e);
    assertEquals("queueName", v.get());
}
Also used : SemanticConventionTestUtil.buildAttributes(org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes) Attributes(org.hypertrace.core.datamodel.Attributes) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Aggregations

Attributes (org.hypertrace.core.datamodel.Attributes)6 Event (org.hypertrace.core.datamodel.Event)6 SemanticConventionTestUtil.buildAttributes (org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes)6 Test (org.junit.jupiter.api.Test)6