Skip to content

refactor!: Make metrics raw atomics, remove prometheus_client dependency #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
with:
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: mozilla-actions/[email protected].7
- uses: mozilla-actions/[email protected].9
- uses: taiki-e/install-action@cargo-make
- run: cargo make format-check

Expand All @@ -206,7 +206,7 @@ jobs:
with:
toolchain: nightly-2024-11-30
- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- name: Docs
run: cargo doc --workspace --all-features --no-deps --document-private-items
Expand All @@ -225,7 +225,7 @@ jobs:
with:
components: clippy
- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

# TODO: We have a bunch of platform-dependent code so should
# probably run this job on the full platform matrix
Expand All @@ -252,7 +252,7 @@ jobs:
with:
toolchain: ${{ env.MSRV }}
- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- name: Check MSRV all features
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
toolchain: nightly-2024-11-30
- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- name: Generate Docs
run: cargo doc --workspace --all-features --no-deps
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
tool: nextest

- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- name: Select features
run: |
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
}

- name: Install sccache
uses: mozilla-actions/[email protected].7
uses: mozilla-actions/[email protected].9

- uses: msys2/setup-msys2@v2

Expand Down
161 changes: 94 additions & 67 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 5 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
unused-async = "warn"

[dependencies]
serde = { version = "1", features = ["derive"] }
iroh-metrics-derive = { path = "./iroh-metrics-derive", version = "0.1.0" }
itoa = "1"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for faster int to string encoding (prometheus_client used it for that purpose, thought it wouldn't hurt here either)

serde = { version = "1", features = ["derive", "rc"] }
thiserror = "2.0.6"
tracing = "0.1"

# metrics feature
prometheus-client = { version = "0.22", optional = true }

# static_core feature
erased_set = { version = "0.8", optional = true }

Expand All @@ -47,19 +46,15 @@ hyper-util = { version = "0.1.1", features = ["tokio"], optional = true }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"], optional = true }
tokio = { version = "1", features = ["rt", "net", "fs"], optional = true }

# derive feature
iroh-metrics-derive = { path = "./iroh-metrics-derive", version = "0.1.0" }

[dev-dependencies]
postcard = { version = "1.1.1", features = ["use-std"] }
tokio = { version = "1", features = ["io-util", "sync", "rt", "net", "fs", "macros", "time", "test-util"] }

[features]
default = ["metrics"]
# Enables counters and other metrics being tracked.
# If disabled, all counters return 0. Macros like `inc!` will do nothing.
metrics = [
"dep:prometheus-client",
]
metrics = []
# Enables functionality to run a local metrics server that current metrics
# are served at in prometheus format.
# Pulls in quite a few libraries to make exposing an HTTP server possible.
Expand Down
Loading
Loading