Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk committed Nov 19, 2024
1 parent 3e66d6b commit b143a8d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ OpenTelemetryRum build(ServiceManager serviceManager) {
OpenTelemetrySdk.builder()
.setTracerProvider(
buildTracerProvider(sessionManager, application, spanExporter))
.setLoggerProvider(buildLoggerProvider(sessionManager, application, logsExporter))
.setLoggerProvider(
buildLoggerProvider(sessionManager, application, logsExporter))
.setMeterProvider(buildMeterProvider(application))
.setPropagators(buildFinalPropagators())
.build();
Expand Down Expand Up @@ -439,7 +440,9 @@ private SdkTracerProvider buildTracerProvider(
}

private SdkLoggerProvider buildLoggerProvider(
SessionProvider sessionProvider, Application application, LogRecordExporter logsExporter) {
SessionProvider sessionProvider,
Application application,
LogRecordExporter logsExporter) {
SdkLoggerProviderBuilder loggerProviderBuilder =
SdkLoggerProvider.builder()
.setResource(resource)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.android

import io.opentelemetry.android.session.SessionProvider
Expand All @@ -8,7 +13,10 @@ import io.opentelemetry.semconv.incubating.SessionIncubatingAttributes.SESSION_I

internal class SessionIdLogRecordAppender(private val sessionProvider: SessionProvider) :
LogRecordProcessor {
override fun onEmit(context: Context, logRecord: ReadWriteLogRecord) {
override fun onEmit(
context: Context,
logRecord: ReadWriteLogRecord,
) {
logRecord.setAttribute(SESSION_ID, sessionProvider.getSessionId())
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.android

import io.mockk.MockKAnnotations
Expand Down Expand Up @@ -36,4 +41,4 @@ class SessionIdLogRecordAppenderTest {

verify { log.setAttribute(SESSION_ID, SESSION_ID_VALUE) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.semconv.incubating.EventIncubatingAttributes;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
Expand Down Expand Up @@ -63,7 +61,7 @@ private void emitCrashEvent(Logger crashReporter, CrashDetails crashDetails) {
extractor.onStart(attributesBuilder, Context.current(), crashDetails);
}

//TODO: use emitEvent() when available, with event name from semantic conventions.
// TODO: use emitEvent() when available, with event name from semantic conventions.
attributesBuilder.put(EVENT_NAME, "device.crash");
crashReporter.logRecordBuilder().setAllAttributes(attributesBuilder.build()).emit();
}
Expand Down

0 comments on commit b143a8d

Please sign in to comment.