Search in sources :

Example 6 with BackendInfo

use of org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo in project hypertrace-ingester by hypertrace.

the class SqsBackendProviderTest method TestOtelSqsBackendResolution.

@Test
public void TestOtelSqsBackendResolution() {
    String sqsConnectionString = "https://queue.amazonaws.com/80398EXAMPLE/MyQueue";
    URL sqsURL;
    try {
        sqsURL = new URL(sqsConnectionString);
        String sqsHost = sqsURL.getHost();
        BackendInfo backendInfo = backendEntityEnricher.resolve(getOtelSqsBackendEvent(sqsConnectionString), structuredTrace, structuredTraceGraph).get();
        Entity entity = backendInfo.getEntity();
        Assertions.assertEquals(sqsHost, entity.getEntityName());
        Map<String, AttributeValue> attributes = backendInfo.getAttributes();
        assertEquals(Map.of("BACKEND_OPERATION", AttributeValueCreator.create("receive"), "BACKEND_DESTINATION", AttributeValueCreator.create("QueueName")), attributes);
    } catch (MalformedURLException e) {
        Assertions.fail("Unable to create URL for given connection string");
    }
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Example 7 with BackendInfo

use of org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo in project hypertrace-ingester by hypertrace.

the class SqsBackendProviderTest method TestOTBackendEventResolution.

@Test
public void TestOTBackendEventResolution() {
    String sqsHost = "sqs.ap-south-1.amazonaws.com";
    BackendInfo entity = backendEntityEnricher.resolve(getOTSqsBackendEvent(sqsHost), structuredTrace, structuredTraceGraph).get();
    Assertions.assertEquals(sqsHost, entity.getEntity().getEntityName());
}
Also used : BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Example 8 with BackendInfo

use of org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo in project hypertrace-ingester by hypertrace.

the class CassandraBackendProviderTest method testBackendResolution.

@Test
public void testBackendResolution() {
    BackendInfo backendInfo = backendEntityEnricher.resolve(getCassandraEvent(), structuredTrace, structuredTraceGraph).get();
    Entity entity = backendInfo.getEntity();
    Assertions.assertEquals("localhost:9000", entity.getEntityName());
    Map<String, AttributeValue> attributes = backendInfo.getAttributes();
    assertEquals(Map.of("BACKEND_OPERATION", AttributeValueCreator.create("select"), "BACKEND_DESTINATION", AttributeValueCreator.create("customer.orders")), attributes);
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Example 9 with BackendInfo

use of org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo in project hypertrace-ingester by hypertrace.

the class CassandraBackendProviderTest method testBackendResolutionForOTEvent.

@Test
public void testBackendResolutionForOTEvent() {
    BackendInfo backendInfo = backendEntityEnricher.resolve(getCassandraOTEvent(), structuredTrace, structuredTraceGraph).get();
    Entity entity = backendInfo.getEntity();
    Assertions.assertEquals("localhost:9000", entity.getEntityName());
    Map<String, AttributeValue> attributes = backendInfo.getAttributes();
    assertEquals(Map.of("BACKEND_OPERATION", AttributeValueCreator.create("select")), attributes);
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Example 10 with BackendInfo

use of org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo in project hypertrace-ingester by hypertrace.

the class ElasticsearchBackendProviderTest method testBackendResolutionForOTelEvent.

@Test
public void testBackendResolutionForOTelEvent() {
    BackendInfo backendInfo = backendEntityEnricher.resolve(getElasticsearchOTelEvent(), structuredTrace, structuredTraceGraph).get();
    Entity entity = backendInfo.getEntity();
    Assertions.assertEquals("test:2000", entity.getEntityName());
    Map<String, AttributeValue> attributes = backendInfo.getAttributes();
    assertEquals(Map.of("BACKEND_OPERATION", AttributeValueCreator.create("GetAction"), "BACKEND_DESTINATION", AttributeValueCreator.create("test-index")), attributes);
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Aggregations

BackendInfo (org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo)26 Test (org.junit.jupiter.api.Test)25 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)24 Entity (org.hypertrace.entity.data.service.v1.Entity)20 Event (org.hypertrace.core.datamodel.Event)12 TestUtil.buildAttributeValue (org.hypertrace.traceenricher.TestUtil.buildAttributeValue)10 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 AttributeValue (org.hypertrace.entity.data.service.v1.AttributeValue)1 Builder (org.hypertrace.entity.data.service.v1.Entity.Builder)1 BackendType (org.hypertrace.traceenricher.enrichment.enrichers.BackendType)1 BackendProvider (org.hypertrace.traceenricher.enrichment.enrichers.backend.provider.BackendProvider)1