Comments (5)
Anyone working on this? I would like to contribute as my project depend heavily on this.
from rust-prometheus.
As far as I know there is no-one working on this @jiacai2050. Before you do, would you mind describing your use-case?
This crate supports local metrics via the local module which operates on non-thread-synchronized memory, thus bypassing the performance cost of atomic operations, eventually being flushed back to their global thread-synchronized counterparts.
I am not aware of a use-case that can not be achieved with the local module, but only with the currently missing idea of metrics local to a given core or thread.
from rust-prometheus.
@jiacai2050 I think you can try with thread local metrics + static metrics. According to our experiments this is already very efficient, although theoretically core-local is even better than thread local :)
from rust-prometheus.
@mxinden @breeswish Thanks for your suggestion.
local module is useful for when update metric in for-loop
, but what I want is thread-local metrics update in its own thread, and only flush when prometheus scrapes.
AFAIK, thread-local metrics is better than core-local which requires flush when return from functions.
I will check what @breeswish mentions, see if it will meet my requirements.
from rust-prometheus.
@jiacai2050 The current implementation of the thread local metrics provided by this crate is an auto-flush one. Every time you update a thread local metric, the thread local last update time is checked, and then the thread local metric is synced to the global one if specified interval is elapsed. For both public Push and Pull interfaces, the value in the global one is used.
This kind of thread local metric avoids frequently updating a global shared memory, i.e. reduces contention to improve performance. It is mostly useful if you update your metrics very frequently in multiple threads (e.g. 1000 times per sec, updated by multiple worker threads).
Static metrics macros in this crate is another story. Normally when you use metrics with labels (i.e. metrics vectors), the label needs to be put or retrieve from a HashMap in runtime. However, in many scenarios the metric labels are deterministic and known at compile time. Static metrics macros help you define these static metrics easily, in a way similar to normal metric vectors, without the need to write many boilerplates. It saves HashMap lookup cost.
The two techniques (static metrics and thread-local metrics) can be used together to achieve the best performance this crate offers.
from rust-prometheus.
Related Issues (20)
- Emit metrics sorted by the "natural" ordering of their label values
- Add `HistogramVec::with_label_values` HOT 2
- Using a prefixed registry, valid metric names are incorrectly marked as invalid
- Dose histogram support merge operation?
- U64 and U128 Guage Types HOT 7
- Question: can arguments for .with_label_values() be returned from the function?
- Allow for merging of Text outputs
- Can the collector be mutable?
- Duplicate metrics
- Support for multiprocess statistics
- Feedback on experimental tokio runtime metrics support
- Need to add timestamp in data series before reporting to prometheus
- Is there a way to cleanup older metrics stored? HOT 1
- Registering the same metric multiple times HOT 1
- Support LocalIntGauge.
- Arbitrary headers for `push_metrics`
- Gathering empty MetricFamily HOT 1
- Add a Cargo optional feature to replace `std::time::Instant` with `tikv/minstant::Instant` HOT 1
- LabelPair PartialOrd inconsistent with PartialEq
- Metric Persistance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-prometheus.