monitoring: move aggregator config to separate option
Created by: bobheadxi
Another just-for-fun cleanup as I re-read some of this code for a thing I'm writing - the alert aggregator configuration is unused in the vast majority of cases. This change moves aggregator configuration to a separate function, and provides typed options that can be used. Makes for a much cleaner API.
New usage:
- monitoring.Alert().GreaterOrEqual(1, monitoring.StringPtr("sum"))
+ monitoring.Alert().GreaterOrEqual(1).AggregateBy(monitoring.AggregatorSum)
Without custom aggregator (the default case):
- monitoring.Alert().GreaterOrEqual(1, nil)
+ monitoring.Alert().GreaterOrEqual(1)
Test plan
go generate ./monitoring/...