Skip to content

RUM-7549 Handle trace with coroutines#2457

Merged
xgouchet merged 3 commits into
developfrom
xgouchet/RUM-7549/trace_coroutines
Dec 17, 2024
Merged

RUM-7549 Handle trace with coroutines#2457
xgouchet merged 3 commits into
developfrom
xgouchet/RUM-7549/trace_coroutines

Conversation

@xgouchet

Copy link
Copy Markdown
Contributor

What does this PR do?

The main focus is to avoid sharing the same list of scopes across tracers, and add some internal logs to better diagnose issues with tracing.

@xgouchet
xgouchet requested review from a team as code owners December 17, 2024 10:28
@codecov-commenter

codecov-commenter commented Dec 17, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 35.59322% with 38 lines in your changes missing coverage. Please review.

Project coverage is 70.03%. Comparing base (a8ff9aa) to head (340a1d1).
Report is 44 commits behind head on develop.

Files with missing lines Patch % Lines
...ain/java/com/datadog/opentracing/PendingTrace.java 17.95% 30 Missing and 2 partials ⚠️
.../src/main/java/com/datadog/opentracing/DDSpan.java 50.00% 3 Missing ⚠️
...in/java/com/datadog/opentracing/DDSpanContext.java 66.67% 2 Missing ⚠️
...rc/main/java/com/datadog/opentracing/DDTracer.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2457      +/-   ##
===========================================
- Coverage    70.10%   70.03%   -0.08%     
===========================================
  Files          770      770              
  Lines        28535    28569      +34     
  Branches      4781     4780       -1     
===========================================
+ Hits         20004    20006       +2     
- Misses        7185     7227      +42     
+ Partials      1346     1336      -10     
Files with missing lines Coverage Δ
...entracing/scopemanager/ContextualScopeManager.java 56.76% <100.00%> (ø)
.../kotlin/com/datadog/android/trace/AndroidTracer.kt 95.35% <100.00%> (-0.65%) ⬇️
...rc/main/java/com/datadog/opentracing/DDTracer.java 59.09% <83.33%> (+0.27%) ⬆️
...in/java/com/datadog/opentracing/DDSpanContext.java 78.20% <66.67%> (-0.71%) ⬇️
.../src/main/java/com/datadog/opentracing/DDSpan.java 49.46% <50.00%> (-1.10%) ⬇️
...ain/java/com/datadog/opentracing/PendingTrace.java 57.69% <17.95%> (-12.56%) ⬇️

... and 29 files with indirect coverage changes

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see that these changes only for OpenTracing, should we do something similar for OpenTelemetry.

Anyway, lgtm.

internalLogger.log(
InternalLogger.Level.ERROR,
InternalLogger.Target.USER,
() -> "Span " + span.getOperationName() + " not registered because of traceId mismatch; " +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it useful here also to log the value of span.context().getTraceId()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, yes.

internalLogger.log(
InternalLogger.Level.ERROR,
InternalLogger.Target.USER,
() -> "Span " + span.getOperationName() + " not expired because of traceId mismatch; " +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

public void registerSpan(final DDSpan span) {
if (traceId == null || span.context() == null) {
internalLogger.log(
InternalLogger.Level.ERROR,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In DDSpan when we are dropping the span warn level is used, but here it is an error in the whole file. Should they be aligned?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In DDSpan, we use Warning as the cause of the drop is (most likely) misuse of the SDK, usually by calling finish() more than once.
Here the drop reason are ones that should not happen™️, hence the use of Error level.

@xgouchet
xgouchet merged commit b6df7de into develop Dec 17, 2024
@xgouchet
xgouchet deleted the xgouchet/RUM-7549/trace_coroutines branch December 17, 2024 16:37
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