Open brettmc opened 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 74.30%. Comparing base (
eaba9e3
) to head (9f1bbec
). Report is 1 commits behind head on main.
The primary objective here is to make it easier to go back and modify the local root span of a transaction. We do this now (by stashing the root span in context and accessing it later) in some auto-instrumentation packages to do things like update the name once routing has taken place, and in a similar fashion we could also add further attributes that were not known at the time the root span was created.
this is based on Java's implementation, https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v2.3.0/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/LocalRootSpan.java and adds the ability to identify and locate the "local root span" in a trace. The local root span is the top-level active span which has either an invalid or remote parent. It's tracked automatically as part of making a span active, either via
Span::activate()
orSpan::storeInContext()
, and can be retrieved in a couple of ways, but most easily viaLocalRootSpan::current()
.