Collect more attributes from servlet instrumenter (#4356)
* Collect more attributes from servlet instrumenter * spotless
This commit is contained in:
parent
8d73403188
commit
b06c1f9018
|
@ -5,6 +5,8 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.apachecamel
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.RetryOnAddressAlreadyInUseTrait
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
|
@ -96,6 +98,8 @@ class RestCamelTest extends AgentInstrumentationSpecification implements RetryOn
|
|||
"$SemanticAttributes.HTTP_METHOD.key" "GET"
|
||||
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
|
||||
"$SemanticAttributes.NET_PEER_PORT.key" Long
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
it.span(3) {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.apachecamel
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.RetryOnAddressAlreadyInUseTrait
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
|
@ -131,6 +133,9 @@ class TwoServicesWithDirectClientCamelTest extends AgentInstrumentationSpecifica
|
|||
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
|
||||
"$SemanticAttributes.HTTP_USER_AGENT.key" "Jakarta Commons-HttpClient/3.1"
|
||||
"$SemanticAttributes.HTTP_FLAVOR.key" "1.1"
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" Long
|
||||
}
|
||||
}
|
||||
it.span(5) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import io.dropwizard.Application
|
|||
import io.dropwizard.Configuration
|
||||
import io.dropwizard.setup.Bootstrap
|
||||
import io.dropwizard.setup.Environment
|
||||
|
||||
import javax.ws.rs.GET
|
||||
import javax.ws.rs.HeaderParam
|
||||
import javax.ws.rs.Path
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.dropwizard.setup.Bootstrap
|
|||
import io.dropwizard.setup.Environment
|
||||
import io.dropwizard.testing.ConfigOverride
|
||||
import io.dropwizard.testing.DropwizardTestSupport
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
|
@ -25,7 +26,6 @@ import javax.ws.rs.QueryParam
|
|||
import javax.ws.rs.core.Response
|
||||
|
||||
import static io.opentelemetry.api.trace.SpanKind.INTERNAL
|
||||
import static io.opentelemetry.api.trace.SpanKind.SERVER
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.CAPTURE_HEADERS
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.ERROR
|
||||
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.EXCEPTION
|
||||
|
@ -61,6 +61,21 @@ class DropwizardTest extends HttpServerTest<DropwizardTestSupport> implements Ag
|
|||
testSupport.after()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
// this override is needed because dropwizard reports peer ip as the client ip
|
||||
@Override
|
||||
String peerIp(ServerEndpoint endpoint) {
|
||||
TEST_CLIENT_IP
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasHandlerSpan(ServerEndpoint endpoint) {
|
||||
endpoint != NOT_FOUND
|
||||
|
@ -96,41 +111,6 @@ class DropwizardTest extends HttpServerTest<DropwizardTestSupport> implements Ag
|
|||
}
|
||||
}
|
||||
|
||||
// this override is needed because dropwizard reports peer ip as the client ip
|
||||
@Override
|
||||
void serverSpan(TraceAssert trace, int index, String traceID = null, String parentID = null, String method = "GET", Long responseContentLength = null, ServerEndpoint endpoint = SUCCESS) {
|
||||
trace.span(index) {
|
||||
name expectedServerSpanName(endpoint)
|
||||
kind SERVER
|
||||
if (endpoint.errored) {
|
||||
status StatusCode.ERROR
|
||||
}
|
||||
if (parentID != null) {
|
||||
traceId traceID
|
||||
parentSpanId parentID
|
||||
} else {
|
||||
hasNoParent()
|
||||
}
|
||||
attributes {
|
||||
// dropwizard reports peer ip as the client ip
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" TEST_CLIENT_IP
|
||||
"${SemanticAttributes.NET_PEER_PORT.key}" Long
|
||||
"${SemanticAttributes.HTTP_SCHEME.key}" "http"
|
||||
"${SemanticAttributes.HTTP_HOST}" "localhost:${port}"
|
||||
"${SemanticAttributes.HTTP_TARGET}" endpoint.resolvePath(address).getPath() + "${endpoint == QUERY_PARAM ? "?${endpoint.body}" : ""}"
|
||||
"${SemanticAttributes.HTTP_METHOD.key}" method
|
||||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" endpoint.status
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" TEST_USER_AGENT
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" TEST_CLIENT_IP
|
||||
if (endpoint == ServerEndpoint.CAPTURE_HEADERS) {
|
||||
"http.request.header.x_test_request" { it == ["test"] }
|
||||
"http.response.header.x_test_response" { it == ["test"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class TestApp extends Application<Configuration> {
|
||||
@Override
|
||||
void initialize(Bootstrap<Configuration> bootstrap) {
|
||||
|
|
|
@ -8,11 +8,13 @@ package test
|
|||
import grails.boot.GrailsApp
|
||||
import grails.boot.config.GrailsAutoConfiguration
|
||||
import groovy.transform.CompileStatic
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties
|
||||
import org.springframework.context.ConfigurableApplicationContext
|
||||
|
@ -53,6 +55,15 @@ class GrailsTest extends HttpServerTest<ConfigurableApplicationContext> implemen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
String expectedServerSpanName(ServerEndpoint endpoint) {
|
||||
if (endpoint == PATH_PARAM) {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
|
@ -187,6 +190,14 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> implements Agent
|
|||
"failing" | "throw" | 500 | { it == "failure" } | true | "failure"
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasHandlerSpan(ServerEndpoint endpoint) {
|
||||
true
|
||||
|
@ -281,6 +292,9 @@ abstract class JaxRsHttpServerTest<S> extends HttpServerTest<S> implements Agent
|
|||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" TEST_USER_AGENT
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" TEST_CLIENT_IP
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
"${SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
if (fullUrl.getPath().endsWith(ServerEndpoint.CAPTURE_HEADERS.getPath())) {
|
||||
"http.request.header.x_test_request" { it == ["test"] }
|
||||
"http.response.header.x_test_response" { it == ["test"] }
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import jakarta.servlet.DispatcherType
|
||||
import jakarta.servlet.ServletException
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
|
@ -60,6 +62,14 @@ class JettyHandlerTest extends HttpServerTest<Server> implements AgentTestTrait
|
|||
server.stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.eclipse.jetty.server.Request
|
||||
import org.eclipse.jetty.server.Response
|
||||
import org.eclipse.jetty.server.Server
|
||||
|
@ -61,6 +63,14 @@ class JettyHandlerTest extends HttpServerTest<Server> implements AgentTestTrait
|
|||
server.stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
@ -96,6 +98,9 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -148,6 +153,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -196,6 +203,9 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" Long
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -253,6 +263,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 500
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -315,6 +327,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -358,6 +372,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -433,6 +449,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 500
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -477,6 +495,8 @@ class JspInstrumentationBasicTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
@ -93,6 +95,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -157,6 +161,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -200,6 +206,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -291,6 +299,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -368,6 +378,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 500
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
@ -424,6 +436,8 @@ class JspInstrumentationForwardTests extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 404
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
span(1) {
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.eclipse.jetty.server.Server
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler
|
||||
|
@ -67,6 +69,14 @@ class JettyServlet2Test extends HttpServerTest<Server> implements AgentTestTrait
|
|||
return new URI("http://localhost:$port/$CONTEXT/")
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testNotFound() {
|
||||
false
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest
|
||||
|
||||
import javax.servlet.Servlet
|
||||
|
@ -56,6 +58,14 @@ abstract class AbstractServlet3Test<SERVER, CONTEXT> extends HttpServerTest<SERV
|
|||
super.request(uri, method)
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
boolean errorEndpointUsesSendError() {
|
||||
true
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse
|
||||
import org.apache.catalina.AccessLog
|
||||
import org.apache.catalina.Context
|
||||
|
@ -37,6 +39,16 @@ import static org.junit.Assume.assumeTrue
|
|||
@Unroll
|
||||
abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Context> {
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
Class<?> expectedExceptionClass() {
|
||||
ServletException
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest
|
||||
import jakarta.servlet.Servlet
|
||||
|
||||
|
@ -59,6 +61,14 @@ abstract class AbstractServlet5Test<SERVER, CONTEXT> extends HttpServerTest<SERV
|
|||
true
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || (endpoint == ERROR && errorEndpointUsesSendError())
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse
|
||||
import jakarta.servlet.Servlet
|
||||
import jakarta.servlet.ServletException
|
||||
|
@ -37,6 +39,15 @@ import static org.junit.Assume.assumeTrue
|
|||
@Unroll
|
||||
abstract class TomcatServlet5Test extends AbstractServlet5Test<Tomcat, Context> {
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
Class<?> expectedExceptionClass() {
|
||||
ServletException
|
||||
|
|
|
@ -49,12 +49,10 @@ public class ServletHttpAttributesExtractor<REQUEST, RESPONSE>
|
|||
protected @Nullable Long requestContentLength(
|
||||
ServletRequestContext<REQUEST> requestContext,
|
||||
@Nullable ServletResponseContext<RESPONSE> responseContext) {
|
||||
/*
|
||||
int contentLength = accessor.getRequestContentLength(requestContext.request());
|
||||
if (contentLength > -1) {
|
||||
return (long) contentLength;
|
||||
}
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -98,8 +96,7 @@ public class ServletHttpAttributesExtractor<REQUEST, RESPONSE>
|
|||
protected @Nullable Long responseContentLength(
|
||||
ServletRequestContext<REQUEST> requestContext,
|
||||
ServletResponseContext<RESPONSE> responseContext) {
|
||||
/*
|
||||
String contentLength = servletAccessor.getResponseHeader(responseContext.response(), "Content-Length");
|
||||
String contentLength = accessor.getResponseHeader(responseContext.response(), "Content-Length");
|
||||
if (contentLength != null) {
|
||||
try {
|
||||
return Long.valueOf(contentLength);
|
||||
|
@ -107,7 +104,6 @@ public class ServletHttpAttributesExtractor<REQUEST, RESPONSE>
|
|||
// ignore
|
||||
}
|
||||
}
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -135,7 +131,6 @@ public class ServletHttpAttributesExtractor<REQUEST, RESPONSE>
|
|||
protected @Nullable String serverName(
|
||||
ServletRequestContext<REQUEST> requestContext,
|
||||
@Nullable ServletResponseContext<RESPONSE> responseContext) {
|
||||
// return servletAccessor.getRequestServerName(requestContext.request());
|
||||
return null;
|
||||
return accessor.getRequestServerName(requestContext.request());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.instrumentation.servlet;
|
|||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor;
|
||||
import io.opentelemetry.instrumentation.servlet.ServletAccessor;
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class ServletNetAttributesExtractor<REQUEST, RESPONSE>
|
||||
|
@ -20,14 +21,12 @@ public class ServletNetAttributesExtractor<REQUEST, RESPONSE>
|
|||
|
||||
@Override
|
||||
public @Nullable String transport(ServletRequestContext<REQUEST> requestContext) {
|
||||
// return SemanticAttributes.NetTransportValues.IP_TCP;
|
||||
return null;
|
||||
return SemanticAttributes.NetTransportValues.IP_TCP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String peerName(ServletRequestContext<REQUEST> requestContext) {
|
||||
// return accessor.getRequestRemoteHost(requestContext.request());
|
||||
return null;
|
||||
return accessor.getRequestRemoteHost(requestContext.request());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NetTransportValues.IP_TCP
|
||||
|
||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
|
@ -55,6 +57,8 @@ class SparkJavaBasedTest extends AgentInstrumentationSpecification {
|
|||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
"${SemanticAttributes.HTTP_FLAVOR.key}" "1.1"
|
||||
"${SemanticAttributes.HTTP_USER_AGENT.key}" String
|
||||
"${SemanticAttributes.HTTP_SERVER_NAME}" String
|
||||
"${SemanticAttributes.NET_TRANSPORT}" IP_TCP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
package test.boot
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest
|
||||
import io.opentelemetry.testing.internal.armeria.common.HttpData
|
||||
import io.opentelemetry.testing.internal.armeria.common.MediaType
|
||||
|
@ -51,6 +53,15 @@ class SpringBootBasedTest extends HttpServerTest<ConfigurableApplicationContext>
|
|||
return "/xyz"
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasHandlerSpan(ServerEndpoint endpoint) {
|
||||
true
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
|
||||
package test.filter
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.sdk.trace.data.SpanData
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.context.ConfigurableApplicationContext
|
||||
import test.boot.SecurityConfig
|
||||
|
@ -36,6 +38,15 @@ class ServletFilterTest extends HttpServerTest<ConfigurableApplicationContext> i
|
|||
ctx.close()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasHandlerSpan(ServerEndpoint endpoint) {
|
||||
endpoint == NOT_FOUND
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.api.trace.SpanKind
|
||||
import io.opentelemetry.api.trace.StatusCode
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
|
@ -28,6 +29,14 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
|
|||
|
||||
class Struts2ActionSpanTest extends HttpServerTest<Server> implements AgentTestTrait {
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testPathParam() {
|
||||
return true
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v10_0
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import jakarta.servlet.Servlet
|
||||
import jakarta.servlet.ServletException
|
||||
import org.apache.catalina.Context
|
||||
|
@ -97,6 +99,15 @@ class TomcatAsyncTest extends HttpServerTest<Tomcat> implements AgentTestTrait {
|
|||
AsyncServlet
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testException() {
|
||||
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v10_0
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.apache.catalina.Context
|
||||
import org.apache.catalina.connector.Request
|
||||
import org.apache.catalina.connector.Response
|
||||
|
@ -71,6 +73,15 @@ class TomcatHandlerTest extends HttpServerTest<Tomcat> implements AgentTestTrait
|
|||
tomcat.getServer().stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v7_0
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.apache.catalina.Context
|
||||
import org.apache.catalina.startup.Tomcat
|
||||
import org.apache.tomcat.JarScanFilter
|
||||
|
@ -97,6 +99,15 @@ class TomcatAsyncTest extends HttpServerTest<Tomcat> implements AgentTestTrait {
|
|||
AsyncServlet
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean testException() {
|
||||
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/807
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v7_0
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey
|
||||
import io.opentelemetry.instrumentation.test.AgentTestTrait
|
||||
import io.opentelemetry.instrumentation.test.asserts.TraceAssert
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||
import org.apache.catalina.Context
|
||||
import org.apache.catalina.connector.Request
|
||||
import org.apache.catalina.connector.Response
|
||||
|
@ -71,6 +73,15 @@ class TomcatHandlerTest extends HttpServerTest<Tomcat> implements AgentTestTrait
|
|||
tomcat.getServer().stop()
|
||||
}
|
||||
|
||||
@Override
|
||||
List<AttributeKey<?>> extraAttributes() {
|
||||
[
|
||||
SemanticAttributes.HTTP_SERVER_NAME,
|
||||
SemanticAttributes.NET_PEER_NAME,
|
||||
SemanticAttributes.NET_TRANSPORT
|
||||
]
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND
|
||||
|
|
|
@ -44,11 +44,8 @@ public class TomcatHttpAttributesExtractor
|
|||
|
||||
@Override
|
||||
protected @Nullable Long requestContentLength(Request request, @Nullable Response response) {
|
||||
/*
|
||||
long contentLength = request.getContentLengthLong();
|
||||
return contentLength != -1 ? contentLength : null;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,11 +73,8 @@ public class TomcatHttpAttributesExtractor
|
|||
|
||||
@Override
|
||||
protected @Nullable Long responseContentLength(Request request, Response response) {
|
||||
/*
|
||||
long contentLength = response.getContentLengthLong();
|
||||
return contentLength != -1 ? contentLength : null;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,7 +94,6 @@ public class TomcatHttpAttributesExtractor
|
|||
|
||||
@Override
|
||||
protected @Nullable String serverName(Request request, @Nullable Response response) {
|
||||
// return request.serverName().toString();
|
||||
return null;
|
||||
return request.serverName().toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.tomcat.common;
|
||||
|
||||
import io.opentelemetry.instrumentation.api.instrumenter.net.NetServerAttributesExtractor;
|
||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
|
||||
import org.apache.coyote.ActionCode;
|
||||
import org.apache.coyote.Request;
|
||||
import org.apache.coyote.Response;
|
||||
|
@ -15,17 +16,13 @@ public class TomcatNetAttributesExtractor extends NetServerAttributesExtractor<R
|
|||
|
||||
@Override
|
||||
public @Nullable String transport(Request request) {
|
||||
// return SemanticAttributes.NetTransportValues.IP_TCP;
|
||||
return null;
|
||||
return SemanticAttributes.NetTransportValues.IP_TCP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String peerName(Request request) {
|
||||
/*
|
||||
request.action(ActionCode.REQ_HOST_ATTRIBUTE, request);
|
||||
return request.remoteHost().toString();
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,6 +95,10 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
false
|
||||
}
|
||||
|
||||
String peerIp(ServerEndpoint endpoint) {
|
||||
"127.0.0.1"
|
||||
}
|
||||
|
||||
boolean testNotFound() {
|
||||
true
|
||||
}
|
||||
|
@ -602,7 +606,7 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
}
|
||||
attributes {
|
||||
"${SemanticAttributes.NET_PEER_PORT.key}" { it == null || it instanceof Long }
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" { it == null || it == "127.0.0.1" } // Optional
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" { it == null || it == peerIp(endpoint) } // Optional
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" { it == null || it == TEST_CLIENT_IP }
|
||||
"${SemanticAttributes.HTTP_METHOD.key}" method
|
||||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" endpoint.status
|
||||
|
@ -620,9 +624,13 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH)) {
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" Long
|
||||
} else {
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
}
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH)) {
|
||||
"${SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH}" Long
|
||||
} else {
|
||||
"${SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
}
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_ROUTE)) {
|
||||
// TODO(anuraaga): Revisit this when applying instrumenters to more libraries, Armeria
|
||||
|
@ -656,7 +664,7 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
childOf((SpanData) parent)
|
||||
attributes {
|
||||
"${SemanticAttributes.NET_PEER_PORT.key}" { it == null || it instanceof Long }
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" { it == null || it == "127.0.0.1" } // Optional
|
||||
"${SemanticAttributes.NET_PEER_IP.key}" { it == null || it == peerIp(endpoint) } // Optional
|
||||
"${SemanticAttributes.HTTP_CLIENT_IP.key}" { it == null || it == TEST_CLIENT_IP }
|
||||
"${SemanticAttributes.HTTP_METHOD.key}" "GET"
|
||||
"${SemanticAttributes.HTTP_STATUS_CODE.key}" 200
|
||||
|
@ -674,9 +682,13 @@ abstract class HttpServerTest<SERVER> extends InstrumentationSpecification imple
|
|||
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH)) {
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" Long
|
||||
} else {
|
||||
"${SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
}
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH)) {
|
||||
"${SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH}" Long
|
||||
} else {
|
||||
"${SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH}" { it == null || it instanceof Long } // Optional
|
||||
}
|
||||
if (extraAttributes.contains(SemanticAttributes.HTTP_ROUTE)) {
|
||||
// TODO(anuraaga): Revisit this when applying instrumenters to more libraries, Armeria
|
||||
|
|
Loading…
Reference in New Issue