@@ -31,45 +31,30 @@ public AppSecSpanPostProcessor(ApiSecuritySampler sampler, EventProducerService
3131
3232 @ Override
3333 public void process (@ Nonnull AgentSpan span , @ Nonnull BooleanSupplier timeoutCheck ) {
34- long timestamp = System .currentTimeMillis ();
35- String traceId = span .getTraceId () != null ? span .getTraceId ().toString () : "null" ;
36- String spanId = String .valueOf (span .getSpanId ());
37-
3834 final RequestContext ctx_ = span .getRequestContext ();
3935 if (ctx_ == null ) {
40- logProcessingDecision (timestamp , traceId , spanId , false , "no request context" , "start" );
4136 return ;
4237 }
4338 final AppSecRequestContext ctx = ctx_ .getData (RequestContextSlot .APPSEC );
4439 if (ctx == null ) {
45- logProcessingDecision (timestamp , traceId , spanId , false , "no appsec context" , "start" );
4640 return ;
4741 }
4842
4943 if (!ctx .isKeepOpenForApiSecurityPostProcessing ()) {
50- logProcessingDecision (
51- timestamp , traceId , spanId , false , "not marked for post-processing" , "start" );
5244 return ;
5345 }
5446
5547 try {
5648 if (timeoutCheck .getAsBoolean ()) {
5749 log .debug ("Timeout detected, skipping API security post-processing" );
58- logProcessingDecision (
59- timestamp , traceId , spanId , false , "timeout detected" , "pre-sampling" );
6050 return ;
6151 }
6252 if (!sampler .sampleRequest (ctx )) {
6353 log .debug ("Request not sampled, skipping API security post-processing" );
64- logProcessingDecision (
65- timestamp , traceId , spanId , false , "request not sampled" , "post-sampling" );
6654 return ;
6755 }
6856 log .debug ("Request sampled, processing API security post-processing" );
69- logProcessingDecision (
70- timestamp , traceId , spanId , true , "sampled, extracting schemas" , "extracting" );
7157 extractSchemas (ctx , ctx_ .getTraceSegment ());
72- logProcessingDecision (timestamp , traceId , spanId , true , "extraction completed" , "completed" );
7358 } finally {
7459 ctx .setKeepOpenForApiSecurityPostProcessing (false );
7560 try {
@@ -82,7 +67,6 @@ public void process(@Nonnull AgentSpan span, @Nonnull BooleanSupplier timeoutChe
8267 log .debug ("Error closing AppSecRequestContext" , e );
8368 }
8469 sampler .releaseOne ();
85- logProcessingDecision (timestamp , traceId , spanId , false , "cleanup completed" , "cleanup" );
8670 }
8771 }
8872
@@ -105,21 +89,4 @@ private void extractSchemas(final AppSecRequestContext ctx, final TraceSegment t
10589 log .debug ("Subscriber info expired" , e );
10690 }
10791 }
108-
109- private void logProcessingDecision (
110- long timestamp ,
111- String traceId ,
112- String spanId ,
113- boolean processed ,
114- String reason ,
115- String stage ) {
116- log .info (
117- "[APPSEC_SPAN_POST_PROCESSING] timestamp={}, traceId={}, spanId={}, processed={}, reason={}, stage={}" ,
118- timestamp ,
119- traceId ,
120- spanId ,
121- processed ,
122- reason ,
123- stage );
124- }
12592}
0 commit comments