RUM-3249 Provide the bundleWithRum capability for OtelTracer#1960
Conversation
cb0c3cb to
4a3e8dd
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## feature/otel-support #1960 +/- ##
========================================================
+ Coverage 60.03% 60.18% +0.15%
========================================================
Files 804 804
Lines 30121 30152 +31
Branches 4930 4937 +7
========================================================
+ Hits 18081 18145 +64
+ Misses 10840 10799 -41
- Partials 1200 1208 +8
|
ccaaf3e to
4e1dcee
Compare
92bd5f3 to
ef74896
Compare
4e1dcee to
3b4e692
Compare
| # region Opentelemetry | ||
| - "io.opentelemetry.api.trace.TracerBuilder.build()" | ||
| - "io.opentelemetry.api.trace.TracerBuilder.setInstrumentationVersion(kotlin.String?)" | ||
| - "io.opentelemetry.api.trace.SpanBuilder.setAttribute(kotlin.String?, kotlin.String?)" |
There was a problem hiding this comment.
minor: just ordering
| # region Opentelemetry | |
| - "io.opentelemetry.api.trace.TracerBuilder.build()" | |
| - "io.opentelemetry.api.trace.TracerBuilder.setInstrumentationVersion(kotlin.String?)" | |
| - "io.opentelemetry.api.trace.SpanBuilder.setAttribute(kotlin.String?, kotlin.String?)" | |
| # region OpenTelemetry | |
| - "io.opentelemetry.api.trace.SpanBuilder.setAttribute(kotlin.String?, kotlin.String?)" | |
| - "io.opentelemetry.api.trace.TracerBuilder.build()" | |
| - "io.opentelemetry.api.trace.TracerBuilder.setInstrumentationVersion(kotlin.String?)" |
| val rumFeature = sdkCore.getFeature(Feature.RUM_FEATURE_NAME) | ||
| if (bundleWithRumEnabled && rumFeature == null) { | ||
| sdkCore.internalLogger.log( | ||
| InternalLogger.Level.WARN, | ||
| InternalLogger.Target.USER, | ||
| { RUM_NOT_ENABLED_ERROR_MESSAGE } | ||
| ) | ||
| bundleWithRumEnabled = false | ||
| } |
There was a problem hiding this comment.
IMO we need to revisit this logic (I know it is already exists for AndroidTracer): in theory with v2 we can have things enabled independently, so nothing in the setup prevents enabling RUM after Tracer is enabled. IMO this shouldn't prevent us to do bundling with RUM. Is such logic exist on iOS as well?
There was a problem hiding this comment.
Hmmm...good point. I just wanted to follow what was already in the AndroidTracer but it makes sense maybe to remove it. Waiting for @xgouchet opinion here also.
There was a problem hiding this comment.
I agree we need to evaluat the bundling at span creation as the RUM feature can be enabled/disabled independently
There was a problem hiding this comment.
yes agree, we are already checking and warning the user at the spanbuilder decoration level so there is no need for other log for now. I will just remove this from here and add a ticket to remove it also for the AndroidTracer.
| /** | ||
| * Enables the trace bundling with the current active View. If this feature is enabled all | ||
| * the spans from this moment on will be bundled with the current view information and you | ||
| * will be able to see all the traces sent during a specific view in the Rum Explorer. |
There was a problem hiding this comment.
| * will be able to see all the traces sent during a specific view in the Rum Explorer. | |
| * will be able to see all the traces sent during a specific view in the RUM Explorer. |
| } else { | ||
| internalLogger.log( | ||
| InternalLogger.Level.WARN, | ||
| listOf(InternalLogger.Target.USER, InternalLogger.Target.TELEMETRY), |
There was a problem hiding this comment.
Good question. I was thinking that maybe it is useful for us to see how many times we are missing the link with RUM because RUM context is corrupted or session is not there. But I am opened to discussions here.
There was a problem hiding this comment.
My concern is just to avoid spamming telemetry / avoid having many telemetry events to process in the SDK itself, given that it is tracing, so we may have a lot of spans.
There was a problem hiding this comment.
I'll remove it in that case and we will see if we need it in case someone reports missing links.
| // region bundle with RUM | ||
|
|
||
| @Test | ||
| fun `M build a Span with RUM context W buildSpan`() { |
There was a problem hiding this comment.
same applies to the tests below
| fun `M build a Span with RUM context W buildSpan`() { | |
| fun `M build a Span with RUM context W startSpan`() { |
ef74896 to
41370c3
Compare
5fa2926 to
fead880
Compare
0xnm
left a comment
There was a problem hiding this comment.
Is change to remove RUM feature check in AndroidTracer will be in another PR?
| " OtelTracerProvider creation, did you initialize SDK?" | ||
| internal const val RUM_NOT_ENABLED_ERROR_MESSAGE = | ||
| "You're trying to bundle the traces with a RUM context, " + | ||
| "but the RUM feature was disabled in your Configuration. " + |
There was a problem hiding this comment.
we need to update this message (and similar message in AndroidTracer) - RUM is not enabled in core Configuration class anymore in v2.
fead880 to
141ad20
Compare
| } | ||
| } | ||
|
|
||
| private fun resolveSpanBuilderDecoratorFromContext(): (SpanBuilder) -> SpanBuilder = { spanBuilder -> |
There was a problem hiding this comment.
minor: I think the name can be improved here (can be done in another PR) - nothing in the name points that it will be RUM content applied. Maybe something like rumAwareSpanBuilderDecorator for this method will be better (also this can be just a property, not a method).
There was a problem hiding this comment.
yes but that is the idea, this time is for RUM but it should be feature agnostic that's the reason why it is not having any RUM mentioned.
There was a problem hiding this comment.
then still the name doesn't resolve anything from context, it decorates with context.
What does this PR do?
A brief description of the change being made with this pull request.
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)