diff --git a/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java b/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java index 670bac4a..b9c575b9 100644 --- a/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java +++ b/splunk-otel-android/src/main/java/com/splunk/rum/RumInitializer.java @@ -22,25 +22,16 @@ import static com.splunk.rum.SplunkRum.COMPONENT_KEY; import static com.splunk.rum.SplunkRum.COMPONENT_UI; import static com.splunk.rum.SplunkRum.RUM_TRACER_NAME; -import static java.util.Objects.requireNonNull; import static io.opentelemetry.android.RumConstants.APP_START_SPAN_NAME; import static io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor.constant; import static io.opentelemetry.semconv.ResourceAttributes.DEPLOYMENT_ENVIRONMENT; +import static java.util.Objects.requireNonNull; import android.app.Application; import android.os.Looper; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; - import com.splunk.rum.internal.GlobalAttributesSupplier; - -import java.time.Duration; -import java.util.Collection; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.logging.Level; - import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.OpenTelemetryRumBuilder; import io.opentelemetry.android.RuntimeDetailsExtractor; @@ -67,6 +58,11 @@ import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; import io.opentelemetry.sdk.trace.export.SpanExporter; +import java.time.Duration; +import java.util.Collection; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.logging.Level; import zipkin2.reporter.Sender; import zipkin2.reporter.okhttp3.OkHttpSender; @@ -97,7 +93,8 @@ SplunkRum initialize( initializationEvents.begin(); OtelRumConfig config = new OtelRumConfig(); - GlobalAttributesSupplier globalAttributeSupplier = new GlobalAttributesSupplier(builder.globalAttributes); + GlobalAttributesSupplier globalAttributeSupplier = + new GlobalAttributesSupplier(builder.globalAttributes); config.setGlobalAttributes(globalAttributeSupplier); OpenTelemetryRumBuilder otelRumBuilder = OpenTelemetryRum.builder(application, config); diff --git a/splunk-otel-android/src/main/java/com/splunk/rum/SplunkRum.java b/splunk-otel-android/src/main/java/com/splunk/rum/SplunkRum.java index e90e8f8e..5a9922f7 100644 --- a/splunk-otel-android/src/main/java/com/splunk/rum/SplunkRum.java +++ b/splunk-otel-android/src/main/java/com/splunk/rum/SplunkRum.java @@ -26,9 +26,7 @@ import android.util.Log; import android.webkit.WebView; import androidx.annotation.Nullable; - import com.splunk.rum.internal.GlobalAttributesSupplier; - import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.instrumentation.network.CurrentNetworkProvider; import io.opentelemetry.android.instrumentation.startup.AppStartupTimer; diff --git a/splunk-otel-android/src/main/java/com/splunk/rum/internal/GlobalAttributesSupplier.java b/splunk-otel-android/src/main/java/com/splunk/rum/internal/GlobalAttributesSupplier.java index 5087a779..4a4db6e4 100644 --- a/splunk-otel-android/src/main/java/com/splunk/rum/internal/GlobalAttributesSupplier.java +++ b/splunk-otel-android/src/main/java/com/splunk/rum/internal/GlobalAttributesSupplier.java @@ -1,22 +1,37 @@ -package com.splunk.rum.internal; +/* + * Copyright Splunk Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -import java.util.function.Consumer; -import java.util.function.Supplier; +package com.splunk.rum.internal; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; +import java.util.function.Consumer; +import java.util.function.Supplier; /** - * Class to hold and update the set of global attributes that are appended to each - * span. This is used as the supplier to the GlobalAttributesSpanAppender. We need this - * because SplunkRum exposes a topmost update() method, and we can't break that contract, - * and there's no way to get a reference to the GlobalAttributesSpanAppender created by OtelRum. + * Class to hold and update the set of global attributes that are appended to each span. This is + * used as the supplier to the GlobalAttributesSpanAppender. We need this because SplunkRum exposes + * a topmost update() method, and we can't break that contract, and there's no way to get a + * reference to the GlobalAttributesSpanAppender created by OtelRum. * - *
- * When global attributes are more fleshed out in upstream, this will hopefully improve or go away. + *
When global attributes are more fleshed out in upstream, this will hopefully improve or go + * away. * - *
This class is internal and is hence not for public use. Its APIs are unstable and can change - * at any time. + *
This class is internal and is hence not for public use. Its APIs are unstable and can change
+ * at any time.
*/
public class GlobalAttributesSupplier implements Supplier