Search in sources :

Example 81 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity 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);
}
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 82 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity 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);
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) Event(org.hypertrace.core.datamodel.Event) BackendInfo(org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo) Test(org.junit.jupiter.api.Test)

Example 83 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity in project hypertrace-ingester by hypertrace.

the class HttpBackendProviderTest method checkBackendEntityGeneratedFromHttpEventType2.

@Test
public void checkBackendEntityGeneratedFromHttpEventType2() {
    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(), "PROTOCOL", AttributeValue.newBuilder().setValue("HTTP").build())).build()).setAttributes(Attributes.newBuilder().setAttributeMap(Map.of("http.response.header.x-envoy-upstream-service-time", AttributeValue.newBuilder().setValue("11").build(), "http.response.header.x-forwarded-proto", AttributeValue.newBuilder().setValue("http").build(), "http.status_code", AttributeValue.newBuilder().setValue("200").build(), "FLAGS", AttributeValue.newBuilder().setValue("OK").build(), "http.protocol", AttributeValue.newBuilder().setValue("HTTP/1.1").build(), Constants.getRawSpanConstant(Http.HTTP_METHOD), AttributeValue.newBuilder().setValue("GET").build(), Constants.getRawSpanConstant((Http.HTTP_HOST)), AttributeValue.newBuilder().setValue("dataservice:9394").build(), Constants.getRawSpanConstant((Http.HTTP_PATH)), AttributeValue.newBuilder().setValue("product/5d644175551847d7408760b4").build(), "http.url", AttributeValue.newBuilder().setValue("http://dataservice:9394/product/5d644175551847d7408760b4").build(), "downstream_cluster", AttributeValue.newBuilder().setValue("-").build())).build()).setEventName("egress_http").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())).setHttp(org.hypertrace.core.datamodel.eventfields.http.Http.newBuilder().setRequest(Request.newBuilder().setUrl("http://dataservice:9394/product/5d644175551847d7408760b4").setHost("dataservice:9394").setPath("product/5d644175551847d7408760b4").build()).build()).build();
    final Entity backendEntity = backendEntityEnricher.resolve(e, structuredTrace, structuredTraceGraph).get().getEntity();
    assertEquals("dataservice:9394", backendEntity.getEntityName());
    assertEquals(3, backendEntity.getIdentifyingAttributesCount());
    assertEquals(BackendType.HTTP.name(), backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PROTOCOL)).getValue().getString());
    assertEquals("dataservice", backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_HOST)).getValue().getString());
    assertEquals(backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PORT)).getValue().getString(), "9394");
    assertEquals(backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT)).getValue().getString(), "egress_http");
    assertEquals("62646630336466616266356337306638", backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT_ID)).getValue().getString());
    assertEquals("GET", backendEntity.getAttributesMap().get(Constants.getRawSpanConstant(Http.HTTP_METHOD)).getValue().getString());
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 84 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity in project hypertrace-ingester by hypertrace.

the class HttpBackendProviderTest method checkBackendEntityGeneratedFromHttpEventType3.

