use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class ErrorSemanticConventionUtilsTest method testCheckForException.
@Test
public void testCheckForException() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelErrorSemanticConventions.EXCEPTION_TYPE.getValue(), SemanticConventionTestUtil.buildAttributeValue("xyzerror")));
when(e.getAttributes()).thenReturn(attributes);
boolean v = ErrorSemanticConventionUtils.checkForException(e);
assertTrue(v);
attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelErrorSemanticConventions.EXCEPTION_MESSAGE.getValue(), SemanticConventionTestUtil.buildAttributeValue("xyzerror")));
when(e.getAttributes()).thenReturn(attributes);
v = ErrorSemanticConventionUtils.checkForException(e);
assertTrue(v);
attributes = SemanticConventionTestUtil.buildAttributes(Map.of("other_error", SemanticConventionTestUtil.buildAttributeValue("xyzerror")));
when(e.getAttributes()).thenReturn(attributes);
v = ErrorSemanticConventionUtils.checkForException(e);
assertFalse(v);
attributes = SemanticConventionTestUtil.buildAttributes(Map.of(RawSpanConstants.getValue(Error.ERROR_STACK_TRACE), SemanticConventionTestUtil.buildAttributeValue("org.abc.etc...")));
when(e.getAttributes()).thenReturn(attributes);
v = ErrorSemanticConventionUtils.checkForException(e);
assertTrue(v);
attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelErrorSemanticConventions.EXCEPTION_STACKTRACE.getValue(), SemanticConventionTestUtil.buildAttributeValue("org.abc.etc...")));
when(e.getAttributes()).thenReturn(attributes);
v = ErrorSemanticConventionUtils.checkForException(e);
assertTrue(v);
}
use of org.hypertrace.core.datamodel.Attributes 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());
}
use of org.hypertrace.core.datamodel.Attributes 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());
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetMongoDestination.
@Test
public void testGetMongoDestination() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.MONGODB_COLLECTION.getValue(), SemanticConventionTestUtil.buildAttributeValue("testCollection"), OTelDbSemanticConventions.DB_NAME.getValue(), SemanticConventionTestUtil.buildAttributeValue("customer")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getDestinationForMongo(e);
assertEquals("customer.testCollection", v.get());
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetCassandraOperation.
@Test
public void testGetCassandraOperation() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.DB_OPERATION.getValue(), SemanticConventionTestUtil.buildAttributeValue("select")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getDbOperation(e);
assertEquals("select", v.get());
}
Aggregations