@@ -689,8 +689,30 @@ def test_set_trace_configurations_by_agent_configuration(self) -> None:
689689 self .base_options = StandardOptions ()
690690 self .base_options .set_tracing (test_tracing )
691691
692- # set_tracing does not override span_filters when already set (has internal filters)
693- assert self .base_options .span_filters == {"exclude" : INTERNAL_SPAN_FILTERS }
692+ # Agent filter rules are appended after the internal filters (no high-priority source set).
693+ agent_exclude = [
694+ {
695+ "name" : "service1" ,
696+ "suppression" : True ,
697+ "attributes" : [
698+ {"key" : "service" , "values" : ["service1" ], "match_type" : "strict" }
699+ ],
700+ },
701+ {
702+ "name" : "service2" ,
703+ "suppression" : True ,
704+ "attributes" : [
705+ {
706+ "key" : "method" ,
707+ "values" : ["method1" , "method2" ],
708+ "match_type" : "strict" ,
709+ }
710+ ],
711+ },
712+ ]
713+ assert self .base_options .span_filters == {
714+ "exclude" : INTERNAL_SPAN_FILTERS + agent_exclude
715+ }
694716 assert self .base_options .kafka_trace_correlation
695717
696718 # Check disabled_spans list
@@ -908,7 +930,28 @@ def test_set_tracing(
908930 }
909931 self .standart_options .set_tracing (test_tracing )
910932
911- assert self .standart_options .span_filters == {"exclude" : INTERNAL_SPAN_FILTERS }
933+ # Agent filter rules are appended after the internal filters (no high-priority source set).
934+ expected_exclude = INTERNAL_SPAN_FILTERS + [
935+ {
936+ "name" : "service1" ,
937+ "suppression" : True ,
938+ "attributes" : [
939+ {"key" : "service" , "values" : ["service1" ], "match_type" : "strict" }
940+ ],
941+ },
942+ {
943+ "name" : "service2" ,
944+ "suppression" : True ,
945+ "attributes" : [
946+ {
947+ "key" : "method" ,
948+ "values" : ["method1" , "method2" ],
949+ "match_type" : "strict" ,
950+ }
951+ ],
952+ },
953+ ]
954+ assert self .standart_options .span_filters == {"exclude" : expected_exclude }
912955 assert not self .standart_options .kafka_trace_correlation
913956 assert (
914957 "Binary header format for Kafka is deprecated. Please use string header format."
@@ -972,7 +1015,30 @@ def test_set_from(self) -> None:
9721015 self .standart_options .secrets_matcher == test_res_data ["secrets" ]["matcher" ]
9731016 )
9741017 assert self .standart_options .secrets_list == test_res_data ["secrets" ]["list" ]
975- assert self .standart_options .span_filters == {"exclude" : INTERNAL_SPAN_FILTERS }
1018+ # Agent filter rules are appended after the internal filters.
1019+ agent_exclude = [
1020+ {
1021+ "name" : "service1" ,
1022+ "suppression" : True ,
1023+ "attributes" : [
1024+ {"key" : "service" , "values" : ["service1" ], "match_type" : "strict" }
1025+ ],
1026+ },
1027+ {
1028+ "name" : "service2" ,
1029+ "suppression" : True ,
1030+ "attributes" : [
1031+ {
1032+ "key" : "method" ,
1033+ "values" : ["method1" , "method2" ],
1034+ "match_type" : "strict" ,
1035+ }
1036+ ],
1037+ },
1038+ ]
1039+ assert self .standart_options .span_filters == {
1040+ "exclude" : INTERNAL_SPAN_FILTERS + agent_exclude
1041+ }
9761042
9771043 test_res_data2 = {
9781044 "extraHeaders" : {"header1" : "sample-match" , "header2" : ["sample" , "list" ]},
0 commit comments