-
Notifications
You must be signed in to change notification settings - Fork 68
Description
If a global attribute supplier is provided, but returns an empty list, the supplier does not get installed. This makes it difficult to dynamically add attributes later. As it stands, a dummy attribute has to be returned just to get the supplier installed which is just a dumb gross hack. The easiest way to fix this is to just remove the nonsensical isEmpty check and change the default to null.
opentelemetry-android/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java
Lines 482 to 489 in 541754e
if (config.hasGlobalAttributes()) { | |
// Add span processor that appends global attributes. | |
GlobalAttributesSpanAppender appender = | |
new GlobalAttributesSpanAppender(config.getGlobalAttributesSupplier()); | |
addTracerProviderCustomizer( | |
(tracerProviderBuilder, app) -> | |
tracerProviderBuilder.addSpanProcessor(appender)); | |
} |
opentelemetry-android/core/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java
Lines 43 to 46 in 541754e
public boolean hasGlobalAttributes() { | |
Attributes attributes = globalAttributesSupplier.get(); | |
return attributes != null && !attributes.isEmpty(); | |
} |
opentelemetry-android/core/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java
Line 22 in 541754e
private Supplier<Attributes> globalAttributesSupplier = Attributes::empty; |