Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semconv 1.25.0 migration #10983

Merged
merged 53 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1b46cf5
fix(deps): update dependency io.opentelemetry.semconv:opentelemetry-s…
renovate[bot] Mar 27, 2024
f2d90cf
add semconv migration artifact
SylvainJuge Mar 29, 2024
a02d25f
remove internal NetworkAttributes
SylvainJuge Apr 2, 2024
21b35c0
wip
SylvainJuge Apr 2, 2024
db40736
URL_*
SylvainJuge Apr 2, 2024
04a5d10
NETWORK_*
SylvainJuge Apr 2, 2024
b64932d
HTTP_*
SylvainJuge Apr 2, 2024
89e3807
ERROR_* and USER_AGENT_*
SylvainJuge Apr 2, 2024
1d09eaf
CLIENT_*
SylvainJuge Apr 2, 2024
beaff4f
SERVER_*
SylvainJuge Apr 2, 2024
d9f4949
DB_CASSANDRA_*
SylvainJuge Apr 2, 2024
d191a08
DB_*
SylvainJuge Apr 2, 2024
af3bb62
DB type
SylvainJuge Apr 2, 2024
dac9c23
RPC_*
SylvainJuge Apr 2, 2024
94f2a1e
fix incubating imports
SylvainJuge Apr 2, 2024
03f5ccb
CODE_*
SylvainJuge Apr 2, 2024
3477e31
PEER_*
SylvainJuge Apr 2, 2024
2f13237
MESSAGE_*
SylvainJuge Apr 2, 2024
f206f7a
THREAD_*
SylvainJuge Apr 2, 2024
afe5203
EXCEPTION_*
SylvainJuge Apr 3, 2024
bb005b0
remove duplication in groovy imports
SylvainJuge Apr 3, 2024
8aa4120
FAAW_*
SylvainJuge Apr 3, 2024
7c371f6
ENDUSER_*
SylvainJuge Apr 3, 2024
2dee576
messaging rocketmq
SylvainJuge Apr 3, 2024
3d013dd
remove messaging.destination
SylvainJuge Apr 3, 2024
3504520
reformat
SylvainJuge Apr 3, 2024
1d9649f
inline SemanticAttributes.EXCEPTION_EVENT_NAME
SylvainJuge Apr 3, 2024
e8c62e3
remove SemanticAttributes
SylvainJuge Apr 3, 2024
31157c9
remove unused stuff in ResourceAttributes
SylvainJuge Apr 3, 2024
aa44403
CLOUD_*
SylvainJuge Apr 3, 2024
d3a58ce
SERVICE_*
SylvainJuge Apr 3, 2024
272d400
OS_*
SylvainJuge Apr 3, 2024
c901688
PROCESS_*
SylvainJuge Apr 3, 2024
e15d5fe
HOST_*
SylvainJuge Apr 3, 2024
3bd5d48
SCHEMA_URL
SylvainJuge Apr 3, 2024
9cffdf1
fix remaining ResourceAttributes references
SylvainJuge Apr 3, 2024
9f71888
remove ResourceAttributes
SylvainJuge Apr 3, 2024
650de3f
remove semconv-migration module
SylvainJuge Apr 3, 2024
c549087
fix few things and javadoc
SylvainJuge Apr 3, 2024
4e04f66
make spotless happy
SylvainJuge Apr 3, 2024
5479fae
fix compilation errors
SylvainJuge Apr 3, 2024
435d3ae
remapping url connection update for extensions
SylvainJuge Apr 3, 2024
bcf1bb8
spotless again
SylvainJuge Apr 3, 2024
ed2a797
fix groovy import
SylvainJuge Apr 3, 2024
f19af82
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Apr 9, 2024
3cda45d
bump to semconv 1.25.0
SylvainJuge Apr 9, 2024
969c239
deprecation of db.connection_string
SylvainJuge Apr 9, 2024
7984016
stable service attributes
SylvainJuge Apr 9, 2024
8373832
deprecation of messaging.kafka.destination.partition
SylvainJuge Apr 9, 2024
6839613
stable exception attributes
SylvainJuge Apr 9, 2024
41697cb
revert changes in scala test
SylvainJuge Apr 9, 2024
68ff1bc
fix kafka spring test
SylvainJuge Apr 9, 2024
6365bf0
fix formatting
SylvainJuge Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tasks.withType<ShadowJar>().configureEach {
// relocate(OpenTelemetry API) since these classes live in the bootstrap class loader
relocate("io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api")
relocate("io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv")
relocate("io.opentelemetry.semconv.incubating", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv.incubating")
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
relocate("io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context")
relocate("io.opentelemetry.extension.incubator", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.incubator")
}
Expand Down
4 changes: 3 additions & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ val asmVersion = "9.7"
val jmhVersion = "1.37"
val mockitoVersion = "4.11.0"
val slf4jVersion = "2.0.12"
val semConvVersion = "1.24.0-alpha"

val CORE_DEPENDENCIES = listOf(
"io.opentelemetry.semconv:opentelemetry-semconv:1.23.1-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv:${semConvVersion}",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:${semConvVersion}",
"com.google.auto.service:auto-service:${autoServiceVersion}",
"com.google.auto.service:auto-service-annotations:${autoServiceVersion}",
"com.google.auto.value:auto-value:${autoValueVersion}",
Expand Down
1 change: 1 addition & 0 deletions examples/distro/gradle/shadow.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ext.relocatePackages = { shadowJar ->
// relocate(OpenTelemetry API) since these classes live in the bootstrap class loader
shadowJar.relocate("io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api")
shadowJar.relocate("io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv")
shadowJar.relocate("io.opentelemetry.semconv.incubating", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv.incubating")
shadowJar.relocate("io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context")
shadowJar.relocate("io.opentelemetry.extension.incubator", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.incubator")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.SemanticAttributes.CODE_FUNCTION;
import static io.opentelemetry.semconv.SemanticAttributes.CODE_NAMESPACE;
import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_FUNCTION;
import static io.opentelemetry.semconv.incubating.CodeIncubatingAttributes.CODE_NAMESPACE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;

Expand Down
1 change: 1 addition & 0 deletions instrumentation-annotations-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {

api("io.opentelemetry:opentelemetry-api")
api("io.opentelemetry.semconv:opentelemetry-semconv")
api("io.opentelemetry.semconv:opentelemetry-semconv-incubating")

compileOnly("com.google.auto.value:auto-value-annotations")
annotationProcessor("com.google.auto.value:auto-value")
Expand Down
1 change: 1 addition & 0 deletions instrumentation-api-incubator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ group = "io.opentelemetry.instrumentation"

dependencies {
api("io.opentelemetry.semconv:opentelemetry-semconv")
api("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
api(project(":instrumentation-api"))
implementation("io.opentelemetry:opentelemetry-extension-incubator")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.CodeIncubatingAttributes;
import javax.annotation.Nullable;

/**
Expand All @@ -37,9 +37,9 @@ private CodeAttributesExtractor(CodeAttributesGetter<REQUEST> getter) {
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
Class<?> cls = getter.getCodeClass(request);
if (cls != null) {
internalSet(attributes, SemanticAttributes.CODE_NAMESPACE, cls.getName());
internalSet(attributes, CodeIncubatingAttributes.CODE_NAMESPACE, cls.getName());
}
internalSet(attributes, SemanticAttributes.CODE_FUNCTION, getter.getMethodName(request));
internalSet(attributes, CodeIncubatingAttributes.CODE_FUNCTION, getter.getMethodName(request));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;

/**
* Extractor of <a
Expand Down Expand Up @@ -38,7 +38,7 @@ public static <REQUEST, RESPONSE> AttributesExtractor<REQUEST, RESPONSE> create(
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
super.onStart(attributes, parentContext, request);

internalSet(attributes, SemanticAttributes.DB_STATEMENT, getter.getStatement(request));
internalSet(attributes, SemanticAttributes.DB_OPERATION, getter.getOperation(request));
internalSet(attributes, DbIncubatingAttributes.DB_STATEMENT, getter.getStatement(request));
internalSet(attributes, DbIncubatingAttributes.DB_OPERATION, getter.getOperation(request));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.internal.SpanKey;
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;
import javax.annotation.Nullable;

abstract class DbClientCommonAttributesExtractor<
Expand All @@ -27,11 +27,13 @@ abstract class DbClientCommonAttributesExtractor<

@Override
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
internalSet(attributes, SemanticAttributes.DB_SYSTEM, getter.getSystem(request));
internalSet(attributes, SemanticAttributes.DB_USER, getter.getUser(request));
internalSet(attributes, SemanticAttributes.DB_NAME, getter.getName(request));
internalSet(attributes, DbIncubatingAttributes.DB_SYSTEM, getter.getSystem(request));
internalSet(attributes, DbIncubatingAttributes.DB_USER, getter.getUser(request));
internalSet(attributes, DbIncubatingAttributes.DB_NAME, getter.getName(request));
internalSet(
attributes, SemanticAttributes.DB_CONNECTION_STRING, getter.getConnectionString(request));
attributes,
DbIncubatingAttributes.DB_CONNECTION_STRING,
getter.getConnectionString(request));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;

/**
* Extractor of <a
* href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md">database
* attributes</a>. This class is designed with SQL (or SQL-like) database clients in mind.
*
* <p>It sets the same set of attributes as {@link DbClientAttributesExtractor} plus an additional
* <code>{@linkplain SemanticAttributes#DB_SQL_TABLE db.sql.table}</code> attribute. The raw SQL
* statements returned by the {@link SqlClientAttributesGetter#getRawStatement(Object)} method are
* sanitized before use, all statement parameters are removed.
* <code>{@link DbIncubatingAttributes#DB_SQL_TABLE}</code> attribute. The raw SQL statements
* returned by the {@link SqlClientAttributesGetter#getRawStatement(Object)} method are sanitized
* before use, all statement parameters are removed.
*/
public final class SqlClientAttributesExtractor<REQUEST, RESPONSE>
extends DbClientCommonAttributesExtractor<
Expand Down Expand Up @@ -62,8 +62,9 @@ public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST

SqlStatementInfo sanitizedStatement = sanitizer.sanitize(getter.getRawStatement(request));
String operation = sanitizedStatement.getOperation();
internalSet(attributes, SemanticAttributes.DB_STATEMENT, sanitizedStatement.getFullStatement());
internalSet(attributes, SemanticAttributes.DB_OPERATION, operation);
internalSet(
attributes, DbIncubatingAttributes.DB_STATEMENT, sanitizedStatement.getFullStatement());
internalSet(attributes, DbIncubatingAttributes.DB_OPERATION, operation);
if (!SQL_CALL.equals(operation)) {
internalSet(attributes, dbTableAttribute, sanitizedStatement.getMainIdentifier());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;

/** A builder of {@link SqlClientAttributesExtractor}. */
public final class SqlClientAttributesExtractorBuilder<REQUEST, RESPONSE> {

final SqlClientAttributesGetter<REQUEST> getter;
AttributeKey<String> dbTableAttribute = SemanticAttributes.DB_SQL_TABLE;
AttributeKey<String> dbTableAttribute = DbIncubatingAttributes.DB_SQL_TABLE;
boolean statementSanitizationEnabled = true;

SqlClientAttributesExtractorBuilder(SqlClientAttributesGetter<REQUEST> getter) {
Expand All @@ -26,7 +26,7 @@ public final class SqlClientAttributesExtractorBuilder<REQUEST, RESPONSE> {
/**
* Configures the extractor to set the table value extracted by the {@link
* SqlClientAttributesExtractor} under the {@code dbTableAttribute} key. By default, the <code>
* {@linkplain SemanticAttributes#DB_SQL_TABLE db.sql.table}</code> attribute is used.
* {@link DbIncubatingAttributes#DB_SQL_TABLE}</code> attribute is used.
*
* @param dbTableAttribute The {@link AttributeKey} under which the table extracted by the {@link
* SqlClientAttributesExtractor} will be stored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.instrumentation.api.incubator.semconv.net.internal.UrlParser;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.PeerIncubatingAttributes;
import java.util.function.Supplier;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -67,7 +67,7 @@ public void onEnd(
Supplier<String> pathSupplier = () -> getUrlPath(attributesGetter, request);
String peerService = mapToPeerService(serverAddress, serverPort, pathSupplier);
if (peerService != null) {
attributes.put(SemanticAttributes.PEER_SERVICE, peerService);
attributes.put(PeerIncubatingAttributes.PEER_SERVICE, peerService);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter;
import io.opentelemetry.instrumentation.api.semconv.http.HttpCommonAttributesGetter;
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes;
import java.util.List;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -49,11 +49,11 @@ public void onEnd(
@Nullable Throwable error) {

Long requestBodySize = requestBodySize(request);
internalSet(attributes, SemanticAttributes.HTTP_REQUEST_BODY_SIZE, requestBodySize);
internalSet(attributes, HttpIncubatingAttributes.HTTP_REQUEST_BODY_SIZE, requestBodySize);

if (response != null) {
Long responseBodySize = responseBodySize(request, response);
internalSet(attributes, SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, responseBodySize);
internalSet(attributes, HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE, responseBodySize);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import io.opentelemetry.api.metrics.LongUpDownCounterBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongHistogramBuilder;
import io.opentelemetry.extension.incubator.metrics.ExtendedLongUpDownCounterBuilder;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.ErrorAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.NetworkAttributes;
import io.opentelemetry.semconv.ServerAttributes;
import io.opentelemetry.semconv.UrlAttributes;

final class HttpExperimentalMetricsAdvice {

Expand All @@ -22,13 +26,13 @@ static void applyClientRequestSizeAdvice(LongHistogramBuilder builder) {
((ExtendedLongHistogramBuilder) builder)
.setAttributesAdvice(
asList(
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.ERROR_TYPE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.SERVER_ADDRESS,
SemanticAttributes.SERVER_PORT));
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
ErrorAttributes.ERROR_TYPE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
ServerAttributes.SERVER_ADDRESS,
ServerAttributes.SERVER_PORT));
}

static void applyServerRequestSizeAdvice(LongHistogramBuilder builder) {
Expand All @@ -39,13 +43,13 @@ static void applyServerRequestSizeAdvice(LongHistogramBuilder builder) {
.setAttributesAdvice(
asList(
// stable attributes
SemanticAttributes.HTTP_ROUTE,
SemanticAttributes.HTTP_REQUEST_METHOD,
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
SemanticAttributes.ERROR_TYPE,
SemanticAttributes.NETWORK_PROTOCOL_NAME,
SemanticAttributes.NETWORK_PROTOCOL_VERSION,
SemanticAttributes.URL_SCHEME));
HttpAttributes.HTTP_ROUTE,
HttpAttributes.HTTP_REQUEST_METHOD,
HttpAttributes.HTTP_RESPONSE_STATUS_CODE,
ErrorAttributes.ERROR_TYPE,
NetworkAttributes.NETWORK_PROTOCOL_NAME,
NetworkAttributes.NETWORK_PROTOCOL_VERSION,
UrlAttributes.URL_SCHEME));
}

static void applyServerActiveRequestsAdvice(LongUpDownCounterBuilder builder) {
Expand All @@ -56,7 +60,7 @@ static void applyServerActiveRequestsAdvice(LongUpDownCounterBuilder builder) {
.setAttributesAdvice(
asList(
// https://github.com/open-telemetry/semantic-conventions/blob/v1.23.0/docs/http/http-metrics.md#metric-httpserveractive_requests
SemanticAttributes.HTTP_REQUEST_METHOD, SemanticAttributes.URL_SCHEME));
HttpAttributes.HTTP_REQUEST_METHOD, UrlAttributes.URL_SCHEME));
}

private HttpExperimentalMetricsAdvice() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.HttpIncubatingAttributes;
import javax.annotation.Nullable;

final class HttpMessageBodySizeUtil {

@Nullable
static Long getHttpRequestBodySize(Attributes... attributesList) {
return getAttribute(SemanticAttributes.HTTP_REQUEST_BODY_SIZE, attributesList);
return getAttribute(HttpIncubatingAttributes.HTTP_REQUEST_BODY_SIZE, attributesList);
}

@Nullable
static Long getHttpResponseBodySize(Attributes... attributesList) {
return getAttribute(SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, attributesList);
return getAttribute(HttpIncubatingAttributes.HTTP_RESPONSE_BODY_SIZE, attributesList);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.instrumentation.api.internal.SpanKey;
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes;
import java.util.List;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -62,40 +62,46 @@ public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST, R

@Override
public void onStart(AttributesBuilder attributes, Context parentContext, REQUEST request) {
internalSet(attributes, SemanticAttributes.MESSAGING_SYSTEM, getter.getSystem(request));
internalSet(
attributes, MessagingIncubatingAttributes.MESSAGING_SYSTEM, getter.getSystem(request));
boolean isTemporaryDestination = getter.isTemporaryDestination(request);
if (isTemporaryDestination) {
internalSet(attributes, SemanticAttributes.MESSAGING_DESTINATION_TEMPORARY, true);
internalSet(attributes, SemanticAttributes.MESSAGING_DESTINATION_NAME, TEMP_DESTINATION_NAME);
internalSet(attributes, MessagingIncubatingAttributes.MESSAGING_DESTINATION_TEMPORARY, true);
internalSet(
attributes,
MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME,
TEMP_DESTINATION_NAME);
} else {
internalSet(
attributes,
SemanticAttributes.MESSAGING_DESTINATION_NAME,
MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME,
getter.getDestination(request));
internalSet(
attributes,
SemanticAttributes.MESSAGING_DESTINATION_TEMPLATE,
MessagingIncubatingAttributes.MESSAGING_DESTINATION_TEMPLATE,
getter.getDestinationTemplate(request));
}
boolean isAnonymousDestination = getter.isAnonymousDestination(request);
if (isAnonymousDestination) {
internalSet(attributes, SemanticAttributes.MESSAGING_DESTINATION_ANONYMOUS, true);
internalSet(attributes, MessagingIncubatingAttributes.MESSAGING_DESTINATION_ANONYMOUS, true);
}
internalSet(
attributes,
SemanticAttributes.MESSAGING_MESSAGE_CONVERSATION_ID,
MessagingIncubatingAttributes.MESSAGING_MESSAGE_CONVERSATION_ID,
getter.getConversationId(request));
internalSet(
attributes,
SemanticAttributes.MESSAGING_MESSAGE_BODY_SIZE,
MessagingIncubatingAttributes.MESSAGING_MESSAGE_BODY_SIZE,
getter.getMessageBodySize(request));
internalSet(
attributes,
SemanticAttributes.MESSAGING_MESSAGE_ENVELOPE_SIZE,
MessagingIncubatingAttributes.MESSAGING_MESSAGE_ENVELOPE_SIZE,
getter.getMessageEnvelopeSize(request));
internalSet(attributes, SemanticAttributes.MESSAGING_CLIENT_ID, getter.getClientId(request));
internalSet(
attributes, MessagingIncubatingAttributes.MESSAGING_CLIENT_ID, getter.getClientId(request));
if (operation != null) {
internalSet(attributes, SemanticAttributes.MESSAGING_OPERATION, operation.operationName());
internalSet(
attributes, MessagingIncubatingAttributes.MESSAGING_OPERATION, operation.operationName());
}
}

Expand All @@ -108,11 +114,11 @@ public void onEnd(
@Nullable Throwable error) {
internalSet(
attributes,
SemanticAttributes.MESSAGING_MESSAGE_ID,
MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID,
getter.getMessageId(request, response));
internalSet(
attributes,
SemanticAttributes.MESSAGING_BATCH_MESSAGE_COUNT,
MessagingIncubatingAttributes.MESSAGING_BATCH_MESSAGE_COUNT,
getter.getBatchMessageCount(request, response));

for (String name : capturedHeaders) {
Expand Down
Loading
Loading