Skip to content

Commit eac12f4

Browse files
authored
Remove indirection for integrations and packages via VersionInfoHolder (#4578)
#skip-changelog ## 📜 Description <!--- Describe your changes in detail --> Remove indirection for integrations and packages via VersionInfoHolder ## 💡 Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> `ManifestVersionDetector` expects `ManifestVersionReader` to write to `SentryIntegrationPackageStorage` directly. ## 💚 How did you test it? ## 📝 Checklist <!--- Put an `x` in the boxes that apply --> - [ ] I added tests to verify the changes. - [ ] No new PII added or SDK only sends newly added PII if `sendDefaultPII` is enabled. - [ ] I updated the docs if needed. - [ ] I updated the wizard if needed. - [ ] Review from the native team if needed. - [ ] No breaking change or entry added to the changelog. - [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs. ## 🔮 Next steps
1 parent 5b05195 commit eac12f4

File tree

3 files changed

+7
-33
lines changed

3 files changed

+7
-33
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
88
import io.sentry.InitPriority;
99
import io.sentry.Sentry;
10-
import io.sentry.SentryIntegrationPackageStorage;
1110
import io.sentry.SentryOptions;
1211
import io.sentry.internal.ManifestVersionReader;
1312
import io.sentry.protocol.SdkVersion;
14-
import io.sentry.protocol.SentryPackage;
1513
import java.util.HashMap;
1614
import java.util.Map;
1715
import java.util.logging.Level;
@@ -46,15 +44,6 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
4644
});
4745
}
4846

49-
if (versionInfoHolder != null) {
50-
for (SentryPackage pkg : versionInfoHolder.getPackages()) {
51-
SentryIntegrationPackageStorage.getInstance().addPackage(pkg.getName(), pkg.getVersion());
52-
}
53-
for (String integration : versionInfoHolder.getIntegrations()) {
54-
SentryIntegrationPackageStorage.getInstance().addIntegration(integration);
55-
}
56-
}
57-
5847
autoConfiguration
5948
.addTracerProviderCustomizer(this::configureSdkTracerProvider)
6049
.addPropertiesSupplier(this::getDefaultProperties);

sentry/api/sentry.api

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4719,8 +4719,6 @@ public final class io/sentry/internal/ManifestVersionReader {
47194719

47204720
public final class io/sentry/internal/ManifestVersionReader$VersionInfoHolder {
47214721
public fun <init> ()V
4722-
public fun getIntegrations ()Ljava/util/List;
4723-
public fun getPackages ()Ljava/util/List;
47244722
public fun getSdkName ()Ljava/lang/String;
47254723
public fun getSdkVersion ()Ljava/lang/String;
47264724
}

sentry/src/main/java/io/sentry/internal/ManifestVersionReader.java

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
import io.sentry.ISentryLifecycleToken;
44
import io.sentry.SentryIntegrationPackageStorage;
5-
import io.sentry.protocol.SentryPackage;
65
import io.sentry.util.AutoClosableReentrantLock;
76
import java.io.IOException;
87
import java.net.URL;
9-
import java.util.ArrayList;
108
import java.util.Enumeration;
11-
import java.util.List;
129
import java.util.jar.Attributes;
1310
import java.util.jar.Manifest;
1411
import org.jetbrains.annotations.ApiStatus;
@@ -73,18 +70,18 @@ public void readManifestFiles() {
7370
final @Nullable String otelVersion =
7471
mainAttributes.getValue("Sentry-Opentelemetry-Version-Name");
7572
if (otelVersion != null) {
76-
versionInfo.packages.add(
77-
new SentryPackage("maven:io.opentelemetry:opentelemetry-sdk", otelVersion));
78-
versionInfo.integrations.add("OpenTelemetry");
73+
SentryIntegrationPackageStorage.getInstance()
74+
.addPackage("maven:io.opentelemetry:opentelemetry-sdk", otelVersion);
75+
SentryIntegrationPackageStorage.getInstance().addIntegration("OpenTelemetry");
7976
}
8077
final @Nullable String otelJavaagentVersion =
8178
mainAttributes.getValue("Sentry-Opentelemetry-Javaagent-Version-Name");
8279
if (otelJavaagentVersion != null) {
83-
versionInfo.packages.add(
84-
new SentryPackage(
80+
SentryIntegrationPackageStorage.getInstance()
81+
.addPackage(
8582
"maven:io.opentelemetry.javaagent:opentelemetry-javaagent",
86-
otelJavaagentVersion));
87-
versionInfo.integrations.add("OpenTelemetry-Agent");
83+
otelJavaagentVersion);
84+
SentryIntegrationPackageStorage.getInstance().addIntegration("OpenTelemetry-Agent");
8885
}
8986
if (name.equals("sentry.java.opentelemetry.agentless")) {
9087
SentryIntegrationPackageStorage.getInstance()
@@ -117,8 +114,6 @@ public void readManifestFiles() {
117114
public static final class VersionInfoHolder {
118115
private volatile @Nullable String sdkName;
119116
private volatile @Nullable String sdkVersion;
120-
private List<SentryPackage> packages = new ArrayList<>();
121-
private List<String> integrations = new ArrayList<>();
122117

123118
public @Nullable String getSdkName() {
124119
return sdkName;
@@ -127,13 +122,5 @@ public static final class VersionInfoHolder {
127122
public @Nullable String getSdkVersion() {
128123
return sdkVersion;
129124
}
130-
131-
public List<SentryPackage> getPackages() {
132-
return packages;
133-
}
134-
135-
public List<String> getIntegrations() {
136-
return integrations;
137-
}
138125
}
139126
}

0 commit comments

Comments
 (0)