Skip to content

Commit

Permalink
fix: migrate to cloud.google.com/go/monitoring/apiv3/v2 (#9880)
Browse files Browse the repository at this point in the history
(cherry picked from commit 15753a6)
  • Loading branch information
sspaink authored and reimda committed Oct 7, 2021
1 parent dfc1c5d commit 144f20a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugins/inputs/stackdriver/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sync"
"time"

monitoring "cloud.google.com/go/monitoring/apiv3"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
googlepbduration "github.com/golang/protobuf/ptypes/duration"
googlepbts "github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf"
Expand Down Expand Up @@ -397,7 +397,7 @@ func (s *Stackdriver) newTimeSeriesConf(
StartTime: &googlepbts.Timestamp{Seconds: startTime.Unix()},
}
tsReq := &monitoringpb.ListTimeSeriesRequest{
Name: monitoring.MetricProjectPath(s.Project),
Name: fmt.Sprintf("projects/%s", s.Project),
Filter: filter,
Interval: interval,
}
Expand Down Expand Up @@ -533,7 +533,7 @@ func (s *Stackdriver) generatetimeSeriesConfs(

ret := []*timeSeriesConf{}
req := &monitoringpb.ListMetricDescriptorsRequest{
Name: monitoring.MetricProjectPath(s.Project),
Name: fmt.Sprintf("projects/%s", s.Project),
}

filters := s.newListMetricDescriptorsFilters()
Expand Down
4 changes: 2 additions & 2 deletions plugins/outputs/stackdriver/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sort"
"strings"

monitoring "cloud.google.com/go/monitoring/apiv3" // Imports the Stackdriver Monitoring client package.
monitoring "cloud.google.com/go/monitoring/apiv3/v2" // Imports the Stackdriver Monitoring client package.
googlepb "github.com/golang/protobuf/ptypes/timestamp"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
Expand Down Expand Up @@ -218,7 +218,7 @@ func (s *Stackdriver) Write(metrics []telegraf.Metric) error {

// Prepare time series request.
timeSeriesRequest := &monitoringpb.CreateTimeSeriesRequest{
Name: monitoring.MetricProjectPath(s.Project),
Name: fmt.Sprintf("projects/%s", s.Project),
TimeSeries: timeSeries,
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/outputs/stackdriver/stackdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

monitoring "cloud.google.com/go/monitoring/apiv3"
monitoring "cloud.google.com/go/monitoring/apiv3/v2"
"github.com/golang/protobuf/proto"
emptypb "github.com/golang/protobuf/ptypes/empty"
googlepb "github.com/golang/protobuf/ptypes/timestamp"
Expand Down

0 comments on commit 144f20a

Please sign in to comment.