MCPcopy Index your code
hub / github.com/tanelpoder/0xtools / _build_histogram_select

Method _build_histogram_select

xtop/core/query_builder.py:826–837  ·  view source on GitHub ↗

Build histogram aggregation in SELECT

(self, prefix: str)

Source from the content-addressed store, hash-verified

824 return f"SELECT\n {select_parts_sql}"
825
826 def _build_histogram_select(self, prefix: str) -> str:
827 """Build histogram aggregation in SELECT"""
828 # Build the histogram aggregation using STRING_AGG
829 bucket_col = f"{prefix}_lat_bkt_us"
830 histogram_agg = f"""STRING_AGG(
831 {prefix}_bc.{bucket_col}::VARCHAR || ':' ||
832 {prefix}_bc.cnt::VARCHAR || ':' ||
833 {prefix}_bc.est_time_s::VARCHAR || ':' ||
834 {prefix}_bc.{prefix}_global_max_time::VARCHAR,
835 ',' ORDER BY {prefix}_bc.{bucket_col}
836 ) AS {prefix}lat_histogram"""
837 return histogram_agg
838
839 def _build_latency_metric(self, prefix: str, metric: str, has_histogram: bool = False) -> str:
840 """Build latency metric calculation

Callers 1

_build_final_selectMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected