Skip to content
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
30 changes: 30 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions oxanus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sentry = ["sentry-core"]
tracing-instrument = []
macros = ["oxanus-macros"]
registry = ["inventory", "oxanus-macros?/registry"]
prometheus = ["prometheus-client"]

[dependencies]
async-trait = "0.1"
Expand All @@ -29,6 +30,7 @@ redis = { version = "^1.0", features = ["aio", "tokio-comp"] }
futures = { version = "^0.3" }
gethostname = "^1.0"
inventory = { version = "0.3", optional = true }
prometheus-client = { version = "0.24", optional = true }
sentry-core = { version = "^0.46", optional = true }
serde = { version = "^1.0.218", features = ["derive"] }
serde_json = { version = "^1.0", features = ["preserve_order"] }
Expand Down
10 changes: 10 additions & 0 deletions oxanus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ Configuration is done through the [`Config`] builder, which allows you to:
Oxanus uses a custom error type [`OxanusError`] that covers all possible error cases in the library.
Workers can define their own error type that implements `std::error::Error`.

### Prometheus Metrics

Enable the `prometheus` feature to expose metrics:

```rust
let metrics = storage.metrics().await?;
let output = metrics.encode_to_string()?;
// Serve `output` on your metrics endpoint
```

4 changes: 4 additions & 0 deletions oxanus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ mod launcher;
mod queue;
mod result_collector;
mod semaphores_map;
mod stats;
mod storage;
mod storage_builder;
mod storage_internal;
Expand All @@ -99,6 +100,9 @@ mod worker_registry;
#[cfg(feature = "registry")]
mod registry;

#[cfg(feature = "prometheus")]
pub mod prometheus;

#[cfg(test)]
mod test_helper;

Expand Down
Loading