use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class SpanEventViewGeneratorTest method test_getRequestUrl_httpProtocol_shouldReturnFullUrl.
@Test
public void test_getRequestUrl_httpProtocol_shouldReturnFullUrl() {
Event event = createMockEventWithAttribute(RawSpanConstants.getValue(HTTP_URL), "http://www.example.com");
assertEquals("http://www.example.com", spanEventViewGenerator.getRequestUrl(event, Protocol.PROTOCOL_HTTP));
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class DefaultTraceAttributeReaderTest method canReadSpanValues.
@Test
void canReadSpanValues() {
AttributeMetadata metadata = AttributeMetadata.newBuilder().setScopeString("TEST_SCOPE").setType(AttributeType.ATTRIBUTE).setValueKind(AttributeKind.TYPE_STRING).setDefinition(AttributeDefinition.newBuilder().setSourcePath("attrPath").build()).build();
when(this.mockAttributeClient.get("TEST_SCOPE", "key")).thenReturn(Single.just(metadata));
Event span = defaultedEventBuilder().setAttributes(buildAttributesWithKeyValue("attrPath", "attrValue")).build();
assertEquals(stringLiteral("attrValue"), this.traceAttributeReader.getSpanValue(mock(StructuredTrace.class), span, "TEST_SCOPE", "key").blockingGet());
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class DefaultValueResolverTest method resolvesFirstAvailableDefinition.
@Test
void resolvesFirstAvailableDefinition() {
AttributeMetadata metadata = AttributeMetadata.newBuilder().setScopeString("TEST_SCOPE").setType(AttributeType.ATTRIBUTE).setValueKind(AttributeKind.TYPE_INT64).setDefinition(AttributeDefinition.newBuilder().setFirstValuePresent(AttributeDefinitions.newBuilder().addDefinitions(AttributeDefinition.newBuilder().setSourcePath("path.to.string")).addDefinitions(AttributeDefinition.newBuilder().setSourcePath("non.existent")).addDefinitions(AttributeDefinition.newBuilder().setSourcePath("path.to.int")).addDefinitions(AttributeDefinition.newBuilder().setSourceField(SourceField.SOURCE_FIELD_START_TIME)))).build();
Event span = defaultedEventBuilder().setAttributes(buildAttributesWithKeyValues(Map.of("path.to.string", "foo", "path.to.int", "14"))).build();
assertEquals(longLiteral(14), this.resolver.resolve(ValueSourceFactory.forSpan(this.mockStructuredTrace, span), metadata).blockingGet());
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class DefaultValueResolverTest method resolvesMetrics.
@Test
void resolvesMetrics() {
AttributeMetadata metadata = AttributeMetadata.newBuilder().setScopeString("TEST_SCOPE").setType(AttributeType.METRIC).setValueKind(AttributeKind.TYPE_INT64).setDefinition(AttributeDefinition.newBuilder().setSourcePath("metricPath").build()).build();
Event span = defaultedEventBuilder().setMetrics(buildMetricsWithKeyValue("metricPath", 42)).build();
assertEquals(longLiteral(42), this.resolver.resolve(ValueSourceFactory.forSpan(this.mockStructuredTrace, span), metadata).blockingGet());
}
use of org.hypertrace.core.datamodel.Event in project hypertrace-ingester by hypertrace.
the class DefaultValueResolverTest method resolvesFirstAttributeProjection.
@Test
void resolvesFirstAttributeProjection() {
AttributeMetadata metadata = AttributeMetadata.newBuilder().setScopeString("TEST_SCOPE").setType(AttributeType.ATTRIBUTE).setValueKind(AttributeKind.TYPE_INT64).setDefinition(AttributeDefinition.newBuilder().setFirstValuePresent(AttributeDefinitions.newBuilder().addDefinitions(AttributeDefinition.newBuilder().setSourcePath("non.existent")).addDefinitions(AttributeDefinition.newBuilder().setProjection(Projection.newBuilder().setLiteral(LiteralValue.newBuilder().setStringValue("expected-value")))))).build();
Event span = defaultedEventBuilder().build();
assertEquals(stringLiteral("expected-value"), this.resolver.resolve(ValueSourceFactory.forSpan(this.mockStructuredTrace, span), metadata).blockingGet());
}
Aggregations