Skip to content

Commit 625fff2

Browse files
jkohenbitcharmer
authored andcommitted
Set user agent in stackdriver output (influxdata#5901)
1 parent 8131aee commit 625fff2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins/outputs/stackdriver/stackdriver.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import (
1212
monitoring "cloud.google.com/go/monitoring/apiv3" // Imports the Stackdriver Monitoring client package.
1313
googlepb "github.com/golang/protobuf/ptypes/timestamp"
1414
"github.com/influxdata/telegraf"
15+
"github.com/influxdata/telegraf/internal"
1516
"github.com/influxdata/telegraf/plugins/outputs"
17+
"google.golang.org/api/option"
1618
metricpb "google.golang.org/genproto/googleapis/api/metric"
1719
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
1820
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
@@ -88,7 +90,7 @@ func (s *Stackdriver) Connect() error {
8890

8991
if s.client == nil {
9092
ctx := context.Background()
91-
client, err := monitoring.NewMetricClient(ctx)
93+
client, err := monitoring.NewMetricClient(ctx, option.WithUserAgent(internal.ProductToken()))
9294
if err != nil {
9395
return err
9496
}

0 commit comments

Comments
 (0)