NagyZoltanPeter 36ee2aa9bf chore: non-relay protocols cross performance measurement metrics (#3299)
* Introducing new non-relay protocol request handling time metric
2025-03-31 13:27:51 +02:00

23 lines
801 B
Nim

{.push raises: [].}
import std/options
import metrics, setting
declarePublicGauge waku_service_requests_limit,
"Applied rate limit of non-relay service", ["service"]
declarePublicCounter waku_service_requests,
"number of non-relay service requests received", ["service", "state"]
declarePublicCounter waku_service_network_bytes,
"total incoming traffic of specific waku services", labels = ["service", "direction"]
proc setServiceLimitMetric*(service: string, limit: Option[RateLimitSetting]) =
if limit.isSome() and not limit.get().isUnlimited():
waku_service_requests_limit.set(
limit.get().calculateLimitPerSecond(), labelValues = [service]
)
declarePublicHistogram waku_service_request_handling_duration_seconds,
"duration of non-relay service handling", ["service"]