|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +package io.opentelemetry.instrumentation.awssdk.v2_2.autoconfigure; |
| 7 | + |
| 8 | +import io.opentelemetry.api.GlobalOpenTelemetry; |
| 9 | +import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; |
| 10 | +import io.opentelemetry.instrumentation.awssdk.v2_2.AwsSdkTelemetry; |
| 11 | + |
| 12 | +public final class AwsSdkSingletons { |
| 13 | + |
| 14 | + private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES = |
| 15 | + ConfigPropertiesUtil.getBoolean( |
| 16 | + "otel.instrumentation.aws-sdk.experimental-span-attributes", false); |
| 17 | + |
| 18 | + private static final boolean USE_MESSAGING_PROPAGATOR = |
| 19 | + ConfigPropertiesUtil.getBoolean( |
| 20 | + "otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging", false); |
| 21 | + |
| 22 | + private static final boolean RECORD_INDIVIDUAL_HTTP_ERROR = |
| 23 | + ConfigPropertiesUtil.getBoolean( |
| 24 | + "otel.instrumentation.aws-sdk.experimental-record-individual-http-error", false); |
| 25 | + |
| 26 | + private static final boolean RECEIVE_TELEMETRY_ENABLED = |
| 27 | + ConfigPropertiesUtil.getBoolean( |
| 28 | + "otel.instrumentation.messaging.experimental.receive-telemetry.enabled", false); |
| 29 | + |
| 30 | + private static final AwsSdkTelemetry TELEMETRY = |
| 31 | + AwsSdkTelemetry.builder(GlobalOpenTelemetry.get()) |
| 32 | + .setCaptureExperimentalSpanAttributes(CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES) |
| 33 | + .setMessagingReceiveInstrumentationEnabled(RECEIVE_TELEMETRY_ENABLED) |
| 34 | + .setUseConfiguredPropagatorForMessaging(USE_MESSAGING_PROPAGATOR) |
| 35 | + .setRecordIndividualHttpError(RECORD_INDIVIDUAL_HTTP_ERROR) |
| 36 | + .build(); |
| 37 | + |
| 38 | + public static AwsSdkTelemetry telemetry() { |
| 39 | + return TELEMETRY; |
| 40 | + } |
| 41 | + |
| 42 | + private AwsSdkSingletons() {} |
| 43 | +} |
0 commit comments