Skip to content

Use embrace clock in UI load tracing#2278

Merged
fractalwrench merged 3 commits intomainfrom
refactor-clock
Jul 7, 2025
Merged

Use embrace clock in UI load tracing#2278
fractalwrench merged 3 commits intomainfrom
refactor-clock

Conversation

@fractalwrench
Copy link
Copy Markdown
Member

Goal

Uses the embrace clock in UI load tracing rather than the OTel Java clock. This required some changes to the test assertions.

@fractalwrench fractalwrench requested a review from a team as a code owner June 25, 2025 11:11
private val logger: EmbLogger,
manualEnd: Boolean,
private val processCreatedMs: Long? = if (versionChecker.isAtLeast(VERSION_CODES.N)) {
Process.getStartElapsedRealtime()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns 0 in tests and is used as the span start time. I therefore moved it to the constructor so that we can supply a fake value for our assertions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. We can wrap the Process object and fake it as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done in #2313

parent = this,
)
}
val startMs = applicationInitStartMs
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumed this was a bug, if not then the assertion in the tests is wrong.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is a bug

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thing is that applicationInitEnd() isn't called often right now. I'll need to fix this before we merge the bytecode instrumentation change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see this logic was changed in this commit? I'll just take a look at this as a whole

Base automatically changed from simplify-clock-impl to integration/kotlin-otel-api June 25, 2025 14:31
Base automatically changed from integration/kotlin-otel-api to main June 26, 2025 09:12
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 26, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@fractalwrench fractalwrench force-pushed the refactor-clock branch 2 times, most recently from 6adf496 to ada8cc7 Compare July 4, 2025 15:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.16%. Comparing base (78a622d) to head (f5b0c7b).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2278      +/-   ##
==========================================
- Coverage   85.17%   85.16%   -0.01%     
==========================================
  Files         476      477       +1     
  Lines       10557    10552       -5     
  Branches     1551     1550       -1     
==========================================
- Hits         8992     8987       -5     
  Misses        894      894              
  Partials      671      671              
Files with missing lines Coverage Δ
...bracesdk/internal/injection/OpenTelemetryModule.kt 100.00% <100.00%> (ø)
.../embracesdk/internal/capture/activity/UiLoadExt.kt 98.85% <100.00%> (ø)
...internal/capture/startup/AppStartupTraceEmitter.kt 85.57% <100.00%> (-0.49%) ⬇️
...internal/injection/DataCaptureServiceModuleImpl.kt 95.74% <100.00%> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member Author

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fractalwrench fractalwrench merged commit 3a2b1a9 into main Jul 7, 2025
11 checks passed
@fractalwrench fractalwrench deleted the refactor-clock branch July 7, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants