open-telemetry / open-telemetry/opentelemetry-java

Add documentation on how to remove the span and disable implicit child spans for a particular code path

Open
#1,717 16 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked:spec Feature Request
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Currently, the best way to how to remove the span and disable implicit child spans for a particular code path is probably this

try (Scope ignored = TracingContextUtils.currentContextWith(DefaultSpan.getInvalid())) {
  // Since scoped span is invalid, no tracing happens.
}

This should be documented, possibly with a helper somewhere, something like Scope withTracingDisabled().

/cc @marcingrzejszczak

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no target file or test; start with the Java example using TracingContextUtils and DefaultSpan.getInvalid(), then locate the existing tracing-context documentation. Done means the documented guidance explains how to remove a span and suppress implicit child spans for one code path, and clearly resolves whether a helper such as Scope withTracingDisabled() is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.