diff --git a/functions/r2-pump/main.go b/functions/r2-pump/main.go index 5bdce6e..6681cc2 100644 --- a/functions/r2-pump/main.go +++ b/functions/r2-pump/main.go @@ -133,7 +133,7 @@ func Invoke(ctx context.Context, e gcp.GCSEvent) error { if err := audit.WroteR2(ctx, pkgName, version, keys, FILE_EXTENSION); err != nil { log.Printf("failed to audit: %s\n", err) } - if err := metrics.NewUpdatePublishedR2(); err != nil { + if err := metrics.NewUpdatePublishedR2(FILE_EXTENSION); err != nil { return errors.Wrap(err, "could not report metrics") } diff --git a/metrics/metrics.go b/metrics/metrics.go index c2404c9..15ca109 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -19,36 +19,42 @@ var ( ) type IncMetricPayload struct { - Name string `json:"name"` + Name string `json:"name"` + Labels []string `json:"labels"` } func NewUpdateDetected() error { return sendMetrics(&IncMetricPayload{ - Name: "new_update_detected", + Name: "new_update_detected", + Labels: make([]string, 0), }) } func NewUpdateProccessed() error { return sendMetrics(&IncMetricPayload{ - Name: "new_update_processed", + Name: "new_update_processed", + Labels: make([]string, 0), }) } func NewUpdatePublishedKV() error { return sendMetrics(&IncMetricPayload{ - Name: "new_update_published_kv", + Name: "new_update_published_kv", + Labels: make([]string, 0), }) } -func NewUpdatePublishedR2() error { +func NewUpdatePublishedR2(ext string) error { return sendMetrics(&IncMetricPayload{ - Name: "new_update_published_r2", + Name: "new_update_published_r2", + Labels: []string{ext}, }) } func NewUpdatePublishedAlgolia() error { return sendMetrics(&IncMetricPayload{ - Name: "new_update_published_algolia", + Name: "new_update_published_algolia", + Labels: make([]string, 0), }) }