Skip to content

Commit edec6dc

Browse files
MasterPtatoNathanFlurry
authored andcommitted
chore: fix guard metrics
1 parent 1eac431 commit edec6dc

File tree

3 files changed

+33
-30
lines changed

3 files changed

+33
-30
lines changed

packages/edge/infra/edge-server/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ s3-util.workspace = true
2626
edge-monolith-workflow-worker.workspace = true
2727
pegboard-ws.workspace = true
2828

29+
# Singleton
30+
pegboard-usage-metrics-publish.workspace = true
31+
2932
# API
3033
api-edge-monolith-public.workspace = true
3134
api-edge-monolith-edge.workspace = true

packages/edge/infra/guard/core/src/proxy_service.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@ impl ProxyService {
680680
self.handle_http_request(req, target).await
681681
};
682682

683+
let status = match &res {
684+
Ok(resp) => resp.status().as_u16().to_string(),
685+
Err(_) => "error".to_string(),
686+
};
687+
683688
// Record metrics
684689
let duration_secs = start_time.elapsed().as_secs_f64();
685690
metrics::PROXY_REQUEST_DURATION
@@ -691,16 +696,11 @@ impl ProxyService {
691696
res
692697
};
693698

694-
let status = match &res {
695-
Ok(resp) => resp.status().as_u16().to_string(),
696-
Err(err) => {
697-
metrics::PROXY_REQUEST_ERROR
698-
.with_label_values(&[&err.to_string()])
699-
.inc();
700-
701-
"error".to_string()
702-
}
703-
};
699+
if let Err(err) = &res {
700+
metrics::PROXY_REQUEST_ERROR
701+
.with_label_values(&[&err.to_string()])
702+
.inc();
703+
}
704704

705705
res
706706
}

packages/edge/infra/guard/server/Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@ name = "rivet_guard"
1414
path = "src/lib.rs"
1515

1616
[dependencies]
17-
rivet-guard-core.workspace = true
18-
tokio.workspace = true
1917
anyhow.workspace = true
20-
tracing.workspace = true
21-
uuid = { version = "1.3", features = ["v4"] }
22-
serde_json = "1.0"
18+
chirp-client.workspace = true
19+
chirp-workflow.workspace = true
2320
clap = { version = "4.3", features = ["derive"] }
24-
rivet-config.workspace = true
25-
rivet-logs.workspace = true
26-
rivet-runtime.workspace = true
27-
rivet-pools.workspace = true
28-
rivet-metrics.workspace = true
21+
cluster.workspace = true
22+
fdb-util.workspace = true
23+
foundationdb.workspace = true
2924
futures = "0.3.30"
25+
game-namespace-resolve-name-id = { path = "../../../../core/services/game/ops/namespace-resolve-name-id" }
3026
global-error.workspace = true
31-
cluster.workspace = true
32-
chirp-workflow.workspace = true
33-
chirp-client.workspace = true
34-
rivet-connection.workspace = true
35-
regex = "1.10.3"
3627
once_cell = "1.19.0"
3728
pegboard.workspace = true
38-
fdb-util.workspace = true
39-
foundationdb.workspace = true
40-
rustls-pemfile = "2.0.0"
41-
rustls = { version = "0.23.25" }
29+
regex = "1.10.3"
4230
rivet-cache.workspace = true
31+
rivet-config.workspace = true
32+
rivet-connection.workspace = true
33+
rivet-guard-core.workspace = true
34+
rivet-logs.workspace = true
35+
rivet-metrics.workspace = true
36+
rivet-pools.workspace = true
37+
rivet-runtime.workspace = true
4338
route = { path = "../../../../core/services/route" }
44-
game-namespace-resolve-name-id = { path = "../../../../core/services/game/ops/namespace-resolve-name-id" }
39+
rustls = { version = "0.23.25" }
40+
rustls-pemfile = "2.0.0"
41+
serde_json = "1.0"
42+
tokio.workspace = true
43+
tracing.workspace = true
4544
types-proto = { path = "../../../../common/types-proto/core", package = "types-proto" }
45+
uuid = { version = "1.3", features = ["v4"] }
4646

4747
[dev-dependencies]
4848
uuid = { version = "1.3", features = ["v4", "fast-rng"] }

0 commit comments

Comments
 (0)