Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added session.id as key along with rum.session.id for span #610

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public class RumConstants {

public static final String OTEL_RUM_LOG_TAG = "OpenTelemetryRum";

public static final AttributeKey<String> SESSION_ID_KEY = stringKey("rum.session.id");
public static final AttributeKey<String> SESSION_ID_KEY = stringKey("session.id");

public static final AttributeKey<String> RUM_SESSION_ID_KEY = stringKey("rum.session.id");

public static final AttributeKey<String> LAST_SCREEN_NAME_KEY =
AttributeKey.stringKey("last.screen.name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public SessionIdSpanAppender(SessionId sessionId) {
@Override
public void onStart(Context parentContext, ReadWriteSpan span) {
span.setAttribute(RumConstants.SESSION_ID_KEY, sessionId.getSessionId());
span.setAttribute(RumConstants.RUM_SESSION_ID_KEY, sessionId.getSessionId());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.opentelemetry.rum.internal;

import static io.opentelemetry.rum.internal.RumConstants.RUM_SESSION_ID_KEY;
import static io.opentelemetry.rum.internal.RumConstants.SESSION_ID_KEY;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
Expand Down Expand Up @@ -81,7 +82,8 @@ void shouldBuildTracerProvider() {
assertThat(spans.get(0))
.hasName("test span")
.hasResource(resource)
.hasAttributesSatisfyingExactly(equalTo(SESSION_ID_KEY, sessionId));
.hasAttributesSatisfyingExactly(
equalTo(SESSION_ID_KEY, sessionId), equalTo(RUM_SESSION_ID_KEY, sessionId));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.opentelemetry.rum.internal;

import static io.opentelemetry.rum.internal.RumConstants.RUM_SESSION_ID_KEY;
import static io.opentelemetry.rum.internal.RumConstants.SESSION_ID_KEY;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -45,7 +46,7 @@ void shouldSetSessionIdAsSpanAttribute() {
underTest.onStart(Context.root(), span);

verify(span).setAttribute(SESSION_ID_KEY, "42");

verify(span).setAttribute(RUM_SESSION_ID_KEY, "42");
assertFalse(underTest.isEndRequired());
}
}