@@ -29,13 +29,13 @@ import (
2929 "time"
3030
3131 "cloud.google.com/go/compute/metadata"
32- monitoring "cloud.google.com/go/monitoring/apiv3"
33- metrics "github. com/armon/go-metrics "
34- googlepb "github.com/golang/protobuf/ptypes/timestamp "
32+ monitoring "cloud.google.com/go/monitoring/apiv3/v2 "
33+ "cloud.google. com/go/monitoring/apiv3/v2/monitoringpb "
34+ metrics "github.com/hashicorp/go-metrics "
3535 distributionpb "google.golang.org/genproto/googleapis/api/distribution"
3636 metricpb "google.golang.org/genproto/googleapis/api/metric"
3737 monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
38- monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3 "
38+ "google.golang.org/protobuf/types/known/timestamppb "
3939)
4040
4141// Logger is the log interface used in go-metrics-stackdriver
@@ -371,12 +371,8 @@ func (s *Sink) report(ctx context.Context) {
371371 Points : []* monitoringpb.Point {
372372 {
373373 Interval : & monitoringpb.TimeInterval {
374- StartTime : & googlepb.Timestamp {
375- Seconds : v .startTime .Unix (),
376- },
377- EndTime : & googlepb.Timestamp {
378- Seconds : end .Unix (),
379- },
374+ StartTime : timestamppb .New (v .startTime ),
375+ EndTime : timestamppb .New (end ),
380376 },
381377 Value : & monitoringpb.TypedValue {
382378 Value : & monitoringpb.TypedValue_DoubleValue {
@@ -407,9 +403,7 @@ func (s *Sink) report(ctx context.Context) {
407403 Points : []* monitoringpb.Point {
408404 {
409405 Interval : & monitoringpb.TimeInterval {
410- EndTime : & googlepb.Timestamp {
411- Seconds : end .Unix (),
412- },
406+ EndTime : timestamppb .New (end ),
413407 },
414408 Value : & monitoringpb.TypedValue {
415409 Value : & monitoringpb.TypedValue_DoubleValue {
@@ -447,12 +441,8 @@ func (s *Sink) report(ctx context.Context) {
447441 Points : []* monitoringpb.Point {
448442 {
449443 Interval : & monitoringpb.TimeInterval {
450- StartTime : & googlepb.Timestamp {
451- Seconds : s .firstTime .Unix (),
452- },
453- EndTime : & googlepb.Timestamp {
454- Seconds : end .Unix (),
455- },
444+ StartTime : timestamppb .New (s .firstTime ),
445+ EndTime : timestamppb .New (end ),
456446 },
457447 Value : & monitoringpb.TypedValue {
458448 Value : & monitoringpb.TypedValue_DistributionValue {
0 commit comments