Skip to content

Commit 079671e

Browse files
Improve bindToScope docs for Java (#12263)
* Improve bindToScope docs * Apply suggestions from code review Co-authored-by: Alex Krawiec <[email protected]> --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent 35f08a0 commit 079671e

File tree

3 files changed

+8
-0
lines changed
  • docs/platforms/java/common/tracing/troubleshooting
  • platform-includes/performance

3 files changed

+8
-0
lines changed

docs/platforms/java/common/tracing/troubleshooting/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ The 200+ character request above will become truncated to:
1919
`https://empowerplant.io/api/0/projects/ep/setup_form/?user_id=314159265358979323846264338327&tracking_id=EasyAsABC123OrSimpleAsDoReMi&product_name=PlantToHumanTranslator&product_id=1618033988749894848`
2020

2121
<PlatformContent includePath="performance/control-data-truncation" />
22+
23+
## Expected Spans Are Missing
24+
25+
Our auto instrumentation, for example those instrumenting database requests or HTTP calls, require a transaction to be present on the `Scope` in order to attach a new child span. In case you're missing expected spans, please make sure `bindToScope` is set to `true` when starting a transaction. Also see <PlatformLink to="/tracing/instrumentation/custom-instrumentation/#create-transaction-bound-to-the-current-scope">Create Transaction Bound to The Current Scope</PlatformLink>.

platform-includes/performance/create-transaction-bound-to-scope/java.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Our SDK can bind a transaction to the scope making it accessible to every method running within this scope by calling `Sentry#startTransaction` method with `bindToScope` parameter to `true`.
44

5+
Our auto instrumentation, for example those instrumenting database requests or HTTP calls, require a transaction to be bound to the current scope in order to attach a new child span.
6+
57
`bindToScope` additionally ensures that your new transaction replaces any one that may be already started. This is useful if you want custom instrumentation to co-exist with auto-instrumented transactions.
68

79
In cases where you want to attach Spans to an already ongoing Transaction you can use `Sentry#getSpan`. This method will return a `SentryTransaction` in case there is a running Transaction or a `Span` in case there is already a running Span, otherwise it returns `null`.

platform-includes/performance/enable-manual-instrumentation/java.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ try {
3636
transaction.finish();
3737
}
3838
```
39+
40+
By default the transaction is not bound to the scope. Our auto instrumentation, for example those instrumenting database requests or HTTP calls, rely on a transaction to be present in order to attach new child spans to it. Please take a look at the <PlatformLink to="/tracing/instrumentation/custom-instrumentation/#create-transaction-bound-to-the-current-scope">Create Transaction Bound to The Current Scope</PlatformLink> section further down.

0 commit comments

Comments
 (0)