use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetSqlOperation.
@Test
public void testGetSqlOperation() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(RawSpanConstants.getValue(Sql.SQL_QUERY), SemanticConventionTestUtil.buildAttributeValue("SELECT * FROM DB")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getDbOperationForJDBC(e);
assertEquals("SELECT", v.get());
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetCassandraURI.
@Test
public void testGetCassandraURI() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.DB_CONNECTION_STRING.getValue(), SemanticConventionTestUtil.buildAttributeValue("jdbc:cassandra://localhost:9000")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getCassandraURI(e);
assertEquals("localhost:9000", v.get());
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testIsSqlTypeBackendForOtelFormat.
@Test
public void testIsSqlTypeBackendForOtelFormat() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.DB_SYSTEM.getValue(), SemanticConventionTestUtil.buildAttributeValue(OTelDbSemanticConventions.DB2_DB_SYSTEM_VALUE.getValue())));
when(e.getAttributes()).thenReturn(attributes);
boolean v = DbSemanticConventionUtils.isSqlTypeBackendForOtelFormat(e);
assertTrue(v);
attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.DB_SYSTEM.getValue(), SemanticConventionTestUtil.buildAttributeValue(OTelDbSemanticConventions.MONGODB_DB_SYSTEM_VALUE.getValue())));
when(e.getAttributes()).thenReturn(attributes);
v = DbSemanticConventionUtils.isSqlTypeBackendForOtelFormat(e);
assertFalse(v);
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetRedisDestination.
@Test
public void testGetRedisDestination() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.REDIS_DB_INDEX.getValue(), SemanticConventionTestUtil.buildAttributeValue("15")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getDestinationForRedis(e);
assertEquals("15", v.get());
}
use of org.hypertrace.core.datamodel.Attributes in project hypertrace-ingester by hypertrace.
the class DbSemanticConventionUtilsTest method testGetElasticsearchURI.
@Test
public void testGetElasticsearchURI() {
Event e = mock(Event.class);
Attributes attributes = SemanticConventionTestUtil.buildAttributes(Map.of(OTelDbSemanticConventions.ELASTICSEARCH_URL.getValue(), SemanticConventionTestUtil.buildAttributeValue("localhost:9000")));
when(e.getAttributes()).thenReturn(attributes);
Optional<String> v = DbSemanticConventionUtils.getElasticSearchURI(e);
assertEquals("localhost:9000", v.get());
}
Aggregations