Search in sources :

Example 11 with Attributes

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

Example 12 with Attributes

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

Example 13 with Attributes

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

Example 14 with Attributes

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

Example 15 with Attributes

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());
}
Also used : 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)45 Event (org.hypertrace.core.datamodel.Event)41 Test (org.junit.jupiter.api.Test)40 SemanticConventionTestUtil.buildAttributes (org.hypertrace.semantic.convention.utils.SemanticConventionTestUtil.buildAttributes)8 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)3 HashMap (java.util.HashMap)2 AvroBuilderCache.fastNewBuilder (org.hypertrace.core.datamodel.shared.AvroBuilderCache.fastNewBuilder)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ProtocolStringList (com.google.protobuf.ProtocolStringList)1 JaegerSpanInternalModel (io.jaegertracing.api_v2.JaegerSpanInternalModel)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Nullable (javax.annotation.Nullable)1 Schema (org.apache.avro.Schema)1