-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new gauge to help dasboard effectively show current rate li…
…mit applied for protocol
- Loading branch information
1 parent
a25c0d4
commit fa46148
Showing
7 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
{.push raises: [].} | ||
|
||
import metrics | ||
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] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,5 +154,5 @@ proc new*( | |
) | ||
|
||
store.initProtocolHandler() | ||
|
||
setServiceLimitMetric(WakuStoreCodec, rateLimitSetting) | ||
return store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters