|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +package io.opentelemetry.javaagent.instrumentation.spring.pulsar.v1_2; |
| 7 | + |
| 8 | +import static io.opentelemetry.api.trace.SpanKind.CONSUMER; |
| 9 | +import static io.opentelemetry.api.trace.SpanKind.INTERNAL; |
| 10 | +import static io.opentelemetry.api.trace.SpanKind.PRODUCER; |
| 11 | +import static io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil.orderByRootSpanKind; |
| 12 | + |
| 13 | +import io.opentelemetry.instrumentation.spring.pulsar.v1_0.AbstractSpringPulsarTest; |
| 14 | + |
| 15 | +class SpringPulsarTest extends AbstractSpringPulsarTest { |
| 16 | + |
| 17 | + @Override |
| 18 | + protected void assertSpringPulsar() { |
| 19 | + testing.waitAndAssertSortedTraces( |
| 20 | + orderByRootSpanKind(INTERNAL, CONSUMER), |
| 21 | + trace -> |
| 22 | + trace.hasSpansSatisfyingExactly( |
| 23 | + span -> span.hasName("parent").hasNoParent(), |
| 24 | + span -> |
| 25 | + span.hasName(OTEL_TOPIC + " publish") |
| 26 | + .hasKind(PRODUCER) |
| 27 | + .hasParent(trace.getSpan(0)) |
| 28 | + .hasAttributesSatisfyingExactly(publishAttributes()), |
| 29 | + span -> |
| 30 | + span.hasName(String.format("%s process", OTEL_TOPIC)) |
| 31 | + .hasKind(CONSUMER) |
| 32 | + .hasParent(trace.getSpan(1)) |
| 33 | + .hasAttributesSatisfyingExactly(processAttributes()), |
| 34 | + span -> span.hasName("consumer").hasParent(trace.getSpan(2))), |
| 35 | + trace -> |
| 36 | + trace.hasSpansSatisfyingExactly( |
| 37 | + span -> |
| 38 | + span.hasName(String.format("%s receive", OTEL_TOPIC)) |
| 39 | + .hasKind(CONSUMER) |
| 40 | + .hasNoParent() |
| 41 | + .hasAttributesSatisfyingExactly(receiveAttributes()))); |
| 42 | + } |
| 43 | +} |
0 commit comments