Comments (7)
I tried using
()
as the label set for a family, likeFamily<(), Histogram, ...>
.
What is your reasoning for not using a plain Histogram
?
from client_rust.
I've built a small wrapping library around client_rust
for internal use at my job, to streamline and standardize our usage. Basically I'm not using a plain Histogram as this is using some generic code which allows you to use any label type you want. I figured that in the case you didn't want any labels, you could just use ()
- but that turned out not to work 😅
from client_rust.
One solution could be to only add a ,
here in case the previous label has a length larger than 0
.
client_rust/src/encoding/text.rs
Lines 277 to 285 in 6b7a345
from client_rust.
Tangentially related, but I noticed that &str
also implements encode - does that assume that you must have the &str
be equal to "label_name=\"label_value\"
? I'm assuming that if you just set it equal to "foobar"
then prometheus will complain that the label has no value (must labels have values?).
But yea that might be one solution I suppose. Alternatively, maybe it should be the responsibility of the Encode
implementation to insert the comma?
from client_rust.
Tangentially related, but I noticed that
&str
also implements encode - does that assume that you must have the&str
be equal to"label_name=\"label_value\"
? I'm assuming that if you just set it equal to"foobar"
then prometheus will complain that the label has no value (must labels have values?).
That assumption is correct.
But yea that might be one solution I suppose. Alternatively, maybe it should be the responsibility of the
Encode
implementation to insert the comma?
That would as well be a viable solution.
from client_rust.
I honestly find it a bit surprising that &str
implements Encode
in that case. I guess it's the same with f32
and the other primitives that implement Encode
. encode
should at least return Err
when it doesn't match the expected format, I would say.
I feel like (&str, &str)
should implement Encode
but not &str
. Currently the tuple impl requires the items to also implement Encode
- maybe it should just implement Encode
for (K, V)
where K: Display, V: Display
?
from client_rust.
I agree. Today I am using Encode
to encode the following:
- Label pair
- Label key
- Label value
- Metric value
Each of these use-cases should probably use their own EncodeXXX
trait instead of a single shared one.
from client_rust.
Related Issues (20)
- Allow flattening of a struct through derive(EncodeLabelSet) at any position HOT 2
- Make `Descriptor::new` `const` HOT 1
- feat: derive register logic on struct of metrics
- Allow multiple labels in sub_registry_with_label method HOT 2
- Allow root registry creation with prefix AND label(s) HOT 1
- Implement native histograms HOT 1
- Escaping? HOT 3
- Public encoding functions? HOT 4
- Encoder without EOF HOT 5
- Custom Collector with `sub_registry_with_prefix` outputs name multiple times HOT 3
- Abstract key lookup into a trait for Family::get_or_create HOT 4
- Allow iterating the metrics on an registry HOT 1
- Allow construct a histogram family with a closure HOT 2
- mips: EncodeCounterValue implementation missing for u32?
- Histogram with empty family labels creates unparseable metrics output HOT 1
- text::DescriptorEncoder writes incorrect metric names HOT 2
- UTF-8: Implement support in Rust client library
- Implement Atomic for usize HOT 2
- Counter `HELP` and `TYPE` lack `_total` suffix HOT 5
- Provide a way to prevent unbounded metric growth HOT 3
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 client_rust.