autometrics-dev / autometrics-go

Easily add metrics to your system -- and actually understand them using automatically customized Prometheus queries
https://autometrics.dev
Apache License 2.0
142 stars 9 forks source link

Make the generator fail if it uses unsupported latencies/objectives #25

Closed gagbo closed 1 year ago

gagbo commented 1 year ago

A "supported" latency is a latency target that exists in the buckets of the function_call_duration histogram. If the latency used in the autometrics directive is not exactly one of the bucket values of the histogram, then the latency alert will never trigger.

In the same vein, a "supported" objective target is a percentage that exists in the bundled configs/autometrics.rules.yaml file. Support to create custom objective targets might be added later (using Sloth binary and types to generate a matching rules file with custom objectives, like the Rust version does), but for the time being, if the objective latency percentile/success rate is not one of the precompile rules file, then the latency/success rate alert will never trigger.

The autometricsGeneratorContext should be augmented with the supported value sets for each arguments, so that it can use the Validate method to bail out and error if users try to use the generator with unsupported latencies/objectives