Remove remaining usages of basic span asserts (#3616)
This commit is contained in:
parent
b6fb8753bd
commit
e0cb216610
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.datastax.driver.core.Cluster
|
||||
import com.datastax.driver.core.Session
|
||||
|
@ -111,7 +110,11 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
cassandraSpan(it, 1, spanName, expectedStatement, operation, keyspace, table, span(0))
|
||||
basicSpan(it, 2, "callbackListener", span(0))
|
||||
span(2) {
|
||||
name "callbackListener"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlSession
|
||||
import com.datastax.oss.driver.api.core.config.DefaultDriverOption
|
||||
|
@ -88,7 +87,11 @@ class CassandraClientTest extends AgentInstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
cassandraSpan(it, 1, spanName, expectedStatement, operation, keyspace, table, span(0))
|
||||
basicSpan(it, 2, "child", span(0))
|
||||
span(2) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
@ -62,9 +61,21 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "supplier", span(0))
|
||||
basicSpan(it, 2, "appendingSupplier", span(0))
|
||||
basicSpan(it, 3, "function", span(0))
|
||||
span(1) {
|
||||
name "supplier"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "appendingSupplier"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(3) {
|
||||
name "function"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +106,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +138,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +171,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +206,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +241,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +278,11 @@ class CompletableFutureTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
|
@ -81,7 +79,11 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
span(1) {
|
||||
name "asyncChild"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +168,11 @@ class ExecutorInstrumentationTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
span(1) {
|
||||
name "asyncChild"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
import javax.ws.rs.core.MediaType
|
||||
import javax.ws.rs.core.Response
|
||||
import javax.ws.rs.ext.ExceptionMapper
|
||||
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean
|
||||
import org.apache.cxf.endpoint.Server
|
||||
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean
|
||||
import test.JaxRsTestApplication
|
||||
|
||||
class CxfHttpServerTest extends JaxRsHttpServerTest<Server> {
|
||||
|
|
|
@ -9,7 +9,6 @@ import static io.opentelemetry.api.trace.StatusCode.ERROR
|
|||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static java.util.concurrent.TimeUnit.SECONDS
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
||||
|
@ -38,7 +37,11 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> implements Agent
|
|||
kind SERVER
|
||||
name getContextPath() + "/test-resource-super"
|
||||
}
|
||||
basicSpan(it, 1, "controller", span(0))
|
||||
span(1) {
|
||||
name "controller"
|
||||
kind INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +63,11 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> implements Agent
|
|||
kind SERVER
|
||||
name getContextPath() + "/test-resource-interface/call"
|
||||
}
|
||||
basicSpan(it, 1, "controller", span(0))
|
||||
span(1) {
|
||||
name "controller"
|
||||
kind INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,10 +87,26 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> implements Agent
|
|||
kind SERVER
|
||||
name getContextPath() + "/test-sub-resource-locator/call/sub"
|
||||
}
|
||||
basicSpan(it, 1,"JaxRsSubResourceLocatorTestResource.call", span(0))
|
||||
basicSpan(it, 2, "controller", span(1))
|
||||
basicSpan(it, 3, "SubResource.call", span(0))
|
||||
basicSpan(it, 4, "controller", span(3))
|
||||
span(1) {
|
||||
name "JaxRsSubResourceLocatorTestResource.call"
|
||||
kind INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "controller"
|
||||
kind INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
span(3) {
|
||||
name "SubResource.call"
|
||||
kind INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(4) {
|
||||
name "controller"
|
||||
kind INTERNAL
|
||||
childOf span(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://opentelemetry.io/test/hello-web-service"
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://opentelemetry.io/test/hello-web-service" elementFormDefault="qualified">
|
||||
|
||||
<xs:element name="helloRequest">
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
|
||||
|
||||
|
||||
import com.mchange.v2.c3p0.ComboPooledDataSource
|
||||
import com.zaxxer.hikari.HikariConfig
|
||||
import com.zaxxer.hikari.HikariDataSource
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
package io.opentelemetry.instrumentation.jdbc.datasource
|
||||
|
||||
import io.opentelemetry.instrumentation.jdbc.TestConnection
|
||||
|
||||
import javax.sql.DataSource
|
||||
import java.sql.Connection
|
||||
import java.sql.SQLException
|
||||
import java.sql.SQLFeatureNotSupportedException
|
||||
import java.util.logging.Logger
|
||||
import javax.sql.DataSource
|
||||
|
||||
class TestDataSource implements DataSource {
|
||||
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.jdbc
|
||||
|
||||
import java.sql.*
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.Driver
|
||||
import java.sql.DriverPropertyInfo
|
||||
import java.sql.SQLException
|
||||
import java.sql.SQLFeatureNotSupportedException
|
||||
import java.util.logging.Logger
|
||||
|
||||
class AnotherTestDriver implements Driver {
|
||||
|
|
|
@ -5,7 +5,19 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.jdbc
|
||||
|
||||
import java.sql.*
|
||||
|
||||
import java.sql.Array
|
||||
import java.sql.Blob
|
||||
import java.sql.CallableStatement
|
||||
import java.sql.Clob
|
||||
import java.sql.Date
|
||||
import java.sql.NClob
|
||||
import java.sql.Ref
|
||||
import java.sql.RowId
|
||||
import java.sql.SQLException
|
||||
import java.sql.SQLXML
|
||||
import java.sql.Time
|
||||
import java.sql.Timestamp
|
||||
|
||||
class TestCallableStatement extends TestPreparedStatement implements CallableStatement {
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.jdbc
|
||||
|
||||
import java.sql.*
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.Driver
|
||||
import java.sql.DriverPropertyInfo
|
||||
import java.sql.SQLException
|
||||
import java.sql.SQLFeatureNotSupportedException
|
||||
import java.util.logging.Logger
|
||||
|
||||
class TestDriver implements Driver {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
@ -45,7 +44,11 @@ class QueuedThreadPoolTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
span(1) {
|
||||
name "asyncChild"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +85,11 @@ class QueuedThreadPoolTest extends AgentInstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
span(1) {
|
||||
name "asyncChild"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait
|
||||
|
@ -83,7 +83,11 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/hello.xhtml", null)
|
||||
span(0) {
|
||||
name getContextPath() + "/hello.xhtml"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +108,11 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/greeting.xhtml", null)
|
||||
span(0) {
|
||||
name getContextPath() + "/greeting.xhtml"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
clearExportedData()
|
||||
|
@ -146,7 +154,11 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/greeting.xhtml", null)
|
||||
span(0) {
|
||||
name getContextPath() + "/greeting.xhtml"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
handlerSpan(it, 1, span(0), "#{greetingForm.submit()}")
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +177,11 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/greeting.xhtml", null)
|
||||
span(0) {
|
||||
name getContextPath() + "/greeting.xhtml"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
clearExportedData()
|
||||
|
@ -200,12 +216,19 @@ abstract class BaseJsfTest extends AgentInstrumentationSpecification implements
|
|||
|
||||
then:
|
||||
response2.status().code() == 500
|
||||
def ex = new Exception("submit exception")
|
||||
|
||||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/greeting.xhtml", null, new Exception("submit exception"))
|
||||
handlerSpan(it, 1, span(0), "#{greetingForm.submit()}", new Exception("submit exception"))
|
||||
span(0) {
|
||||
name getContextPath() + "/greeting.xhtml"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
status ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
handlerSpan(it, 1, span(0), "#{greetingForm.submit()}", ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CONSUMER
|
||||
import static io.opentelemetry.api.trace.SpanKind.PRODUCER
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
@ -114,7 +113,11 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"kafka.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
basicSpan(it, 3, "producer callback", span(0))
|
||||
span(3) {
|
||||
name "producer callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,7 +209,11 @@ class KafkaClientPropagationEnabledTest extends KafkaClientBaseTest {
|
|||
"kafka.record.queue_time_ms" { it >= 0 }
|
||||
}
|
||||
}
|
||||
basicSpan(it, 3, "producer callback", span(0))
|
||||
span(3) {
|
||||
name "producer callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
|
@ -90,7 +89,13 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent", null, exception)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status ERROR
|
||||
errorEvent(exception.class, exception.message)
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception)
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +133,11 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
span(2) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +174,11 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception.get())
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
span(2) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ package io.opentelemetry.instrumentation.mongo.testing
|
|||
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
|
|
|
@ -12,9 +12,8 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
|||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse
|
||||
import io.opentelemetry.testing.internal.armeria.common.HttpMethod
|
||||
|
@ -154,9 +153,21 @@ class RatpackForkedHttpServerTest extends RatpackHttpServerTest {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicServerSpan(it, 0, "/fork_and_yieldAll")
|
||||
basicSpan(it, 1, "/fork_and_yieldAll", span(0))
|
||||
basicSpan(it, 2, "controller", span(1))
|
||||
span(0) {
|
||||
name "/fork_and_yieldAll"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "/fork_and_yieldAll"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "controller"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package io.opentelemetry.instrumentation.reactor
|
||||
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
|
@ -58,10 +57,18 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
for (int i = 0; i < workSpans; i++) {
|
||||
basicSpan(it, 2 + i, "add one", span(1))
|
||||
span(2 + i) {
|
||||
name "add one"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +120,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
// impact the spans on reactor instrumentations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +155,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
// impact the spans on reactor instrumentations such as netty and lettuce, as reactor is
|
||||
// more of a context propagation mechanism than something we would be tracking for
|
||||
// errors this is ok.
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
for (int i = 0; i < workSpans; i++) {
|
||||
span(i + 2) {
|
||||
|
@ -179,7 +194,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +222,11 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
}
|
||||
}
|
||||
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
for (int i = 0; i < workSpans; i++) {
|
||||
span(i + 2) {
|
||||
|
@ -257,12 +280,28 @@ abstract class AbstractReactorCoreTest extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "publisher-parent", span(0))
|
||||
basicSpan(it, 2, "intermediate", span(1))
|
||||
span(1) {
|
||||
name "publisher-parent"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "intermediate"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2 * workItems; i = i + 2) {
|
||||
basicSpan(it, 3 + i, "add one", span(1))
|
||||
basicSpan(it, 3 + i + 1, "add two", span(1))
|
||||
span(3 + i) {
|
||||
name "add one"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
span(3 + i + 1) {
|
||||
name "add two"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.reactor
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
@ -37,7 +36,11 @@ abstract class AbstractSubscriptionTest extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
span(1) {
|
||||
name "Connection.query"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.reactornetty.v0_9
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.Span
|
||||
|
@ -170,7 +169,13 @@ abstract class AbstractReactorNettyHttpClientTest extends HttpClientTest<HttpCli
|
|||
trace(0, 2) {
|
||||
def parentSpan = span(0)
|
||||
|
||||
basicSpan(it, 0, "parent", null, ex)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status StatusCode.ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
span(1) {
|
||||
def actualException = ex.cause
|
||||
kind SpanKind.CLIENT
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.netty.resolver.AddressResolver
|
||||
import io.netty.resolver.AddressResolverGroup
|
||||
|
@ -176,7 +175,13 @@ abstract class AbstractReactorNettyHttpClientTest extends HttpClientTest<HttpCli
|
|||
trace(0, 2) {
|
||||
def parentSpan = span(0)
|
||||
|
||||
basicSpan(it, 0, "parent", null, ex)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status StatusCode.ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
span(1) {
|
||||
def actualException = ex.cause
|
||||
kind SpanKind.CLIENT
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava2
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runInternalSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
|
@ -43,7 +43,11 @@ abstract class AbstractRxJava2SubscriptionTest extends InstrumentationSpecificat
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
span(1) {
|
||||
name "Connection.query"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +77,11 @@ abstract class AbstractRxJava2SubscriptionTest extends InstrumentationSpecificat
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "child", span(0))
|
||||
span(1) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava2
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTraceWithoutExceptionCatch
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
|
||||
|
@ -82,7 +81,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < workSpans + 1; ++i) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +179,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +236,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,8 +274,16 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "addOne", span(0))
|
||||
basicSpan(it, 2, "addTwo", span(0))
|
||||
span(1) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "addTwo"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,11 +319,23 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "intermediate", span(0))
|
||||
span(1) {
|
||||
name "intermediate"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
for (int i = 2; i < 2 + 2 * workItems; i = i + 2) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
basicSpan(it, i + 1, "addTwo", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(i + 1) {
|
||||
name "addTwo"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +372,11 @@ abstract class AbstractRxJava2Test extends InstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < values.size() + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava3
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
@ -41,7 +40,11 @@ abstract class AbstractRxJava3SubscriptionTest extends InstrumentationSpecificat
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "Connection.query", span(0))
|
||||
span(1) {
|
||||
name "Connection.query"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.rxjava3
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTraceWithoutExceptionCatch
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
|
||||
|
@ -81,7 +80,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < workSpans + 1; ++i) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +178,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +235,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
}
|
||||
|
||||
for (int i = 1; i < workSpans + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,8 +273,16 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "addOne", span(0))
|
||||
basicSpan(it, 2, "addTwo", span(0))
|
||||
span(1) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "addTwo"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,11 +318,23 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "intermediate", span(0))
|
||||
span(1) {
|
||||
name "intermediate"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
for (int i = 2; i < 2 + 2 * workItems; i = i + 2) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
basicSpan(it, i + 1, "addTwo", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(i + 1) {
|
||||
name "addTwo"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +371,11 @@ abstract class AbstractRxJava3Test extends InstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
for (int i = 1; i < values.size() + 1; i++) {
|
||||
basicSpan(it, i, "addOne", span(0))
|
||||
span(i) {
|
||||
name "addOne"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
|
@ -67,7 +65,11 @@ class ScalaExecutorInstrumentationTest extends AgentInstrumentationSpecification
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "asyncChild", span(0))
|
||||
span(1) {
|
||||
name "asyncChild"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static java.util.Collections.emptyEnumeration
|
||||
|
||||
import groovy.servlet.AbstractHttpServlet
|
||||
|
@ -109,7 +108,13 @@ class HttpServletResponseTest extends AgentInstrumentationSpecification {
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent", null, ex)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
span(1) {
|
||||
name 'HttpServletResponseTest$2.sendRedirect'
|
||||
childOf span(0)
|
||||
|
|
|
@ -8,6 +8,8 @@ package client
|
|||
import io.netty.channel.ChannelOption
|
||||
import io.opentelemetry.instrumentation.test.base.HttpClientTest
|
||||
import io.opentelemetry.instrumentation.test.base.SingleConnection
|
||||
import java.util.concurrent.ExecutionException
|
||||
import java.util.concurrent.TimeoutException
|
||||
import org.springframework.http.HttpMethod
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector
|
||||
import org.springframework.web.reactive.function.client.WebClient
|
||||
|
@ -16,9 +18,6 @@ import reactor.ipc.netty.resources.PoolResources
|
|||
import reactor.netty.http.client.HttpClient
|
||||
import reactor.netty.resources.LoopResources
|
||||
|
||||
import java.util.concurrent.ExecutionException
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
class SpringWebFluxSingleConnection implements SingleConnection {
|
||||
private final ReactorClientHttpConnector connector
|
||||
private final String host
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
package test.boot
|
||||
|
||||
import org.springframework.context.ApplicationContext
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean
|
||||
import org.springframework.context.ApplicationContext
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.core.io.ClassPathResource
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://opentelemetry.io/test/hello-web-service"
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://opentelemetry.io/test/hello-web-service" elementFormDefault="qualified">
|
||||
|
||||
<xs:element name="helloRequest">
|
||||
|
|
|
@ -9,9 +9,8 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
|||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.NOT_FOUND
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
|
@ -133,8 +132,16 @@ class Struts2ActionSpanTest extends HttpServerTest<Server> implements AgentTestT
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/dispatch", null)
|
||||
basicSpan(it, 1, "GreetingAction.dispatch_servlet", span(0))
|
||||
span(0) {
|
||||
name getContextPath() + "/dispatch"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
span(1) {
|
||||
name "GreetingAction.dispatch_servlet"
|
||||
kind INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
|
@ -94,7 +93,11 @@ class TapestryTest extends AgentInstrumentationSpecification implements HttpServ
|
|||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
serverSpan(it, 0, getContextPath() + "/Index")
|
||||
basicSpan(it, 1, "activate/Index", span(0))
|
||||
span(1) {
|
||||
name "activate/Index"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,13 +115,29 @@ class TapestryTest extends AgentInstrumentationSpecification implements HttpServ
|
|||
assertTraces(2) {
|
||||
trace(0, 4) {
|
||||
serverSpan(it, 0, getContextPath() + "/Index")
|
||||
basicSpan(it, 1, "activate/Index", span(0))
|
||||
basicSpan(it, 2, "action/Index:start", span(0))
|
||||
basicSpan(it, 3, "Response.sendRedirect", span(2))
|
||||
span(1) {
|
||||
name "activate/Index"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "action/Index:start"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(3) {
|
||||
name "Response.sendRedirect"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(2)
|
||||
}
|
||||
}
|
||||
trace(1, 2) {
|
||||
serverSpan(it, 0, getContextPath() + "/Other")
|
||||
basicSpan(it, 1, "activate/Other", span(0))
|
||||
span(1) {
|
||||
name "activate/Other"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +149,7 @@ class TapestryTest extends AgentInstrumentationSpecification implements HttpServ
|
|||
|
||||
expect:
|
||||
response.status().code() == 500
|
||||
def ex = new IllegalStateException("expected")
|
||||
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
|
@ -139,8 +159,18 @@ class TapestryTest extends AgentInstrumentationSpecification implements HttpServ
|
|||
name getContextPath() + "/Index"
|
||||
status ERROR
|
||||
}
|
||||
basicSpan(it, 1, "activate/Index", span(0))
|
||||
basicSpan(it, 2, "action/Index:exception", span(0), new IllegalStateException("expected"))
|
||||
span(1) {
|
||||
name "activate/Index"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "action/Index:exception"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
status ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
|||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
@ -128,7 +127,11 @@ class UndertowServerTest extends HttpServerTest<Undertow> implements AgentTestTr
|
|||
"${SemanticAttributes.HTTP_USER_AGENT.key}" TEST_USER_AGENT
|
||||
}
|
||||
}
|
||||
basicSpan(it, 1, "sendResponse", span(0))
|
||||
span(1) {
|
||||
name "sendResponse"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +173,11 @@ class UndertowServerTest extends HttpServerTest<Undertow> implements AgentTestTr
|
|||
"${SemanticAttributes.HTTP_USER_AGENT.key}" TEST_USER_AGENT
|
||||
}
|
||||
}
|
||||
basicSpan(it, 1, "sendResponseWithException", span(0))
|
||||
span(1) {
|
||||
name "sendResponseWithException"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
package test.vaadin
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.vaadin.flow.server.Version
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
||||
abstract class AbstractVaadin14Test extends AbstractVaadinTest {
|
||||
static final boolean VAADIN_14_4 = Version.majorVersion >= 2 && Version.minorVersion >= 4
|
||||
|
@ -33,11 +33,19 @@ abstract class AbstractVaadin14Test extends AbstractVaadinTest {
|
|||
def handlers = getRequestHandlers("BootstrapHandler")
|
||||
trace(0, 2 + handlers.size()) {
|
||||
serverSpan(it, 0, getContextPath() + "/main")
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
// following traces are for javascript files used on page
|
||||
|
@ -64,13 +72,25 @@ abstract class AbstractVaadin14Test extends AbstractVaadinTest {
|
|||
def handlers = getRequestHandlers("UidlRequestHandler")
|
||||
trace(0, 2 + handlers.size() + 1) {
|
||||
serverSpan(it, 0, getContextPath() + "/main")
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
span(spanIndex) {
|
||||
name "EventRpcHandler.handle/click"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(spanIndex - 1)
|
||||
}
|
||||
basicSpan(it, spanIndex, "EventRpcHandler.handle/click", span(spanIndex - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
package test.vaadin
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import com.vaadin.flow.server.Version
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
|
||||
abstract class AbstractVaadin16Test extends AbstractVaadinTest {
|
||||
static final boolean VAADIN_17 = Version.majorVersion >= 4
|
||||
|
@ -36,10 +36,18 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
|
|||
def handlers = getRequestHandlers("IndexHtmlRequestHandler")
|
||||
trace(0, 2 + handlers.size()) {
|
||||
serverSpan(it, 0, "IndexHtmlRequestHandler.handleRequest")
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
// /xyz/VAADIN/build/vaadin-bundle-*.cache.js
|
||||
|
@ -56,10 +64,18 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
|
|||
handlers = getRequestHandlers("JavaScriptBootstrapHandler")
|
||||
trace(traceIndex, 2 + handlers.size()) {
|
||||
serverSpan(it, 0, getContextPath())
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
// /xyz/VAADIN/build/vaadin-?-*.cache.js
|
||||
|
@ -81,15 +97,31 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
|
|||
handlers = getRequestHandlers("UidlRequestHandler")
|
||||
trace(traceIndex + 5, 2 + handlers.size() + 2) {
|
||||
serverSpan(it, 0, getContextPath() + "/main")
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
|
||||
basicSpan(it, spanIndex, "PublishedServerEventHandlerRpcHandler.handle", span(spanIndex - 1))
|
||||
basicSpan(it, spanIndex + 1, "JavaScriptBootstrapUI.connectClient", span(spanIndex))
|
||||
span(spanIndex) {
|
||||
name "PublishedServerEventHandlerRpcHandler.handle"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(spanIndex - 1)
|
||||
}
|
||||
span(spanIndex + 1) {
|
||||
name "JavaScriptBootstrapUI.connectClient"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(spanIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,14 +132,26 @@ abstract class AbstractVaadin16Test extends AbstractVaadinTest {
|
|||
def handlers = getRequestHandlers("UidlRequestHandler")
|
||||
trace(0, 2 + handlers.size() + 1) {
|
||||
serverSpan(it, 0, getContextPath() + "/main")
|
||||
basicSpan(it, 1, "SpringVaadinServletService.handleRequest", span(0))
|
||||
span(1) {
|
||||
name "SpringVaadinServletService.handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
|
||||
int spanIndex = 2
|
||||
handlers.each { handler ->
|
||||
basicSpan(it, spanIndex++, handler + ".handleRequest", span(1))
|
||||
span(spanIndex++) {
|
||||
name handler + ".handleRequest"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
}
|
||||
|
||||
basicSpan(it, spanIndex, "EventRpcHandler.handle/click", span(spanIndex - 1))
|
||||
span(spanIndex) {
|
||||
name "EventRpcHandler.handle/click"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(spanIndex - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,10 @@ import static VertxReactiveWebServer.TEST_REQUEST_ID_PARAMETER
|
|||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||
import static io.opentelemetry.api.trace.SpanKind.SERVER
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicClientSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.context.Context
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
|
@ -73,8 +71,16 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" "127.0.0.1"
|
||||
}
|
||||
}
|
||||
basicSpan(it, 1, "handleListProducts", span(0))
|
||||
basicSpan(it, 2, "listProducts", span(1))
|
||||
span(1) {
|
||||
name "handleListProducts"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "listProducts"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(1)
|
||||
}
|
||||
span(3) {
|
||||
name "SELECT test.products"
|
||||
kind CLIENT
|
||||
|
@ -129,34 +135,59 @@ class VertxReactivePropagationTest extends AgentInstrumentationSpecification {
|
|||
def rootSpan = it.span(0)
|
||||
def requestId = Long.valueOf(rootSpan.name.substring("client ".length()))
|
||||
|
||||
basicSpan(it, 0, "client $requestId", null, null) {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
span(0) {
|
||||
name "client $requestId"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
}
|
||||
}
|
||||
basicServerSpan(it, 1, "/listProducts", span(0), null) {
|
||||
"${SemanticAttributes.NET_PEER_PORT.key}" Long
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
|
||||
"${SemanticAttributes.HTTP_URL.key}" "http://localhost:$port$baseUrl?$TEST_REQUEST_ID_PARAMETER=$requestId"
|
||||
"${SemanticAttributes.HTTP_METHOD.key}" "GET"
|
||||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" "127.0.0.1"
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
span(1) {
|
||||
name "/listProducts"
|
||||
kind SERVER
|
||||
childOf(span(0))
|
||||
attributes {
|
||||
"${SemanticAttributes.NET_PEER_PORT.key}" Long
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
|
||||
"${SemanticAttributes.HTTP_URL.key}" "http://localhost:$port$baseUrl?$TEST_REQUEST_ID_PARAMETER=$requestId"
|
||||
"${SemanticAttributes.HTTP_METHOD.key}" "GET"
|
||||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" "127.0.0.1"
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
}
|
||||
}
|
||||
basicSpan(it, 2, "handleListProducts", span(1), null) {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
span(2) {
|
||||
name "handleListProducts"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf(span(1))
|
||||
attributes {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
}
|
||||
}
|
||||
basicSpan(it, 3, "listProducts", span(2), null) {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
span(3) {
|
||||
name "listProducts"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf(span(2))
|
||||
attributes {
|
||||
"${TEST_REQUEST_ID_ATTRIBUTE}" requestId
|
||||
}
|
||||
}
|
||||
basicClientSpan(it, 4, "SELECT test.products", span(3), null) {
|
||||
"${SemanticAttributes.DB_SYSTEM.key}" "hsqldb"
|
||||
"${SemanticAttributes.DB_NAME.key}" "test"
|
||||
"${SemanticAttributes.DB_USER.key}" "SA"
|
||||
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "hsqldb:mem:"
|
||||
"${SemanticAttributes.DB_STATEMENT.key}" "SELECT id AS request$requestId, name, price, weight FROM products"
|
||||
"${SemanticAttributes.DB_OPERATION.key}" "SELECT"
|
||||
"${SemanticAttributes.DB_SQL_TABLE.key}" "products"
|
||||
span(4) {
|
||||
name "SELECT test.products"
|
||||
kind CLIENT
|
||||
childOf(span(3))
|
||||
attributes {
|
||||
"${SemanticAttributes.DB_SYSTEM.key}" "hsqldb"
|
||||
"${SemanticAttributes.DB_NAME.key}" "test"
|
||||
"${SemanticAttributes.DB_USER.key}" "SA"
|
||||
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "hsqldb:mem:"
|
||||
"${SemanticAttributes.DB_STATEMENT.key}" "SELECT id AS request$requestId, name, price, weight FROM products"
|
||||
"${SemanticAttributes.DB_OPERATION.key}" "SELECT"
|
||||
"${SemanticAttributes.DB_SQL_TABLE.key}" "products"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicServerSpan
|
||||
|
||||
import hello.HelloApplication
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse
|
||||
|
@ -61,7 +61,11 @@ class WicketTest extends AgentInstrumentationSpecification implements HttpServer
|
|||
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/wicket-test/hello.HelloPage")
|
||||
span(0) {
|
||||
name getContextPath() + "/wicket-test/hello.HelloPage"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,10 +76,17 @@ class WicketTest extends AgentInstrumentationSpecification implements HttpServer
|
|||
|
||||
expect:
|
||||
response.status().code() == 500
|
||||
def ex = new Exception("test exception")
|
||||
|
||||
assertTraces(1) {
|
||||
trace(0, 1) {
|
||||
basicServerSpan(it, 0, getContextPath() + "/wicket-test/hello.ExceptionPage", null, new Exception("test exception"))
|
||||
span(0) {
|
||||
name getContextPath() + "/wicket-test/hello.ExceptionPage"
|
||||
kind SpanKind.SERVER
|
||||
hasNoParent()
|
||||
status StatusCode.ERROR
|
||||
errorEvent(ex.class, ex.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.test.base
|
||||
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
|
@ -48,8 +47,16 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "other", it.span(0))
|
||||
basicSpan(it, 2, "callback", it.span(0))
|
||||
span(1) {
|
||||
name "other"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
span(2) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +90,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", span(0))
|
||||
span(1) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
trace(1, 1) {
|
||||
span(0) {
|
||||
|
@ -123,7 +134,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", it.span(0))
|
||||
span(1) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +171,11 @@ abstract class AbstractPromiseTest<P, M> extends AgentInstrumentationSpecificati
|
|||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
basicSpan(it, 1, "callback", it.span(0))
|
||||
span(1) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
|||
import static io.opentelemetry.api.trace.SpanKind.SERVER
|
||||
import static io.opentelemetry.api.trace.StatusCode.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.utils.PortUtils.UNUSABLE_PORT
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicClientSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderParentClientSpan
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
import static io.opentelemetry.testing.internal.armeria.common.MediaType.PLAIN_TEXT_UTF_8
|
||||
|
@ -382,7 +380,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
traces.sort(orderByRootSpanKind(CLIENT, SERVER))
|
||||
|
||||
trace(0, 1) {
|
||||
basicClientSpan(it, 0, "parent-client-span")
|
||||
span(0) {
|
||||
name "parent-client-span"
|
||||
kind CLIENT
|
||||
hasNoParent()
|
||||
}
|
||||
}
|
||||
trace(1, 1) {
|
||||
serverSpan(it, 0)
|
||||
|
@ -421,7 +423,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
}
|
||||
clientSpan(it, 1, span(0), method)
|
||||
serverSpan(it, 2, span(1))
|
||||
basicSpan(it, 3, "child", span(0))
|
||||
span(3) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,7 +577,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
then:
|
||||
assertTraces(1) {
|
||||
trace(0, 3) {
|
||||
basicSpan(it, 0, "parent", null)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, uri, 500)
|
||||
serverSpan(it, 2, span(1))
|
||||
}
|
||||
|
@ -649,7 +659,13 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
and:
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent", null, thrownException)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status ERROR
|
||||
errorEvent(thrownException.class, thrownException.message)
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, uri, null, thrownException)
|
||||
}
|
||||
}
|
||||
|
@ -687,7 +703,11 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
hasNoParent()
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, uri, null, thrownException)
|
||||
basicSpan(it, 2, "callback", span(0))
|
||||
span(2) {
|
||||
name "callback"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -710,7 +730,13 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
def thrownException = ex instanceof ExecutionException ? ex.cause : ex
|
||||
assertTraces(1) {
|
||||
trace(0, 2) {
|
||||
basicSpan(it, 0, "parent", null, thrownException)
|
||||
span(0) {
|
||||
name "parent"
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
status ERROR
|
||||
errorEvent(thrownException.class, thrownException.message)
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, uri, null, thrownException)
|
||||
}
|
||||
}
|
||||
|
@ -782,8 +808,13 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
//Traces can be in arbitrary order, let us find out the request id of the current one
|
||||
def requestId = Integer.parseInt(rootSpan.name.substring("Parent span ".length()))
|
||||
|
||||
basicSpan(it, 0, "Parent span " + requestId, null, null) {
|
||||
it."test.request.id" requestId
|
||||
span(0) {
|
||||
name "Parent span " + requestId
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"test.request.id" requestId
|
||||
}
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, url)
|
||||
serverSpan(it, 2, span(1)) {
|
||||
|
@ -831,14 +862,23 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
//Traces can be in arbitrary order, let us find out the request id of the current one
|
||||
def requestId = Integer.parseInt(rootSpan.name.substring("Parent span ".length()))
|
||||
|
||||
basicSpan(it, 0, "Parent span " + requestId, null, null) {
|
||||
it."test.request.id" requestId
|
||||
span(0) {
|
||||
name "Parent span " + requestId
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"test.request.id" requestId
|
||||
}
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, url)
|
||||
serverSpan(it, 2, span(1)) {
|
||||
it."test.request.id" requestId
|
||||
}
|
||||
basicSpan(it, 3, "child", span(0))
|
||||
span(3) {
|
||||
name "child"
|
||||
kind SpanKind.INTERNAL
|
||||
childOf span(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -881,8 +921,13 @@ abstract class HttpClientTest<REQUEST> extends InstrumentationSpecification {
|
|||
//Traces can be in arbitrary order, let us find out the request id of the current one
|
||||
def requestId = Integer.parseInt(rootSpan.name.substring("Parent span ".length()))
|
||||
|
||||
basicSpan(it, 0, "Parent span " + requestId, null, null) {
|
||||
it."test.request.id" requestId
|
||||
span(0) {
|
||||
name "Parent span " + requestId
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"test.request.id" requestId
|
||||
}
|
||||
}
|
||||
clientSpan(it, 1, span(0), method, url)
|
||||
serverSpan(it, 2, span(1)) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
|||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.REDIRECT
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.basicSpan
|
||||
import static io.opentelemetry.instrumentation.test.utils.TraceUtils.runUnderTrace
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
import static org.junit.Assume.assumeTrue
|
||||
|
@ -420,8 +419,13 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
//Traces can be in arbitrary order, let us find out the request id of the current one
|
||||
def requestId = Integer.parseInt(rootSpan.name.substring("client ".length()))
|
||||
|
||||
basicSpan(it, 0, "client " + requestId, null, null) {
|
||||
"${ServerEndpoint.ID_ATTRIBUTE_NAME}" requestId
|
||||
span(0) {
|
||||
name "client " + requestId
|
||||
kind SpanKind.INTERNAL
|
||||
hasNoParent()
|
||||
attributes {
|
||||
"${ServerEndpoint.ID_ATTRIBUTE_NAME}" requestId
|
||||
}
|
||||
}
|
||||
indexedServerSpan(it, span(0), requestId)
|
||||
|
||||
|
|
|
@ -5,22 +5,17 @@
|
|||
|
||||
package io.opentelemetry.instrumentation.test.utils
|
||||
|
||||
import groovy.transform.stc.ClosureParams
|
||||
import groovy.transform.stc.SimpleType
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry
|
||||
import io.opentelemetry.api.trace.Span
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.api.trace.Tracer
|
||||
import io.opentelemetry.extension.annotations.WithSpan
|
||||
import io.opentelemetry.instrumentation.test.asserts.AttributesAssert
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.server.ServerTraceUtils
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingRunnable
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.ExecutionException
|
||||
|
||||
// TODO: convert all usages of this class to the Java TraceUtils one
|
||||
class TraceUtils {
|
||||
|
||||
|
@ -69,47 +64,6 @@ class TraceUtils {
|
|||
r.call()
|
||||
}
|
||||
|
||||
static basicClientSpan(TraceAssert trace, int index, String operation, Object parentSpan = null, Throwable exception = null,
|
||||
@ClosureParams(value = SimpleType, options = ['io.opentelemetry.instrumentation.test.asserts.AttributesAssert'])
|
||||
@DelegatesTo(value = AttributesAssert, strategy = Closure.DELEGATE_FIRST) Closure additionAttributesAssert = null) {
|
||||
return basicSpanForKind(trace, index, SpanKind.CLIENT, operation, parentSpan, exception, additionAttributesAssert)
|
||||
}
|
||||
|
||||
static basicServerSpan(TraceAssert trace, int index, String operation, Object parentSpan = null, Throwable exception = null,
|
||||
@ClosureParams(value = SimpleType, options = ['io.opentelemetry.instrumentation.test.asserts.AttributesAssert'])
|
||||
@DelegatesTo(value = AttributesAssert, strategy = Closure.DELEGATE_FIRST) Closure additionAttributesAssert = null) {
|
||||
return basicSpanForKind(trace, index, SpanKind.SERVER, operation, parentSpan, exception, additionAttributesAssert)
|
||||
}
|
||||
|
||||
// TODO rename to basicInternalSpan
|
||||
static basicSpan(TraceAssert trace, int index, String operation, Object parentSpan = null, Throwable exception = null,
|
||||
@ClosureParams(value = SimpleType, options = ['io.opentelemetry.instrumentation.test.asserts.AttributesAssert'])
|
||||
@DelegatesTo(value = AttributesAssert, strategy = Closure.DELEGATE_FIRST) Closure additionAttributesAssert = null) {
|
||||
return basicSpanForKind(trace, index, SpanKind.INTERNAL, operation, parentSpan, exception, additionAttributesAssert)
|
||||
}
|
||||
|
||||
private static basicSpanForKind(TraceAssert trace, int index, SpanKind spanKind, String operation, Object parentSpan = null, Throwable exception = null,
|
||||
@ClosureParams(value = SimpleType, options = ['io.opentelemetry.instrumentation.test.asserts.AttributesAssert'])
|
||||
@DelegatesTo(value = AttributesAssert, strategy = Closure.DELEGATE_FIRST) Closure additionAttributesAssert = null) {
|
||||
trace.span(index) {
|
||||
if (parentSpan == null) {
|
||||
hasNoParent()
|
||||
} else {
|
||||
childOf((SpanData) parentSpan)
|
||||
}
|
||||
name operation
|
||||
kind spanKind
|
||||
if (exception) {
|
||||
status StatusCode.ERROR
|
||||
errorEvent(exception.class, exception.message)
|
||||
}
|
||||
|
||||
if (additionAttributesAssert != null) {
|
||||
attributes(additionAttributesAssert)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T> T runUnderTraceWithoutExceptionCatch(String spanName, Callable<T> r) {
|
||||
Span span = tracer.spanBuilder(spanName).setSpanKind(SpanKind.INTERNAL).startSpan()
|
||||
|
||||
|
|
Loading…
Reference in New Issue