-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protobuf support #47
Protobuf support #47
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
ackintosh#1 should fix your issue @ackintosh. Let me know if that works for you. |
It works, thank you @mxinden ! |
Please ping me once this is ready for a first review @ackintosh. Thanks for the help! |
Most of what I need to implement are finished, there are small (maybe) TODO tasks though.
|
This is great news @ackintosh. Unfortunately I will be offline for a bit, thus I will likely not get to it next week :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work @ackintosh! I have a couple of high-level comments. I will take a more in-depth look.
I would like the |
This is an interesting suggestion. What do you think of moving it to https://github.com/OpenObservability/OpenMetrics/ as it concerns the whole project? |
I don't expect any breaking changes to the |
💡 I posted an issue to OpenMetrics just now: prometheus/OpenMetrics#253 |
Ahh, that makes sense. 💡 |
FYI: I'm planning that use the Protobuf support, in gossipsub-testground, in order to record metrics whose gossipsub-libp2p to InfluxDB. |
98ffcc2
to
658afbc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I took another look. What do you think of ackintosh#6?
What do you think @ackintosh? (I am sorry for leading you astray suggesting to use an |
Thank you @mxinden! It's awesome. ✨ I have merged ackintosh#6 and made some updates according to the changes in ackintosh#6. I run benchmark again in the same way, and the result was definitely good. Benchmark
Allocation count
No worries, the experiments to use an |
TODOs on this PR have been done. ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress here.
Would you mind bumping the crate version and adding a changelog entry? As far as I can tell, this does not introduce any breaking changes and could thus be released as v0.18.1
.
|
||
[dependencies] | ||
dtoa = "1.0" | ||
itoa = "1.0" | ||
parking_lot = "0.12" | ||
prometheus-client-derive-proto-encode = { version = "0.1.0", path = "derive-proto-encode", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exploring the thought on whether we could use the same derive macro for both text and protobuf. I guess we can not feature flag the generated protobuf code via #[cfg(feature = "protobuf")]
as we would not have access to the flag in the downstream user crate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is cool if we use the same derive macro, I'll do some experiments. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated but yeah, I couldn't find a way to do that.
@@ -10,14 +10,21 @@ repository = "https://github.com/prometheus/client_rust" | |||
homepage = "https://github.com/prometheus/client_rust" | |||
documentation = "https://docs.rs/prometheus-client" | |||
|
|||
[features] | |||
protobuf = ["dep:prost", "dep:prost-types", "dep:prost-build", "dep:prometheus-client-derive-proto-encode", "dep:void"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CI is currently not running with --all-features
. Can you add it with this pull request to make sure your feature is being tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 33c940a
https://github.com/prometheus/client_rust/pull/47/checks?check_run_id=8046799148
I need to rebase this branch to add Signed-off-by lines. |
* build(deps): update dtoa requirement from 0.4 to 1.0 Updates the requirements on [dtoa](https://github.com/dtolnay/dtoa) to permit the latest version. - [Release notes](https://github.com/dtolnay/dtoa/releases) - [Commits](dtolnay/dtoa@0.4.0...1.0.1) --- updated-dependencies: - dependency-name: dtoa dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * src/encoding/text: Adjust to breaking changes in dtoa Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Inden <mail@max-inden.de> Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
…s#79) Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
…eus#78) Before `proemtheus-client` would use the `owning_ref` crate to map the target of a `std::sync::RwLockReadGuard`. `owning_ref` has multiple unsoundness issues, see https://rustsec.org/advisories/RUSTSEC-2022-0040.html. Instead of replacing `owning_ref` with a similar crate, we switch to locking via `parking_lot` which supports the above mapping natively. Signed-off-by: Max Inden <mail@max-inden.de>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
void is used in only encoding/proto. Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
bcf5567
to
33c940a
Compare
# Conflicts: # .github/workflows/rust.yml # CHANGELOG.md # Cargo.toml # src/metrics/gauge.rs
|
Hmm, I noticed that the commit history was broken due to the rebasing... sorry. I'll create another pull request and close this. 🙇 |
I have created #83 |
Closes #46
This PR adds protobuf support to the client, which provides functionality to encode metrics to an instance of the OpenMetrics protobuf format.
📝 Todos
.proto
files (noted below)derive-text-encode
Integration test on lighthouseFYI: I'm working to use this Protobuf support, in sigp/gossipsub-testground#4, in order to record metrics whose gossipsub-libp2p to InfluxDB.
(Edit: Resolved) How to manage the dependencies of
.proto
filesThis PR introduces a
openmetrics_data_model.proto
file dependency. We can get the file from here.For now, I've copied the .proto file manually and added it to git. However, I think that is not good as it could happen operational errors. So we need to consider how to manage the .proto file.
openmetrics_data_model.proto
file should be pushed to BSR, which is a proto file registry.build.rs
build.rs
.I couldn't find another way, I think2. Download the proto file via build.rs
is good.Edit: I changed my mind, manually coping is suitable: #47 (comment)