@@ -3594,6 +3594,58 @@ def test_avg_span_self_time(self):
3594
3594
assert len (data ) == 1
3595
3595
assert data [0 ]["avg(span.self_time)" ] == 3.2
3596
3596
3597
+ def test_span_module_filter (self ):
3598
+ self .store_span_metric (
3599
+ 1 ,
3600
+ timestamp = self .min_ago ,
3601
+ tags = {"span.category" : "db" , "span.op" : "db.redis" },
3602
+ )
3603
+ self .store_span_metric (
3604
+ 4 ,
3605
+ timestamp = self .min_ago ,
3606
+ tags = {"span.category" : "cache" },
3607
+ )
3608
+ self .store_span_metric (
3609
+ 4 ,
3610
+ timestamp = self .min_ago ,
3611
+ tags = {"span.category" : "db" , "span.op" : "db.sql.room" },
3612
+ )
3613
+ self .store_span_metric (
3614
+ 2 ,
3615
+ timestamp = self .min_ago ,
3616
+ tags = {"span.category" : "db" },
3617
+ )
3618
+ self .store_span_metric (
3619
+ 3 ,
3620
+ timestamp = self .min_ago ,
3621
+ tags = {"span.category" : "http" },
3622
+ )
3623
+
3624
+ response = self .do_request (
3625
+ {
3626
+ "field" : [
3627
+ "span.description" ,
3628
+ "span.module" ,
3629
+ "avg(span.self_time)" ,
3630
+ ],
3631
+ "orderby" : "avg(span.self_time)" ,
3632
+ "query" : "span.module:[db, cache, other]" ,
3633
+ "project" : self .project .id ,
3634
+ "dataset" : "metrics" ,
3635
+ }
3636
+ )
3637
+
3638
+ assert response .status_code == 200 , response .content
3639
+ data = response .data ["data" ]
3640
+ assert len (data ) == 3
3641
+
3642
+ assert data [0 ]["span.module" ] == "db"
3643
+ assert data [0 ]["avg(span.self_time)" ] == 2
3644
+ assert data [1 ]["span.module" ] == "cache"
3645
+ assert data [1 ]["avg(span.self_time)" ] == 2.5
3646
+ assert data [2 ]["span.module" ] == "other"
3647
+ assert data [2 ]["avg(span.self_time)" ] == 4
3648
+
3597
3649
3598
3650
class OrganizationEventsMetricsEnhancedPerformanceEndpointTestWithOnDemandMetrics (
3599
3651
MetricsEnhancedPerformanceTestCase
@@ -4094,3 +4146,7 @@ def test_http_response_rate(self):
4094
4146
@pytest .mark .xfail (reason = "Not implemented" )
4095
4147
def test_avg_span_self_time (self ):
4096
4148
super ().test_avg_span_self_time ()
4149
+
4150
+ @pytest .mark .xfail (reason = "Not implemented" )
4151
+ def test_span_module_filter (self ):
4152
+ super ().test_span_module_filter ()
0 commit comments