Skip to content
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

JSON output as prometheus metric format? #1403

Open
Ekleog opened this issue Jan 15, 2025 · 2 comments · May be fixed by #1404
Open

JSON output as prometheus metric format? #1403

Ekleog opened this issue Jan 15, 2025 · 2 comments · May be fixed by #1404
Labels
A-config Area: Related to the config file functionality and format C-enhancement Category: New feature or request good first issue Call for participation: Good for newcomers

Comments

@Ekleog
Copy link

Ekleog commented Jan 15, 2025

Hey!

I've been using rustic for a bit, and I recently submitted [a module for easily using it to NixOS](https://github.com/NixOS/ nixpkgs/pull/373042) (my personal distribution of choice).

As part of it, I added one thing useful at least to me: parsing the JSON output of --json and turning it into prometheus metrics that could then be exported via the node-exporter.

But upon thinking about it some more I'm curious: are you interested in upstreaming this work, so that rustic could gain a --prometheus flag that'd output the result as prometheus metrics, rather than raw JSON?

TBH the JSON currently output is not very nice to work with, eg. because parsing times (esp. when TZ is not UTC) is hard — hence the hacks used in the NixOS module's script to work around it.

WDYT?

Anyway, thank you for all you're doing with rustic!

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Jan 15, 2025
@aawsome
Copy link
Member

aawsome commented Jan 19, 2025

Hi @Ekleog, thanks for opening this issue!

I agree that better prometheus support can be a good addition to rustic. IMO for the rustic CLI we should try to support prometheus push gateway. I had just a quick view into available crates, but it seem that prometheus crate is widely used and supports this via the push feature.

About the metrics: @Ekleog Can you please specify a list which metrics you would send to the push gateway?

Is there anyone willing to start a PR?

@aawsome aawsome added C-enhancement Category: New feature or request good first issue Call for participation: Good for newcomers A-config Area: Related to the config file functionality and format and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Jan 19, 2025
@Ekleog
Copy link
Author

Ekleog commented Jan 20, 2025

I just opened #1404 ; hopefully it makes it more obvious which exact metrics I'd like to send to the pushgateway!

It's basically all the (numeric, as prometheus only allows numeric metrics) metrics exposed by the JSON output, with timestamps encoded, as prometheus expects, as an f64.

WDYT about it? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config Area: Related to the config file functionality and format C-enhancement Category: New feature or request good first issue Call for participation: Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants