Skip to content

refactor!: make global core optional, add derive macro, add MetricsGroup and MetricsGroupSet traits, reoganize modules #15

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 36 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
81c9d9f
WIP demo
Arqu Feb 28, 2025
beabbe3
wip: Metric sets
Frando Apr 4, 2025
1048571
fix: usage with global core is possible too
Frando Apr 4, 2025
7edb783
feat: add MetricExt to keep existing method
Frando Apr 8, 2025
25d74c9
refactor: reorganize and make static core optional
Frando Apr 8, 2025
ee151a1
cleanups
Frando Apr 8, 2025
aa3745f
cleanup
Frando Apr 8, 2025
737f192
fix: doctest
Frando Apr 8, 2025
57485e0
fix: feature flags in tests
Frando Apr 8, 2025
9ecdf6b
chore: clippy
Frando Apr 8, 2025
83b0335
cleanup
Frando Apr 9, 2025
edca9eb
refactor: rename traits
Frando Apr 9, 2025
fabc660
fixup
Frando Apr 9, 2025
04b9c4f
chore: minor fixes
Frando Apr 9, 2025
2fd1c06
chore: make cargo-deny happy
Frando Apr 9, 2025
c0a4f39
feat: add MetricsGroup::values
Frando Apr 9, 2025
b7f521f
feat: add ValuesIter
Frando Apr 9, 2025
fe1a49d
chore: clippy
Frando Apr 9, 2025
242341d
chore: remove leftover
Frando Apr 10, 2025
554efac
feat: MetricsGroup derive
Frando Apr 10, 2025
e61cf8f
feat: drop struct_iterable
Frando Apr 10, 2025
07b43fd
chore: fix
Frando Apr 10, 2025
2c2eaab
chore: fix edition
Frando Apr 10, 2025
e15ab47
improve derive macro
Frando Apr 10, 2025
df64227
docs and cleanups
Frando Apr 11, 2025
7d3af42
streamline APIs
Frando Apr 11, 2025
4f10df0
fix: imports for no features
Frando Apr 11, 2025
8bbcea5
feat: add metrics description attribute
Frando Apr 11, 2025
357d542
fix: make MetricValue non-exhaustive
Frando Apr 11, 2025
3507bf0
chore: Cargo.toml
Frando Apr 11, 2025
7ddd198
rename: description -> help
Frando Apr 11, 2025
a1a6e10
docs: docstring fixes
Frando Apr 14, 2025
b98b9c5
chore: fmt
Frando Apr 14, 2025
ff4ac2a
docs: fixes
Frando Apr 14, 2025
e590998
fix: cleanup `metrics` feature flag usage (#20)
Frando Apr 14, 2025
3098da0
Merge remote-tracking branch 'origin/main' into Frando/refactor
Frando Apr 14, 2025
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
87 changes: 29 additions & 58 deletions Cargo.lock

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

13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
members = ["iroh-metrics-derive"]

[package]
name = "iroh-metrics"
version = "0.32.0"
Expand Down Expand Up @@ -27,22 +30,26 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
unused-async = "warn"

[dependencies]
erased_set = "0.8"
serde = { version = "1", features = ["derive"] }
struct_iterable = "0.1"
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 }

# service feature
http-body-util = { version = "0.1.0", optional = true }
hyper = { version = "1", features = ["server", "http1"], optional = true }
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" }

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

Expand All @@ -64,6 +71,8 @@ service = [
"dep:reqwest",
"dep:tokio",
]
# Enables a global, static metrics collector
static_core = ["metrics", "dep:erased_set"]

[package.metadata.docs.rs]
all-features = true
1 change: 0 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ allow = [
"BSL-1.0", # BOSL license
"ISC",
"MIT",
"OpenSSL",
"Zlib",
"MPL-2.0", # https://fossa.com/blog/open-source-software-licenses-101-mozilla-public-license-2-0/
"Unicode-3.0",
Expand Down
17 changes: 17 additions & 0 deletions iroh-metrics-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "iroh-metrics-derive"
version = "0.1.0"
edition = "2021"
description = "derive macros for iroh-metrics"
license = "MIT OR Apache-2.0"
authors = ["Frando <[email protected]>", "n0 team"]
repository = "https://github.com/n0-computer/iroh-metrics"

[lib]
proc-macro = true

[dependencies]
heck = "0.5"
proc-macro2 = "1"
quote = "1"
syn = "2"
Loading
Loading