Skip to content

Commit 9bbee45

Browse files
amarzialibm1549
andauthored
improve instrumentation doc (#6777)
* improve instrumentation doc * Update docs/how_instrumentations_work.md * Update docs/how_instrumentations_work.md --------- Co-authored-by: Brian Marks <bm1549@users.noreply.github.com>
1 parent 84b49e9 commit 9bbee45

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/how_instrumentations_work.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ To run muzzle on your instrumentation, run:
9494
It checks that the types and methods used by the instrumentation are present in particular versions of libraries.
9595
It can be subverted with `MethodHandle` and reflection, so muzzle passing is not the end of the story.
9696

97-
**TODO: discuss why 'name' is not always included.**
97+
By default, all the muzzle directives are checked against all the instrumentations included in a module.
98+
However, there can be situations in which it’s only needed to check one specific directive on an instrumentation.
99+
At this point the instrumentation should override the method `muzzleDirective()` by returning the name of the directive to execute.
100+
98101

99102
## Instrumentation classes
100103

@@ -527,6 +530,8 @@ It is important to understand that even though they look like maps, since the va
527530
retrieve a value if you use the exact same key object as when it was set. Using a different object that is “`.equals()`
528531
to the first will yield nothing.
529532

533+
Since `ContextStore` does not support null keys, null checks must be enforced _before_ using an object as a key.
534+
530535
## CallDepthThreadLocalMap
531536

532537
In order to avoid activating new spans on recursive calls to the same method
@@ -536,6 +541,8 @@ and [decremented](https://github.com/DataDog/dd-trace-java/blob/9d5c7ea524cfec98
536541
or [reset](https://github.com/DataDog/dd-trace-java/blob/9d5c7ea524cfec982176e687a489fc8c2865e445/dd-java-agent/instrumentation/java-http-client/src/main/java11/datadog/trace/instrumentation/httpclient/SendAdvice.java#L44))
537542
when exiting.
538543

544+
This only works if the methods are called on the same thread since the counter is a ThreadLocal variable.
545+
539546
## Span Lifecycle
540547

541548
In Advice classes, the `@Advice.OnMethodEnter` methods typically start spans and `@Advice.OnMethodExit` methods

0 commit comments

Comments
 (0)