Skip to content

Commit aed6b3b

Browse files
committed
do not override span name if customized
1 parent d533746 commit aed6b3b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import io.sentry.protocol.SentryPackage;
1515
import java.util.HashMap;
1616
import java.util.Map;
17+
import java.util.Properties;
18+
1719
import org.jetbrains.annotations.NotNull;
1820
import org.jetbrains.annotations.Nullable;
1921

@@ -25,6 +27,7 @@ public final class SentryAutoConfigurationCustomizerProvider
2527
@Override
2628
public void customize(AutoConfigurationCustomizer autoConfiguration) {
2729
ensureSentryOtelStorageIsInitialized();
30+
customizeOpenTelemetryDefaults();
2831
final @Nullable ManifestVersionReader.VersionInfoHolder versionInfoHolder =
2932
ManifestVersionReader.getInstance().readOpenTelemetryVersion();
3033

@@ -63,6 +66,16 @@ private static void ensureSentryOtelStorageIsInitialized() {
6366
Sentry.getGlobalScope();
6467
}
6568

69+
private void customizeOpenTelemetryDefaults() {
70+
try {
71+
if (System.getProperty("otel.instrumentation.graphql.add-operation-name-to-span-name.enabled") == null) {
72+
System.setProperty("otel.instrumentation.graphql.add-operation-name-to-span-name.enabled", "true");
73+
}
74+
} catch (Exception e) {
75+
// TODO log
76+
}
77+
}
78+
6679
private boolean isSentryAutoInitEnabled() {
6780
if (skipInit) {
6881
return false;

0 commit comments

Comments
 (0)