File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,37 @@ As a consequence it should only be used when the span duration is known, thus on
99However, the current SDK API does not allow to modify span attributes on span end, so we have to
1010introduce other components to make it work as expected.
1111
12+ ## Usage
13+
14+ This extension does not support autoconfiguration because it needs to wrap the ` SimpleSpanExporter `
15+ or ` BatchingSpanProcessor ` that invokes the ` SpanExporter ` .
16+
17+ As a consequence you have to use [ Manual SDK setup] ( #manual-sdk-setup )
18+ section below to configure it.
19+
20+ ### Manual SDK setup
21+
22+ Here is an example registration of ` StackTraceSpanProcessor ` to capture stack trace for all
23+ the spans that have a duration >= 1000 ns. The spans that have an ` ignorespan ` string attribute
24+ will be ignored.
25+
26+ ``` java
27+ InMemorySpanExporter spansExporter = InMemorySpanExporter . create();
28+ SpanProcessor exportProcessor = SimpleSpanProcessor . create(spansExporter);
29+
30+ Predicate<ReadableSpan > filterPredicate = readableSpan - > {
31+ if (readableSpan. getAttribute(AttributeKey . stringKey(" ignorespan" )) != null ){
32+ return false ;
33+ }
34+ return true ;
35+ };
36+ SdkTracerProvider tracerProvider = SdkTracerProvider . builder()
37+ .addSpanProcessor(new StackTraceSpanProcessor (exportProcessor, 1000 , filterPredicate))
38+ .build();
39+
40+ OpenTelemetrySdk sdk = OpenTelemetrySdk . builder(). setTracerProvider(tracerProvider). build();
41+ ```
42+
1243## Component owners
1344
1445- [ Jack Shirazi] ( https://github.com/jackshirazi ) , Elastic
You can’t perform that action at this time.
0 commit comments