Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayanesh committed Sep 21, 2023
2 parents 282da0d + 27fa00d commit 67e285b
Show file tree
Hide file tree
Showing 81 changed files with 2,493 additions and 1,629 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/markdown-link-check-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
},
{
"pattern": "^https://kotlinlang\\.org/docs/coroutines-overview\\.html$"
},
{
"pattern": "^http(s)?://logback\\.qos\\.ch"
}
]
}
5 changes: 5 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ jobs:
exit 1
fi
- name: Upload agent jar
uses: actions/upload-artifact@v3
with:
path: javaagent/build/libs/opentelemetry-javaagent-*-SNAPSHOT.jar

test:
name: test${{ matrix.test-partition }} (${{ matrix.test-java-version }}, ${{ matrix.vm }})
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion benchmark-overhead/Dockerfile-petclinic-base
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN git checkout 8aa4d49
RUN ./mvnw package -Dmaven.test.skip=true
RUN cp target/spring-petclinic-rest*.jar /app/spring-petclinic-rest.jar

FROM bellsoft/liberica-openjdk-alpine:20
FROM bellsoft/liberica-openjdk-alpine:21
COPY --from=app-build /app/spring-petclinic-rest.jar /app/spring-petclinic-rest.jar
WORKDIR /app
EXPOSE 9966
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ tasks {
inputs.property("instrumentation.name", name)
inputs.property("instrumentation.version", version)

val propertiesDir = File(project.buildDir, "generated/instrumentationVersion/META-INF/io/opentelemetry/instrumentation/")
val propertiesDir = layout.buildDirectory.dir("generated/instrumentationVersion/META-INF/io/opentelemetry/instrumentation/")
outputs.dir(propertiesDir)

doLast {
File(propertiesDir, "$name.properties").writeText("version=$version")
File(propertiesDir.get().asFile, "$name.properties").writeText("version=$version")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.opentelemetry.instrumentation.api.instrumenter.net.internal.InternalNetClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalServerAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.url.internal.UrlAttributes;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.instrumentation.api.internal.SpanKey;
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
Expand Down Expand Up @@ -109,7 +108,7 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST

String fullUrl = stripSensitiveData(getter.getUrlFull(request));
if (SemconvStability.emitStableHttpSemconv()) {
internalSet(attributes, UrlAttributes.URL_FULL, fullUrl);
internalSet(attributes, SemanticAttributes.URL_FULL, fullUrl);
}
if (SemconvStability.emitOldHttpSemconv()) {
internalSet(attributes, SemanticAttributes.HTTP_URL, fullUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.semconv.SemanticAttributes;
import java.util.HashSet;
Expand Down Expand Up @@ -53,10 +52,10 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST
String method = getter.getHttpRequestMethod(request);
if (SemconvStability.emitStableHttpSemconv()) {
if (method == null || knownMethods.contains(method)) {
internalSet(attributes, HttpAttributes.HTTP_REQUEST_METHOD, method);
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_METHOD, method);
} else {
internalSet(attributes, HttpAttributes.HTTP_REQUEST_METHOD, _OTHER);
internalSet(attributes, HttpAttributes.HTTP_REQUEST_METHOD_ORIGINAL, method);
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_METHOD, _OTHER);
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_METHOD_ORIGINAL, method);
}
}
if (SemconvStability.emitOldHttpSemconv()) {
Expand All @@ -83,7 +82,7 @@ public void onEnd(

Long requestBodySize = requestBodySize(request);
if (SemconvStability.emitStableHttpSemconv()) {
internalSet(attributes, HttpAttributes.HTTP_REQUEST_BODY_SIZE, requestBodySize);
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_BODY_SIZE, requestBodySize);
}
if (SemconvStability.emitOldHttpSemconv()) {
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, requestBodySize);
Expand All @@ -93,7 +92,7 @@ public void onEnd(
Integer statusCode = getter.getHttpResponseStatusCode(request, response, error);
if (statusCode != null && statusCode > 0) {
if (SemconvStability.emitStableHttpSemconv()) {
internalSet(attributes, HttpAttributes.HTTP_RESPONSE_STATUS_CODE, (long) statusCode);
internalSet(attributes, SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, (long) statusCode);
}
if (SemconvStability.emitOldHttpSemconv()) {
internalSet(attributes, SemanticAttributes.HTTP_STATUS_CODE, (long) statusCode);
Expand All @@ -102,7 +101,7 @@ public void onEnd(

Long responseBodySize = responseBodySize(request, response);
if (SemconvStability.emitStableHttpSemconv()) {
internalSet(attributes, HttpAttributes.HTTP_RESPONSE_BODY_SIZE, responseBodySize);
internalSet(attributes, SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, responseBodySize);
}
if (SemconvStability.emitOldHttpSemconv()) {
internalSet(attributes, SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, responseBodySize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.semconv.SemanticAttributes;
import javax.annotation.Nullable;
Expand All @@ -18,13 +17,13 @@ final class HttpMessageBodySizeUtil {
private static final AttributeKey<Long> HTTP_REQUEST_BODY_SIZE =
SemconvStability.emitOldHttpSemconv()
? SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH
: HttpAttributes.HTTP_REQUEST_BODY_SIZE;
: SemanticAttributes.HTTP_REQUEST_BODY_SIZE;

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
private static final AttributeKey<Long> HTTP_RESPONSE_BODY_SIZE =
SemconvStability.emitOldHttpSemconv()
? SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH
: HttpAttributes.HTTP_RESPONSE_BODY_SIZE;
: SemanticAttributes.HTTP_RESPONSE_BODY_SIZE;

@Nullable
static Long getHttpRequestBodySize(Attributes... attributesList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import io.opentelemetry.extension.incubator.metrics.ExtendedDoubleHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.NetworkAttributes;
import io.opentelemetry.instrumentation.api.instrumenter.url.internal.UrlAttributes;
import io.opentelemetry.semconv.SemanticAttributes;

final class HttpMetricsAdvice {
Expand All @@ -29,13 +26,13 @@ static void applyStableClientDurationAdvice(DoubleHistogramBuilder builder) {
advice ->
advice.setAttributes(
asList(
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
NetworkAttributes.SERVER_ADDRESS,
NetworkAttributes.SERVER_PORT,
NetworkAttributes.SERVER_SOCKET_ADDRESS)));
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.SERVER_ADDRESS,
SemanticAttributes.SERVER_PORT,
SemanticAttributes.SERVER_SOCKET_ADDRESS)));
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
Expand Down Expand Up @@ -68,13 +65,13 @@ static void applyClientRequestSizeAdvice(LongHistogramBuilder builder) {
advice.setAttributes(
asList(
// stable attributes
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
NetworkAttributes.SERVER_ADDRESS,
NetworkAttributes.SERVER_PORT,
NetworkAttributes.SERVER_SOCKET_ADDRESS,
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.SERVER_ADDRESS,
SemanticAttributes.SERVER_PORT,
SemanticAttributes.SERVER_SOCKET_ADDRESS,
// old attributes
SemanticAttributes.HTTP_METHOD,
SemanticAttributes.HTTP_STATUS_CODE,
Expand All @@ -95,11 +92,11 @@ static void applyStableServerDurationAdvice(DoubleHistogramBuilder builder) {
advice.setAttributes(
asList(
SemanticAttributes.HTTP_ROUTE,
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
UrlAttributes.URL_SCHEME)));
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.URL_SCHEME)));
}

@SuppressWarnings("deprecation") // until old http semconv are dropped in 2.0
Expand Down Expand Up @@ -134,11 +131,11 @@ static void applyServerRequestSizeAdvice(LongHistogramBuilder builder) {
asList(
// stable attributes
SemanticAttributes.HTTP_ROUTE,
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
UrlAttributes.URL_SCHEME,
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.URL_SCHEME,
// old attributes
SemanticAttributes.HTTP_SCHEME,
SemanticAttributes.HTTP_ROUTE,
Expand Down Expand Up @@ -166,8 +163,8 @@ static void applyServerActiveRequestsAdvice(LongUpDownCounterBuilder builder) {
SemanticAttributes.NET_HOST_NAME,
SemanticAttributes.NET_HOST_PORT,
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#metric-httpserveractive_requests
HttpAttributes.HTTP_REQUEST_METHOD,
UrlAttributes.URL_SCHEME)));
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.URL_SCHEME)));
}

private HttpMetricsAdvice() {}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void onStart(AttributesBuilder attributes, REQUEST request) {
AddressAndPort clientAddressAndPort = extractClientAddressAndPort(request);

if (emitStableUrlAttributes) {
internalSet(attributes, NetworkAttributes.CLIENT_ADDRESS, clientAddressAndPort.address);
internalSet(attributes, SemanticAttributes.CLIENT_ADDRESS, clientAddressAndPort.address);
if (clientAddressAndPort.port != null && clientAddressAndPort.port > 0) {
internalSet(attributes, NetworkAttributes.CLIENT_PORT, (long) clientAddressAndPort.port);
internalSet(attributes, SemanticAttributes.CLIENT_PORT, (long) clientAddressAndPort.port);
}
}
if (emitOldHttpAttributes) {
Expand All @@ -57,7 +57,7 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO

if (clientSocketAddress != null && !clientSocketAddress.equals(clientAddressAndPort.address)) {
if (emitStableUrlAttributes) {
internalSet(attributes, NetworkAttributes.CLIENT_SOCKET_ADDRESS, clientSocketAddress);
internalSet(attributes, SemanticAttributes.CLIENT_SOCKET_ADDRESS, clientSocketAddress);
}
if (emitOldHttpAttributes) {
internalSet(attributes, SemanticAttributes.NET_SOCK_PEER_ADDR, clientSocketAddress);
Expand All @@ -66,7 +66,7 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO
if (clientSocketPort != null && clientSocketPort > 0) {
if (emitStableUrlAttributes) {
if (!clientSocketPort.equals(clientAddressAndPort.port)) {
internalSet(attributes, NetworkAttributes.CLIENT_SOCKET_PORT, (long) clientSocketPort);
internalSet(attributes, SemanticAttributes.CLIENT_SOCKET_PORT, (long) clientSocketPort);
}
}
if (emitOldHttpAttributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO
String transport = lowercase(getter.getNetworkTransport(request, response));
if (networkTransportFilter.shouldAddNetworkTransport(
protocolName, protocolVersion, transport)) {
internalSet(attributes, NetworkAttributes.NETWORK_TRANSPORT, transport);
internalSet(attributes, SemanticAttributes.NETWORK_TRANSPORT, transport);
}
internalSet(
attributes,
NetworkAttributes.NETWORK_TYPE,
SemanticAttributes.NETWORK_TYPE,
lowercase(getter.getNetworkType(request, response)));
internalSet(attributes, NetworkAttributes.NETWORK_PROTOCOL_NAME, protocolName);
internalSet(attributes, NetworkAttributes.NETWORK_PROTOCOL_VERSION, protocolVersion);
internalSet(attributes, SemanticAttributes.NETWORK_PROTOCOL_NAME, protocolName);
internalSet(attributes, SemanticAttributes.NETWORK_PROTOCOL_VERSION, protocolVersion);
}
if (emitOldHttpAttributes) {
// net.transport and net.sock.family are not 1:1 convertible with network.transport and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void onStart(AttributesBuilder attributes, REQUEST request) {
AddressAndPort serverAddressAndPort = extractServerAddressAndPort(request);

if (emitStableUrlAttributes) {
internalSet(attributes, NetworkAttributes.SERVER_ADDRESS, serverAddressAndPort.address);
internalSet(attributes, SemanticAttributes.SERVER_ADDRESS, serverAddressAndPort.address);
}
if (emitOldHttpAttributes) {
internalSet(attributes, oldSemconvMode.address, serverAddressAndPort.address);
Expand All @@ -59,7 +59,7 @@ public void onStart(AttributesBuilder attributes, REQUEST request) {
&& serverAddressAndPort.port > 0
&& captureServerPortCondition.test(serverAddressAndPort.port, request)) {
if (emitStableUrlAttributes) {
internalSet(attributes, NetworkAttributes.SERVER_PORT, (long) serverAddressAndPort.port);
internalSet(attributes, SemanticAttributes.SERVER_PORT, (long) serverAddressAndPort.port);
}
if (emitOldHttpAttributes) {
internalSet(attributes, oldSemconvMode.port, (long) serverAddressAndPort.port);
Expand All @@ -73,7 +73,7 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO
String serverSocketAddress = getter.getServerSocketAddress(request, response);
if (serverSocketAddress != null && !serverSocketAddress.equals(serverAddressAndPort.address)) {
if (emitStableUrlAttributes && captureServerSocketAttributes) {
internalSet(attributes, NetworkAttributes.SERVER_SOCKET_ADDRESS, serverSocketAddress);
internalSet(attributes, SemanticAttributes.SERVER_SOCKET_ADDRESS, serverSocketAddress);
}
if (emitOldHttpAttributes) {
internalSet(attributes, oldSemconvMode.socketAddress, serverSocketAddress);
Expand All @@ -85,7 +85,7 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO
&& serverSocketPort > 0
&& !serverSocketPort.equals(serverAddressAndPort.port)) {
if (emitStableUrlAttributes && captureServerSocketAttributes) {
internalSet(attributes, NetworkAttributes.SERVER_SOCKET_PORT, (long) serverSocketPort);
internalSet(attributes, SemanticAttributes.SERVER_SOCKET_PORT, (long) serverSocketPort);
}
if (emitOldHttpAttributes) {
internalSet(attributes, oldSemconvMode.socketPort, (long) serverSocketPort);
Expand All @@ -95,7 +95,7 @@ public void onEnd(AttributesBuilder attributes, REQUEST request, @Nullable RESPO
String serverSocketDomain = getter.getServerSocketDomain(request, response);
if (serverSocketDomain != null && !serverSocketDomain.equals(serverAddressAndPort.address)) {
if (emitStableUrlAttributes && captureServerSocketAttributes) {
internalSet(attributes, NetworkAttributes.SERVER_SOCKET_DOMAIN, serverSocketDomain);
internalSet(attributes, SemanticAttributes.SERVER_SOCKET_DOMAIN, serverSocketDomain);
}
if (emitOldHttpAttributes && oldSemconvMode.socketDomain != null) {
internalSet(attributes, oldSemconvMode.socketDomain, serverSocketDomain);
Expand Down
Loading

0 comments on commit 67e285b

Please sign in to comment.