(thread_id: int)
| 2323 | f'{P2P_RECV_PROM_METRIC_MESSAGES_TOTAL}' |
| 2324 | f'{{metric="{P2P_RECV_PROM_METRIC_RECV_COMPLETED}"}}' |
| 2325 | ), |
| 2326 | start_s=start_s, |
| 2327 | end_s=end_s, |
| 2328 | step="5s", |
| 2329 | ) |
| 2330 | except Exception as exc: |
| 2331 | logger.warning(f"⚠️ 收集 p2p_receive_transport_summary 失败: {exc}") |
| 2332 | return {"error": str(exc)} |
| 2333 | |
| 2334 | matched_label_pairs: Dict[Tuple[str, str], float] = {} |
| 2335 | matched_series_count = 0 |
| 2336 | for series in discovery_series: |
| 2337 | labels = _prometheus_series_labels(series) |
| 2338 | node_label = labels.get("node", "") |
| 2339 | role_label = labels.get("role", "") |
| 2340 | if not node_label or not role_label: |
| 2341 | continue |
| 2342 | if not _prometheus_node_label_matches_target(node_label, target): |
| 2343 | continue |
| 2344 | delta = _prometheus_series_delta(series) |
| 2345 | if delta <= 0.0: |
| 2346 | continue |
| 2347 | matched_series_count += 1 |
| 2348 | key = (node_label, role_label) |
| 2349 | matched_label_pairs[key] = matched_label_pairs.get(key, 0.0) + delta |
| 2350 | |
| 2351 | def _query_total(component_label: str, metric_label: str, metric_name: str) -> float: |
| 2352 | total = 0.0 |
| 2353 | for node_label, role_label in matched_label_pairs.keys(): |
| 2354 | promql = ( |
nothing calls this directly
no test coverage detected