Skip to content

Commit 1b75d9f

Browse files
committed
feat: attempts
1 parent 86c59b0 commit 1b75d9f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "init4-bin-base"
44
description = "Internal utilities for binaries produced by the init4 team"
55
keywords = ["init4", "bin", "base"]
66

7-
version = "0.14.1"
7+
version = "0.15.0"
88
edition = "2021"
99
rust-version = "1.85"
1010
authors = ["init4", "James Prestwich", "evalir"]
@@ -16,8 +16,8 @@ repository = "https://github.com/init4tech/bin-base"
1616
init4-from-env-derive = "0.1.0"
1717

1818
# Signet
19-
signet-constants = { version = "0.11.1" }
20-
signet-tx-cache = { version = "0.11.1", optional = true }
19+
signet-constants = { version = "0.13" }
20+
signet-tx-cache = { version = "0.13", optional = true }
2121

2222
# alloy
2323
alloy = { version = "1.0.35", optional = true, default-features = false, features = ["std", "signer-local", "consensus", "network"] }

src/perms/middleware.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ use tower::{Layer, Service};
2424
use tracing::info;
2525
use tracing_opentelemetry::OpenTelemetrySpanExt;
2626

27+
const ATTEMPTS: &str = "init4.perms.attempts";
28+
const ATTEMPTS_DESCR: &str = "Counts the number of builder permissioning attempts";
29+
2730
const MISSING_HEADER: &str = "init4.perms.missing_header";
2831
const MISSING_HEADER_DESCR: &str =
2932
"Counts the number of requests missing the authentication header";
@@ -36,6 +39,7 @@ const SUCCESS: &str = "init4.perms.success";
3639
const SUCCESS_DESCR: &str = "Counts the number of auths allowed due to builder permissioning";
3740

3841
static DESCRIBE: LazyLock<()> = LazyLock::new(|| {
42+
describe_counter!(ATTEMPTS, ATTEMPTS_DESCR);
3943
describe_counter!(MISSING_HEADER, MISSING_HEADER_DESCR);
4044
describe_counter!(PERMISSION_DENIED, PERMISSION_DENIED_DESCR);
4145
describe_counter!(SUCCESS, SUCCESS_DESCR);
@@ -199,6 +203,8 @@ where
199203

200204
let guard = span.enter();
201205

206+
counter!(ATTEMPTS).increment(1);
207+
202208
// Check if the sub is in the header.
203209
let sub = match validate_header_sub(req.headers().get("x-jwt-claim-sub")) {
204210
Ok(sub) => sub,

0 commit comments

Comments
 (0)