Skip to content

Commit

Permalink
fix stack overflow and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk committed Dec 5, 2024
1 parent fe54ff2 commit cc7fd0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ internal class SessionManager(
// observers need to be called after bumping the timer because it may
// create a new span
if (newSession != session) {
val oldSession = session
session = newSession
observers.forEach {
it.onSessionEnded(session)
it.onSessionStarted(newSession, session)
it.onSessionEnded(oldSession)
it.onSessionStarted(session, oldSession)
}
session = newSession
}
return session.getId()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ public void shouldBuildLogRecordProvider() {
List<LogRecordData> logs = logsExporter.getFinishedLogRecordItems();
assertThat(logs).hasSize(2);
assertThat(logs.get(0))
.hasAttributesSatisfyingExactly(equalTo(stringKey("event.name"), "session.start"));
.hasAttributesSatisfyingExactly(
equalTo(SESSION_ID, openTelemetryRum.getRumSessionId()),
equalTo(stringKey("event.name"), "session.start"));
assertThat(logs.get(1))
.hasAttributesSatisfyingExactly(
equalTo(SESSION_ID, openTelemetryRum.getRumSessionId()),
Expand Down Expand Up @@ -323,7 +325,9 @@ public void setLogRecordExporterCustomizer() {
assertThat(logs).hasSize(2);
Iterator<LogRecordData> iter = logs.iterator();
assertThat(iter.next())
.hasAttributesSatisfyingExactly(equalTo(stringKey("event.name"), "session.start"));
.hasAttributesSatisfyingExactly(
equalTo(SESSION_ID, rum.getRumSessionId()),
equalTo(stringKey("event.name"), "session.start"));
assertThat(iter.next())
.hasBody("foo")
.hasAttributesSatisfyingExactly(
Expand Down

0 comments on commit cc7fd0d

Please sign in to comment.