@Test
public void checkBackendEntityGeneratedFromHttpEventType3() {
    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(), "PROTOCOL", AttributeValue.newBuilder().setValue("HTTP").build())).build()).setAttributes(Attributes.newBuilder().setAttributeMap(Map.of(RawSpanConstants.getValue(HTTP_URL), AttributeValue.newBuilder().setValue("http://dataservice:9394/userreview?productId=5d644175551847d7408760b4").build(), RawSpanConstants.getValue(HTTP_HOST), AttributeValue.newBuilder().setValue("dataservice:9394").build(), RawSpanConstants.getValue(HTTP_PATH), AttributeValue.newBuilder().setValue("/userreview").build(), RawSpanConstants.getValue(HTTP_REQUEST_QUERY_STRING), AttributeValue.newBuilder().setValue("productId=5d644175551847d7408760b4").build(), "http.request.method", AttributeValue.newBuilder().setValue("GET").build(), "FLAGS", AttributeValue.newBuilder().setValue("OK").build(), "http.request.url", AttributeValue.newBuilder().setValue("http://dataservice:9394/userreview?productId=5d644175551847d7408760b4").build())).build()).setEventName("jaxrs.client.exit").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 Entity backendEntity = backendEntityEnricher.resolve(e, structuredTrace, structuredTraceGraph).get().getEntity();
    assertEquals("dataservice:9394", backendEntity.getEntityName());
    assertEquals(3, backendEntity.getIdentifyingAttributesCount());
    assertEquals(BackendType.HTTP.name(), backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PROTOCOL)).getValue().getString());
    assertEquals("dataservice", backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_HOST)).getValue().getString());
    assertEquals(backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PORT)).getValue().getString(), "9394");
    assertEquals(backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT)).getValue().getString(), "jaxrs.client.exit");
    assertEquals(backendEntity.getAttributesMap().get(Constants.getEnrichedSpanConstant(Backend.BACKEND_FROM_EVENT_ID)).getValue().getString(), "62646630336466616266356337306638");
    assertEquals(backendEntity.getAttributesMap().get("http.request.method").getValue().getString(), "GET");
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Example 85 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity in project hypertrace-ingester by hypertrace.

the class JdbcBackendProviderTest method testGetBackendEntity.

@Test
public void testGetBackendEntity() {
    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())).build()).setAttributes(Attributes.newBuilder().setAttributeMap(Map.of("sql.url", AttributeValue.newBuilder().setValue("jdbc:mysql://mysql:3306/shop").build(), "span.kind", AttributeValue.newBuilder().setValue("client").build(), "sql.query", AttributeValue.newBuilder().setValue("insert into audit_message (message, id) values (?, ?)").build(), "k8s.pod_id", AttributeValue.newBuilder().setValue("55636196-c840-11e9-a417-42010a8a0064").build(), "docker.container_id", AttributeValue.newBuilder().setValue("ee85cf2cfc3b24613a3da411fdbd2f3eabbe729a5c86c5262971c8d8c29dad0f").build(), "FLAGS", AttributeValue.newBuilder().setValue("0").build())).build()).setEventName("jdbc.connection.prepare").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();
    Entity backendEntity = backendEntityEnricher.resolve(e, structuredTrace, structuredTraceGraph).get().getEntity();
    Map<String, org.hypertrace.entity.data.service.v1.AttributeValue> idAttrMap = backendEntity.getIdentifyingAttributesMap();
    assertEquals("mysql", idAttrMap.get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_HOST)).getValue().getString());
    assertEquals("3306", idAttrMap.get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PORT)).getValue().getString());
    assertEquals("JDBC", idAttrMap.get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_PROTOCOL)).getValue().getString());
    assertEquals("mysql", backendEntity.getAttributesMap().get(Constants.getRawSpanConstant(Sql.SQL_DB_TYPE)).getValue().getString());
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) TestUtil.buildAttributeValue(org.hypertrace.traceenricher.TestUtil.buildAttributeValue) AttributeValue(org.hypertrace.core.datamodel.AttributeValue) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test)

Aggregations

Entity (org.hypertrace.entity.data.service.v1.Entity)110 LivingEntity (org.bukkit.entity.LivingEntity)95 Test (org.junit.jupiter.api.Test)95 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 net.minecraft.world.entity (net.minecraft.world.entity)40 org.bukkit.entity (org.bukkit.entity)40 Entity (com.google.datastore.v1.Entity)33 ArrayList (java.util.ArrayList)33 Location (org.bukkit.Location)33 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)32 Event (org.hypertrace.core.datamodel.Event)27 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)22 BackendInfo (org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo)21 Mob (net.minecraft.world.entity.Mob)20 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)18 Entity (net.minecraft.server.v1_8_R3.Entity)18 AnnotateVideoProgress (com.google.cloud.videointelligence.v1.AnnotateVideoProgress)17 AnnotateVideoRequest (com.google.cloud.videointelligence.v1.AnnotateVideoRequest)17 AnnotateVideoResponse (com.google.cloud.videointelligence.v1.AnnotateVideoResponse)17 Entity (com.google.cloud.videointelligence.v1.Entity)17