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