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...)