@@ -624,7 +624,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
624624 default_result_type = "rate" ,
625625 ),
626626 SnQLFunction (
627- "count " ,
627+ "count_sample " ,
628628 optional_args = [
629629 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
630630 ],
@@ -638,14 +638,14 @@ def function_converter(self) -> dict[str, SnQLFunction]:
638638 default_result_type = "integer" ,
639639 ),
640640 SnQLFunction (
641- "sum " ,
641+ "sum_sample " ,
642642 required_args = [NumericColumn ("column" , spans = True )],
643643 snql_aggregate = self ._resolve_aggregate_if ("sum" ),
644644 result_type_fn = self .reflective_result_type (),
645645 default_result_type = "duration" ,
646646 ),
647647 SnQLFunction (
648- "avg " ,
648+ "avg_sample " ,
649649 optional_args = [
650650 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
651651 ],
@@ -655,7 +655,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
655655 redundant_grouping = True ,
656656 ),
657657 SnQLFunction (
658- "p50 " ,
658+ "p50_sample " ,
659659 optional_args = [
660660 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
661661 ],
@@ -665,7 +665,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
665665 redundant_grouping = True ,
666666 ),
667667 SnQLFunction (
668- "p75 " ,
668+ "p75_sample " ,
669669 optional_args = [
670670 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
671671 ],
@@ -675,7 +675,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
675675 redundant_grouping = True ,
676676 ),
677677 SnQLFunction (
678- "p90 " ,
678+ "p90_sample " ,
679679 optional_args = [
680680 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
681681 ],
@@ -685,7 +685,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
685685 redundant_grouping = True ,
686686 ),
687687 SnQLFunction (
688- "p95 " ,
688+ "p95_sample " ,
689689 optional_args = [
690690 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
691691 ],
@@ -695,7 +695,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
695695 redundant_grouping = True ,
696696 ),
697697 SnQLFunction (
698- "p99 " ,
698+ "p99_sample " ,
699699 optional_args = [
700700 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
701701 ],
@@ -705,7 +705,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
705705 redundant_grouping = True ,
706706 ),
707707 SnQLFunction (
708- "p100 " ,
708+ "p100_sample " ,
709709 optional_args = [
710710 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
711711 ],
@@ -731,28 +731,22 @@ def function_converter(self) -> dict[str, SnQLFunction]:
731731 redundant_grouping = True ,
732732 ),
733733 SnQLFunction (
734- "count_weighted " ,
734+ "count " ,
735735 optional_args = [
736736 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
737737 ],
738738 snql_aggregate = self ._resolve_count_weighted ,
739739 default_result_type = "integer" ,
740740 ),
741741 SnQLFunction (
742- "count_unique_weighted" ,
743- required_args = [ColumnTagArg ("column" )],
744- snql_aggregate = self ._resolve_aggregate_if ("uniq" ),
745- default_result_type = "integer" ,
746- ),
747- SnQLFunction (
748- "sum_weighted" ,
742+ "sum" ,
749743 required_args = [NumericColumn ("column" , spans = True )],
750744 result_type_fn = self .reflective_result_type (),
751745 snql_aggregate = lambda args , alias : self ._resolve_sum_weighted (args , alias ),
752746 default_result_type = "duration" ,
753747 ),
754748 SnQLFunction (
755- "avg_weighted " ,
749+ "avg " ,
756750 required_args = [NumericColumn ("column" , spans = True )],
757751 result_type_fn = self .reflective_result_type (),
758752 snql_aggregate = lambda args , alias : Function (
@@ -766,7 +760,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
766760 default_result_type = "duration" ,
767761 ),
768762 SnQLFunction (
769- "percentile_weighted " ,
763+ "percentile " ,
770764 required_args = [
771765 NumericColumn ("column" , spans = True ),
772766 NumberRange ("percentile" , 0 , 1 ),
@@ -777,7 +771,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
777771 redundant_grouping = True ,
778772 ),
779773 SnQLFunction (
780- "p50_weighted " ,
774+ "p50 " ,
781775 optional_args = [
782776 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
783777 ],
@@ -789,7 +783,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
789783 redundant_grouping = True ,
790784 ),
791785 SnQLFunction (
792- "p75_weighted " ,
786+ "p75 " ,
793787 optional_args = [
794788 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
795789 ],
@@ -801,7 +795,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
801795 redundant_grouping = True ,
802796 ),
803797 SnQLFunction (
804- "p90_weighted " ,
798+ "p90 " ,
805799 optional_args = [
806800 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
807801 ],
@@ -813,7 +807,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
813807 redundant_grouping = True ,
814808 ),
815809 SnQLFunction (
816- "p95_weighted " ,
810+ "p95 " ,
817811 optional_args = [
818812 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
819813 ],
@@ -825,7 +819,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
825819 redundant_grouping = True ,
826820 ),
827821 SnQLFunction (
828- "p99_weighted " ,
822+ "p99 " ,
829823 optional_args = [
830824 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
831825 ],
@@ -837,7 +831,7 @@ def function_converter(self) -> dict[str, SnQLFunction]:
837831 redundant_grouping = True ,
838832 ),
839833 SnQLFunction (
840- "p100_weighted " ,
834+ "p100 " ,
841835 optional_args = [
842836 with_default ("span.duration" , NumericColumn ("column" , spans = True )),
843837 ],
@@ -848,23 +842,6 @@ def function_converter(self) -> dict[str, SnQLFunction]:
848842 default_result_type = "duration" ,
849843 redundant_grouping = True ,
850844 ),
851- # Min and Max are identical to their existing implementations
852- SnQLFunction (
853- "min_weighted" ,
854- required_args = [NumericColumn ("column" , spans = True )],
855- snql_aggregate = self ._resolve_aggregate_if ("min" ),
856- result_type_fn = self .reflective_result_type (),
857- default_result_type = "duration" ,
858- redundant_grouping = True ,
859- ),
860- SnQLFunction (
861- "max_weighted" ,
862- required_args = [NumericColumn ("column" , spans = True )],
863- snql_aggregate = self ._resolve_aggregate_if ("max" ),
864- result_type_fn = self .reflective_result_type (),
865- default_result_type = "duration" ,
866- redundant_grouping = True ,
867- ),
868845 SnQLFunction (
869846 "margin_of_error" ,
870847 optional_args = [with_default ("fpc" , SnQLStringArg ("fpc" ))],
@@ -1060,14 +1037,14 @@ def _query_total_counts(self) -> tuple[float | int, float | int]:
10601037 dataset = self .builder .dataset ,
10611038 params = {},
10621039 snuba_params = self .builder .params ,
1063- selected_columns = ["count ()" , "count_weighted ()" ],
1040+ selected_columns = ["count_sample ()" , "count ()" ],
10641041 )
10651042 total_results = total_query .run_query (Referrer .API_SPANS_TOTAL_COUNT_FIELD .value )
10661043 results = total_query .process_results (total_results )
10671044 if len (results ["data" ]) != 1 :
10681045 raise Exception ("Could not query population size" )
1069- self ._cached_count = results ["data" ][0 ]["count " ]
1070- self ._cached_count_weighted = results ["data" ][0 ]["count_weighted " ]
1046+ self ._cached_count = results ["data" ][0 ]["count_sample " ]
1047+ self ._cached_count_weighted = results ["data" ][0 ]["count " ]
10711048 return self ._cached_count , self ._cached_count_weighted
10721049
10731050 @cached_property
0 commit comments