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

Use histogram metrics for Scores in Bazarr Exporter #239

Open
rtrox opened this issue Oct 30, 2023 · 2 comments
Open

Use histogram metrics for Scores in Bazarr Exporter #239

rtrox opened this issue Oct 30, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@rtrox
Copy link
Collaborator

rtrox commented Oct 30, 2023

Details

What steps did you take and what happened:

While working on some other things, I noticed this -- right now we're exporting counts of episodes/movies by score -- like other *arrs, score is a percentage indication of certainty, and at least in bazarr, it has 2 decimals of precision. This means cardinality for this label could theoretically hit 10k.

Graphing this metric is likely to be done via pie chart / bar distribution, which means a quantile a) bounds cardinality to bucket count, and b) is actually a bit better representation of this type of value anyway.

Additional Information

Prometheus Quantiles: https://prometheus.io/docs/practices/histograms/
MustNewConstHistogram: https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#MustNewConstHistogram
Example Usage: https://github.com/prometheus/client_golang/blob/main/prometheus/examples_test.go#L440-L446 (note: bucket labels are an inclusive upper bound)

Reference

// just shove them into episode stats to avoid extra looping
if len(movieStats.scores) > 0 {
for score, count := range movieStats.scores {
episodeStats.scores[score] += count
}
}
if len(episodeStats.scores) > 0 {
for score, count := range episodeStats.scores {
ch <- prometheus.MustNewConstMetric(collector.subtitlesScoreMetric, prometheus.GaugeValue, float64(count),
score,
)
}
}

@rtrox rtrox added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 30, 2023
@rtrox
Copy link
Collaborator Author

rtrox commented Oct 30, 2023

Dropping this here for now. This will technically be a breaking change, but given how new the bazarr collector is, I doubt we have more than a few folks graphing it. I'd like to get this in somewhat quickly to keep it that way.

Marking help wanted as (again) I don't actually have a bazarr instance to test with, but I'm off this week, so if this isn't picked up quickly, I'll spin up a test instance later this week and make this change.

@codefaux
Copy link

codefaux commented May 9, 2024

I run Bazaar (every exporter you implement actually) and am willing to help however I can, but I'm unable to glean your ask from the messaging here. If you still desire a test platform, let me know how I can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants