Skip to content

Commit

Permalink
actix-web-prom 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dejankos committed Sep 15, 2020
1 parent dc0ad0d commit b505149
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ authors = ["dkos <kosdejan@yahoo.com>"]
edition = "2018"
categories = ["http", "rocksdb", "storage", "actix-web"]
description = "RocksDb as a service with support for multiple databases and record expiration"
exclude = [".gitignore", "docs/**"]

[dependencies]
structopt = "0.3"
actix-web = "3"
actix-web-prom = "0.3.0"
actix-web-prom = "0.5.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
simplelog = "0.7.6"
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can delete data with a ```DELETE``` request on ```SERVICE_URL:SERVICE_PORT/{
A successful request is indicated by a ```200 OK``` HTTP status code.

### Metrics
Service metrics in [prometheus format](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md) are available for scraping under ```SERVICE_URL:SERVICE_PORT/metrics```
Service metrics in [prometheus format](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md) are available for scraping under ```SERVICE_URL:SERVICE_PORT/rocky/prometheus/metrics```

## Configuration

Expand Down Expand Up @@ -116,12 +116,6 @@ Payload: 1kb
![Delete latency](docs/delete_latency.png?raw=true "Delete latency")
![Delete tps](docs/delete_tps.png?raw=true "Delete tps")







### TODO
- [ ] fix running test in parallel (TODO per test db root path)
- [ ] db iterator for on startup init
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ async fn main() -> std::io::Result<()> {
let db_manager = DbManager::new(db_cfg)?;
let db_manager = web::Data::new(db_manager);

let _prometheus = init_prometheus();
let prometheus = init_prometheus();
HttpServer::new(move || {
App::new()
.wrap(ErrorHandlers::new().handler(http::StatusCode::NOT_FOUND, not_found))
// .wrap(prometheus.clone()) // TODO waiting 3.0 upgrade
.wrap(prometheus.clone())
.app_data(db_manager.clone())
.service(open)
.service(close)
Expand All @@ -211,7 +211,7 @@ async fn main() -> std::io::Result<()> {
}

fn init_prometheus() -> PrometheusMetrics {
PrometheusMetrics::new("api", Some("/metrics"), None)
PrometheusMetrics::new("api", Some("/rocky/prometheus/metrics"), None)
}

fn init_logger(log_path: &str, dev_mode: bool) {
Expand Down

0 comments on commit b505149

Please sign in to comment.