From b0145808563c3d58255aeef7c32d45e372647960 Mon Sep 17 00:00:00 2001 From: Julien Levesy Date: Sun, 7 Apr 2024 11:53:39 +0200 Subject: [PATCH] feat(timeseries): add a new cloudmonitoring target --- timeseries/targets.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/timeseries/targets.go b/timeseries/targets.go index 700f5e63..66663e4a 100644 --- a/timeseries/targets.go +++ b/timeseries/targets.go @@ -1,6 +1,7 @@ package timeseries import ( + "github.com/K-Phoen/grabana/target/cloudmonitoring" "github.com/K-Phoen/grabana/target/graphite" "github.com/K-Phoen/grabana/target/influxdb" "github.com/K-Phoen/grabana/target/loki" @@ -61,6 +62,14 @@ func WithStackdriverTarget(target *stackdriver.Stackdriver) Option { } } +// WithCloudMonitoringTarget adds a cloud monitoring query to the graph. +func WithCloudMonitoringTarget(target cloudmonitoring.Target) Option { + return func(graph *TimeSeries) error { + graph.Builder.AddTarget(target.Target()) + return nil + } +} + // WithLokiTarget adds a loki query to the graph. func WithLokiTarget(query string, options ...loki.Option) Option { target := loki.New(query, options...)