sd2k / rocket_prometheus Goto Github PK
View Code? Open in Web Editor NEWPrometheus fairing and handler for Rocket
License: Apache License 2.0
Prometheus fairing and handler for Rocket
License: Apache License 2.0
Hey!
Cool plugin! It works like a charm. Unfortunately tools like Grafana dont support old Prometheus versions as it seems.
The current API specification is prometheus 1.8 I believe. It would be nice if you would implement instant queries (i.e., Prometheus 2.14 specification) such that Grafana works :)
Cheers!
This is especially a problem when writing rocket
-tests, see this minimal working example: https://github.com/henrikhorluck/prom-test
Note that the example uses #4, but I believe the issue is still present in 0.8.0
Is there a way to exclude specific routes like metrics
to exclude from the prometheus stats?
I'm using version = "0.10.0-rc.3" and my rocket webserver will resolve /metrics but there is no data returned, even though I have sent several GET AND POST requests to my server.
rocket::build()
.attach(AdHoc::config::())
.manage(pool)
.manage(replier)
.manage(prometheus.clone())
.manage(amqp_pool)
.attach(rocket_governor::LimitHeaderGen::default())
.register("/", catchers!(rocket_governor_catcher)) // catches limit errors and produces a 429 error code
.mount("/ref", routes![refs::get,refs::patch, refs::delete, refs::post, refs::get_all])
.mount("/device", routes![device::get,device::patch, device::delete, device::post, device::get_all])
.mount("/library", routes![library::get,library::patch, library::delete, library::post, library::get_all, library::link_ref_item_to_library, library::get_ref_item_in_library])
.mount("/session", routes![session::get,session::patch, session::delete, session::post, session::get_all])
.mount("/project", routes![project::get,project::patch, project::delete, project::post, project::get_all,project::link_library_to_project, project::get_library_in_project,project::match_detections])
.mount("/metrics", prometheus)
.launch().await?;
How to write custom metrics which query data out of a database?
e.g. count of users in database as a gauge
pub fn setup_metrics() -> PrometheusMetrics {
let default_registry = prometheus::default_registry(); ‣default_registry: &Registry
PrometheusMetrics::with_registry(default_registry.clone())
}
Would you be willing to merge this upstream? or create an associated function doing the same?
The various items in the doc comments should use intra-doc links to improve the experience of browsing the docs.
it does not build with current master of rocket ;)
error[E0277]: the trait bound PrometheusMetrics: Fairing is not satisfied
--> src/main.rs:38:17
|
38 | .attach(prometheus.clone())
| ^^^^^^^^^^^^^^^^^^ the trait Fairing is not implemented for PrometheusMetrics
error[E0277]: the trait bound Vec<Route>: From<PrometheusMetrics> is not satisfied
--> src/main.rs:44:10
|
44 | .mount("/metrics", prometheus)
| ^^^^^ the trait From<PrometheusMetrics> is not implemented for Vec<Route>
|
= help: the following implementations were found:
<Vec<T> as From<&[T]>>
<Vec<T> as From<&mut [T]>>
<Vec<T> as From<BinaryHeap<T>>>
<Vec<T> as From<Box<[T]>>>
and 6 others
= note: required because of the requirements on the impl of Into<Vec<Route>> for PrometheusMetrics
sorry, i know this issue is a really early for a unstable rocket version
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.