File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
main/java/io/arex/agent/bootstrap/ctx
test/java/io/arex/agent/bootstrap/ctx Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,15 @@ public final void remove() {
4040 super .remove ();
4141 }
4242
43+ @ Override
44+ protected T childValue (T parentValue ) {
45+ // no need to copy arex-record-id, TraceTransmitter will capture and replay
46+ if (parentValue instanceof String && ((String ) parentValue ).startsWith ("AREX-" )) {
47+ return null ;
48+ }
49+ return super .childValue (parentValue );
50+ }
51+
4352 public void superRemove () {
4453 super .remove ();
4554 }
Original file line number Diff line number Diff line change 1+ package io .arex .agent .bootstrap .ctx ;
2+
3+ import org .junit .jupiter .params .ParameterizedTest ;
4+ import org .junit .jupiter .params .provider .CsvSource ;
5+
6+ import static org .junit .jupiter .api .Assertions .*;
7+
8+ class ArexThreadLocalTest {
9+
10+ static final ArexThreadLocal <String > TRACE_CONTEXT = new ArexThreadLocal <>();
11+
12+ @ ParameterizedTest
13+ @ CsvSource ({
14+ "AREX-mock, null" ,
15+ "mock, mock"
16+ })
17+ void childValue (String request , String expect ) {
18+ String result = String .valueOf (TRACE_CONTEXT .childValue (request ));
19+ System .out .println (result );
20+ assertEquals (expect , result );
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments