@@ -153,20 +153,49 @@ public void testDropSpanWithMultipleCriterion() {
153153 "tenantIdTagKey" ,
154154 "tenant-key" ,
155155 "spanDropCriterion" ,
156- List .of ("foo:bar,k1:v1" , "k2:v2" ))));
156+ List .of ("foo:bar,k1:v1" , "k2:v2" , "http.url:https://foo.bar" ))));
157157
158158 JaegerSpanPreProcessor jaegerSpanPreProcessor =
159159 new JaegerSpanPreProcessor (ConfigFactory .parseMap (configs ));
160160 Process process = Process .newBuilder ().setServiceName ("testService" ).build ();
161- Span span =
162- Span .newBuilder ()
163- .setProcess (process )
164- .addTags (KeyValue .newBuilder ().setKey ("tenant-key" ).setVStr (tenantId ).build ())
165- .addTags (KeyValue .newBuilder ().setKey ("foo" ).setVStr ("bar" ).build ())
166- .addTags (KeyValue .newBuilder ().setKey ("k2" ).setVStr ("v2" ).build ())
167- .build ();
168- PreProcessedSpan preProcessedSpan = jaegerSpanPreProcessor .preProcessSpan (span );
169- Assertions .assertNull (preProcessedSpan );
161+ {
162+ Span span =
163+ Span .newBuilder ()
164+ .setProcess (process )
165+ .addTags (KeyValue .newBuilder ().setKey ("tenant-key" ).setVStr (tenantId ).build ())
166+ .addTags (KeyValue .newBuilder ().setKey ("foo" ).setVStr ("bar" ).build ())
167+ .addTags (KeyValue .newBuilder ().setKey ("k2" ).setVStr ("v2" ).build ())
168+ .build ();
169+ PreProcessedSpan preProcessedSpan = jaegerSpanPreProcessor .preProcessSpan (span );
170+ // Span dropped due to matching condition: k2:v2
171+ Assertions .assertNull (preProcessedSpan );
172+ }
173+
174+ {
175+ Span span =
176+ Span .newBuilder ()
177+ .setProcess (process )
178+ .addTags (KeyValue .newBuilder ().setKey ("tenant-key" ).setVStr (tenantId ).build ())
179+ .addTags (KeyValue .newBuilder ().setKey ("foo" ).setVStr ("bar" ).build ())
180+ .addTags (KeyValue .newBuilder ().setKey ("http.url" ).setVStr ("https://foo.bar" ).build ())
181+ .build ();
182+ PreProcessedSpan preProcessedSpan = jaegerSpanPreProcessor .preProcessSpan (span );
183+ // Span dropped due to matching condition: http.url:https://foo.bar
184+ Assertions .assertNull (preProcessedSpan );
185+ }
186+
187+ {
188+ Span span =
189+ Span .newBuilder ()
190+ .setProcess (process )
191+ .addTags (KeyValue .newBuilder ().setKey ("tenant-key" ).setVStr (tenantId ).build ())
192+ .addTags (KeyValue .newBuilder ().setKey ("foo" ).setVStr ("bar" ).build ())
193+ .addTags (KeyValue .newBuilder ().setKey ("http.url" ).setVStr ("https://valid" ).build ())
194+ .build ();
195+ PreProcessedSpan preProcessedSpan = jaegerSpanPreProcessor .preProcessSpan (span );
196+ // Span not dropped since there is no matching condition
197+ Assertions .assertNotNull (preProcessedSpan );
198+ }
170199 }
171200
172201 @ Test
0 commit comments