poc4 wit rust
This commit is contained in:
+65
-16
@@ -238,22 +238,71 @@ class PrometheusMetrics:
|
||||
if self.flow_tracker is None:
|
||||
return
|
||||
status = self.flow_tracker.status()
|
||||
for key in ("active_flows", "max_flows", "update_interval_seconds"):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_flow_tracker_{_metric_name(key)}",
|
||||
status[key],
|
||||
metric_type="gauge",
|
||||
)
|
||||
for key in ("published_updates", "evicted_flows", "parse_errors", "throughput_samples"):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_flow_tracker_{_metric_name(key)}_total",
|
||||
status[key],
|
||||
metric_type="counter",
|
||||
)
|
||||
is_rust = str(status.get("engine") or "").lower() == "rust"
|
||||
if is_rust:
|
||||
self._emit(
|
||||
lines,
|
||||
"mikrosuricata_tzsp_receiver_info",
|
||||
1,
|
||||
metric_type="gauge",
|
||||
help_text="TZSP packet data-plane implementation.",
|
||||
labels={"engine": "rust"},
|
||||
)
|
||||
for key in (
|
||||
"rcvbuf_bytes",
|
||||
"batch_size",
|
||||
"datagram_bytes",
|
||||
"queue_capacity_batches",
|
||||
"queue_capacity_bytes",
|
||||
"queue_depth_batches",
|
||||
"queue_high_water_batches",
|
||||
"capture_efficiency_pct",
|
||||
"rx_thread_alive",
|
||||
"worker_thread_alive",
|
||||
"telemetry_age_ms",
|
||||
"process_alive",
|
||||
"ready",
|
||||
):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_tzsp_receiver_{_metric_name(key)}",
|
||||
status[key],
|
||||
metric_type="gauge",
|
||||
)
|
||||
for key in (
|
||||
"kernel_udp_drops",
|
||||
"queue_dropped_datagrams",
|
||||
"truncated_datagrams",
|
||||
"tzsp_datagrams",
|
||||
"tzsp_rx_bytes",
|
||||
"rx_batches",
|
||||
"telemetry_errors",
|
||||
):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_tzsp_receiver_{_metric_name(key)}_total",
|
||||
status[key],
|
||||
metric_type="counter",
|
||||
)
|
||||
else:
|
||||
for key in ("active_flows", "max_flows", "update_interval_seconds"):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_flow_tracker_{_metric_name(key)}",
|
||||
status[key],
|
||||
metric_type="gauge",
|
||||
)
|
||||
for key in ("published_updates", "evicted_flows", "parse_errors", "throughput_samples"):
|
||||
if key in status and _number(status[key]) is not None:
|
||||
self._emit(
|
||||
lines,
|
||||
f"mikrosuricata_flow_tracker_{_metric_name(key)}_total",
|
||||
status[key],
|
||||
metric_type="counter",
|
||||
)
|
||||
|
||||
traffic = status.get("traffic_counters") or {}
|
||||
if not isinstance(traffic, Mapping):
|
||||
|
||||
Reference in New Issue
Block a user