def get_custom_distribution_metadata(product_name) -> List[CustomDistributionMeta]: """Get metadata for reconstructing custom distribution buckets in Glean metrics.""" # GleanPing.get_repos -> List[Tuple[name: str, app_id: str]] glean = GleanPing(product_name) probes = glean.get_probes() custom = [] for probe in probes: if probe.get_type() != "custom_distribution": continue meta = CustomDistributionMeta( probe.get_name(), probe.get("range_min"), probe.get("range_max"), probe.get("bucket_count"), probe.get("histogram_type"), ) custom.append(meta) return custom
def _get_glean_metrics(self, v1_name: Optional[str]) -> List[GleanProbe]: if v1_name is None: logging.error( f"Error: Missing v1 name for ping {self.name} in namespace {self.namespace}" ) return [] repo = next((r for r in GleanPing.get_repos() if r["name"] == v1_name)) glean_app = GleanPing(repo) ping_probes = [] probe_ids = set() for probe in glean_app.get_probes(): if self.name not in probe.definition["send_in_pings"]: continue if probe.id in probe_ids: # Some ids are duplicated, ignore them continue ping_probes.append(probe) probe_ids.add(probe.id) return ping_probes