use of org.hypertrace.entity.data.service.v1.AttributeValue 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);
}
use of org.hypertrace.entity.data.service.v1.AttributeValue 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);
}
use of org.hypertrace.entity.data.service.v1.AttributeValue 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);
}
use of org.hypertrace.entity.data.service.v1.AttributeValue in project hypertrace-ingester by hypertrace.
the class ElasticsearchBackendProviderTest method testBackendResolutionForOTEvent.
@Test
public void testBackendResolutionForOTEvent() {
BackendInfo backendInfo = backendEntityEnricher.resolve(getElasticsearchOTEvent(), structuredTrace, structuredTraceGraph).get();
Entity entity = backendInfo.getEntity();
Assertions.assertEquals("test", entity.getEntityName());
Map<String, AttributeValue> attributes = backendInfo.getAttributes();
assertEquals(Map.of("BACKEND_OPERATION", AttributeValueCreator.create("GET"), "BACKEND_DESTINATION", AttributeValueCreator.create("test-index")), attributes);
}
use of org.hypertrace.entity.data.service.v1.AttributeValue in project hypertrace-ingester by hypertrace.
the class GrpcBackendProviderTest method checkBackendEntityGeneratedFromGrpcEvent.
@Test
public void checkBackendEntityGeneratedFromGrpcEvent() {
Map<String, AttributeValue> attributeMap = ImmutableMap.<String, AttributeValue>builder().put("grpc.method", AttributeValue.newBuilder().setValue("/hipstershop.ProductCatalogService/ListProducts").build()).put("span.kind", AttributeValue.newBuilder().setValue("client").build()).put("component", AttributeValue.newBuilder().setValue("grpc").build()).put("k8s.pod_id", AttributeValue.newBuilder().setValue("55636196-c840-11e9-a417-42010a8a0064").build()).put("docker.container_id", AttributeValue.newBuilder().setValue("ee85cf2cfc3b24613a3da411fdbd2f3eabbe729a5c86c5262971c8d8c29dad0f").build()).put("FLAGS", AttributeValue.newBuilder().setValue("0").build()).put("grpc.host_port", AttributeValue.newBuilder().setValue("productcatalogservice:3550").build()).put("grpc.response.body", AttributeValue.newBuilder().setValue("products {\\n id: \\\"5d644175551847d7408760b5\\\"\\n name: \\\"Vintage Record Player\\\"\\n description: \\\"It still works.\\\"\\n picture: \\\"/static").build()).put("grpc.request.body", AttributeValue.newBuilder().setValue("").build()).build();
Event e = Event.newBuilder().setCustomerId("__default").setEventId(ByteBuffer.wrap("bdf03dfabf5c70f8".getBytes())).setEntityIdList(Arrays.asList("4bfca8f7-4974-36a4-9385-dd76bf5c8824")).setEnrichedAttributes(Attributes.newBuilder().setAttributeMap(Map.of("SPAN_TYPE", AttributeValue.newBuilder().setValue("EXIT").build(), "rpc.service", AttributeValue.newBuilder().setValue("myservice.EchoService").build(), "PROTOCOL", AttributeValue.newBuilder().setValue("GRPC").build())).build()).setAttributes(Attributes.newBuilder().setAttributeMap(attributeMap).build()).setEventName("Sent.hipstershop.ProductCatalogService.ListProducts").setStartTimeMillis(1566869077746L).setEndTimeMillis(1566869077750L).setMetrics(Metrics.newBuilder().setMetricMap(Map.of("Duration", MetricValue.newBuilder().setValue(4.0).build())).build()).setEventRefList(Arrays.asList(EventRef.newBuilder().setTraceId(ByteBuffer.wrap("random_trace_id".getBytes())).setEventId(ByteBuffer.wrap("random_event_id".getBytes())).setRefType(EventRefType.CHILD_OF).build())).build();
final BackendInfo backendInfo = backendEntityEnricher.resolve(e, structuredTrace, structuredTraceGraph).get();
final Entity backendEntity = backendInfo.getEntity();
assertEquals("productcatalogservice:3550", backendEntity.getEntityName());
assertEquals(3, backendEntity.getIdentifyingAttributesCount());
assertEquals(backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PROTOCOL)).getValue().getString(), "GRPC");
assertEquals(backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_HOST)).getValue().getString(), "productcatalogservice");
assertEquals(backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PORT)).getValue().getString(), "3550");
assertEquals(backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT)).getValue().getString(), "Sent.hipstershop.ProductCatalogService.ListProducts");
assertEquals(backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT_ID)).getValue().getString(), "62646630336466616266356337306638");
assertEquals(backendEntity.getAttributesMap().get(Constants.getRawSpanConstant(Grpc.GRPC_METHOD)).getValue().getString(), "/hipstershop.ProductCatalogService/ListProducts");
Map<String, AttributeValue> attributes = backendInfo.getAttributes();
assertEquals(Map.of("BACKEND_DESTINATION", AttributeValueCreator.create("myservice.EchoService"), "BACKEND_OPERATION", AttributeValueCreator.create("/hipstershop.ProductCatalogService/ListProducts")), attributes);
}
Aggregations