fix(guard): add more tokio runtime metrics, remove labels from metrics#2485
Closed
MasterPtato wants to merge 1 commit into
Conversation
Contributor
Author
There was a problem hiding this comment.
PR Summary
This PR enhances Tokio runtime observability while simplifying guard service metrics to reduce cardinality.
- Added
TOKIO_TASK_TOTALandTOKIO_ACTIVE_TASK_COUNTmetrics inpackages/common/runtime/src/metrics.rsfor tracking task lifecycle - Removed actor_id, server_id, method, and path labels from
PROXY_REQUEST_TOTALandPROXY_REQUEST_PENDINGinpackages/edge/infra/guard/core/src/metrics.rs - Simplified
PROXY_REQUEST_DURATIONto only track status label - Added error tracking via
PROXY_REQUEST_ERRORwith error_type label - Configured Tokio runtime builder to collect new task metrics in
packages/common/runtime/src/lib.rs
4 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
Comment on lines
+688
to
+699
| metrics::PROXY_REQUEST_ERROR | ||
| .with_label_values(&[&err.to_string()]) | ||
| .inc(); |
There was a problem hiding this comment.
style: Consider using structured error types instead of error.to_string() to avoid high cardinality in error labels
Comment on lines
+662
to
+663
| metrics::PROXY_REQUEST_PENDING.inc(); | ||
|
|
||
| metrics::PROXY_REQUEST_TOTAL | ||
| .with_label_values(&[&actor_id_str, &server_id_str, method_str, &path]) | ||
| .inc(); | ||
| metrics::PROXY_REQUEST_TOTAL.inc(); |
There was a problem hiding this comment.
logic: Metrics incremented before error handling - could lead to inaccurate counts if subsequent operations fail
Deploying rivet with
|
| Latest commit: |
0bf9b0a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f83682c1.rivet.pages.dev |
| Branch Preview URL: | https://05-28-fix-guard-add-more-tok.rivet.pages.dev |
fca464f to
ce70387
Compare
Deploying rivet-studio with
|
| Latest commit: |
0bf9b0a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9b699cf3.rivet-studio.pages.dev |
| Branch Preview URL: | https://05-28-fix-guard-add-more-tok.rivet-studio.pages.dev |
Closed
Deploying rivet-hub with
|
| Latest commit: |
0bf9b0a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://255bbf9c.rivet-hub-7jb.pages.dev |
| Branch Preview URL: | https://05-28-fix-guard-add-more-tok.rivet-hub-7jb.pages.dev |
fcd1624 to
d958baa
Compare
ce70387 to
08138ed
Compare
d958baa to
4134605
Compare
08138ed to
f6d2ad5
Compare
4134605 to
d958baa
Compare
f6d2ad5 to
08138ed
Compare
d958baa to
4134605
Compare
08138ed to
f6d2ad5
Compare
4134605 to
d958baa
Compare
f6d2ad5 to
08138ed
Compare
d958baa to
4134605
Compare
08138ed to
f6d2ad5
Compare
4134605 to
6caa5bf
Compare
f6d2ad5 to
0bf9b0a
Compare
This was referenced Jun 3, 2025
Closed
This was referenced Jun 9, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Changes