Search in sources :

Example 76 with Entity

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

the class BackendEntityEnricherTest method test_EnrichTrace_BackendResolvedForBrokenEvent.

@Test
public void test_EnrichTrace_BackendResolvedForBrokenEvent() {
    String eventName = "broken event";
    String backendName = "peer";
    String backendId = "peerId";
    String serviceName = "client";
    Map<String, String> identifyingAttributes = Map.of(BACKEND_PROTOCOL_ATTR_NAME, "UNKNOWN", BACKEND_HOST_ATTR_NAME, backendName, BACKEND_PORT_ATTR_NAME, "-1");
    Map<String, String> attributes = Map.of("FROM_EVENT", eventName, "FROM_EVENT_ID", HexUtils.getHex(ByteBuffer.wrap(EVENT_ID.getBytes())));
    Entity backendEntity = createEntity(EntityType.BACKEND, backendName, identifyingAttributes, attributes, TENANT_ID);
    when(edsClient.upsert(eq(backendEntity))).thenReturn(Entity.newBuilder(backendEntity).setEntityId(backendId).putAllAttributes(createEdsAttributes(identifyingAttributes)).build());
    // for broken event service and peer service are different
    Event e = createApiExitEvent(EVENT_ID, serviceName, backendName).setEventName(eventName).build();
    StructuredTrace trace = createStructuredTrace(TENANT_ID, e);
    enricher.enrichTrace(trace);
    // assert that backend has been created
    Assertions.assertNotNull(EnrichedSpanUtils.getBackendId(e));
    Assertions.assertNotNull(EnrichedSpanUtils.getBackendName(e));
}
Also used : Entity(org.hypertrace.entity.data.service.v1.Entity) StructuredTrace(org.hypertrace.core.datamodel.StructuredTrace) Event(org.hypertrace.core.datamodel.Event) Test(org.junit.jupiter.api.Test) AbstractAttributeEnricherTest(org.hypertrace.traceenricher.enrichment.enrichers.AbstractAttributeEnricherTest)

Example 77 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity 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 78 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity 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 79 with Entity

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

the class ClientSpanEndpointProviderTest method checkFallbackBackendEntityGeneratedFromClientExitSpan.

@Test
public void checkFallbackBackendEntityGeneratedFromClientExitSpan() {
    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("span.kind", AttributeValue.newBuilder().setValue("client").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("redis::getDrivers").setStartTimeMillis(1566869077746L).setEndTimeMillis(1566869077750L).setMetrics(Metrics.newBuilder().setMetricMap(Map.of("Duration", MetricValue.newBuilder().setValue(4.0).build())).build()).setServiceName("redis").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();
    Event parentEvent = Event.newBuilder().setCustomerId("__default").setEventId(ByteBuffer.wrap("random".getBytes())).setAttributes(Attributes.newBuilder().setAttributeMap(Map.of("span.kind", AttributeValue.newBuilder().setValue("server").build())).build()).setEnrichedAttributes(Attributes.newBuilder().setAttributeMap(Map.of(SERVICE_NAME_ATTR, AttributeValue.newBuilder().setValue("customer").build())).build()).setEventName("getDrivers").setStartTimeMillis(1566869077746L).build();
    when(structuredTraceGraph.getParentEvent(e)).thenReturn(parentEvent);
    Entity backendEntity = backendEntityEnricher.resolve(e, structuredTrace, structuredTraceGraph).get().getEntity();
    assertEquals("redis", backendEntity.getIdentifyingAttributesMap().get(Constants.getEntityConstant(BackendAttribute.BACKEND_ATTRIBUTE_HOST)).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 80 with Entity

use of com.google.cloud.videointelligence.v1p2beta1.Entity 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

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