chore: add vmalert_remotewrite_total metric (#2040)

Co-authored-by: Andrey Afoninsky <andrey.afoninsky@booking.com>
This commit is contained in:
Andrey Afoninsky 2022-01-07 15:15:34 +01:00 committed by GitHub
parent e47385d34a
commit 77bfa8181d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -356,6 +356,7 @@ var (
execErrors = metrics.NewCounter(`vmalert_execution_errors_total`)
remoteWriteErrors = metrics.NewCounter(`vmalert_remotewrite_errors_total`)
remoteWriteTotal = metrics.NewCounter(`vmalert_remotewrite_total`)
)
func (e *executor) exec(ctx context.Context, rule Rule, resolveDuration time.Duration) error {
@ -369,6 +370,7 @@ func (e *executor) exec(ctx context.Context, rule Rule, resolveDuration time.Dur
if len(tss) > 0 && e.rw != nil {
for _, ts := range tss {
remoteWriteTotal.Inc()
if err := e.rw.Push(ts); err != nil {
remoteWriteErrors.Inc()
return fmt.Errorf("rule %q: remote write failure: %w", rule, err)