Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard way to convert from time.Time to proto Timestamp #2548

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion exporter/carbonexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"go.opentelemetry.io/collector/testutil/metricstestutil"
"go.opentelemetry.io/collector/translator/internaldata"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/timestamppb"
)

func TestNew(t *testing.T) {
Expand Down Expand Up @@ -299,7 +300,7 @@ func generateLargeBatch() pdata.Metrics {
time.Now(),
[]string{"v0", "v1"},
&metricspb.Point{
Timestamp: metricstestutil.Timestamp(ts),
Timestamp: timestamppb.New(ts),
Value: &metricspb.Point_Int64Value{Int64Value: int64(i)},
},
),
Expand Down
1 change: 1 addition & 0 deletions exporter/carbonexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ require (
go.opentelemetry.io/collector v0.21.1-0.20210303005052-9c476019fc0f
go.uber.org/zap v1.16.0
google.golang.org/grpc/examples v0.0.0-20200728194956-1c32b02682df // indirect
google.golang.org/protobuf v1.25.0
)
3 changes: 2 additions & 1 deletion exporter/carbonexporter/metricdata_to_plaintext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/testutil/metricstestutil"
"go.opentelemetry.io/collector/translator/internaldata"
"google.golang.org/protobuf/types/known/timestamppb"
)

func Test_sanitizeTagKey(t *testing.T) {
Expand Down Expand Up @@ -154,7 +155,7 @@ func Test_metricDataToPlaintext(t *testing.T) {
int64Val := int64(123)
expectedInt64ValStr := "123"
int64Pt := &metricspb.Point{
Timestamp: metricstestutil.Timestamp(tsUnix),
Timestamp: timestamppb.New(tsUnix),
Value: &metricspb.Point_Int64Value{Int64Value: int64Val},
}

Expand Down
3 changes: 2 additions & 1 deletion exporter/splunkhecexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"go.opentelemetry.io/collector/translator/conventions"
"go.opentelemetry.io/collector/translator/internaldata"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
)
Expand Down Expand Up @@ -181,7 +182,7 @@ func generateLargeBatch() internaldata.MetricsData {
time.Now(),
[]string{"v0", "v1"},
&metricspb.Point{
Timestamp: metricstestutil.Timestamp(ts),
Timestamp: timestamppb.New(ts),
Value: &metricspb.Point_Int64Value{Int64Value: int64(i)},
},
),
Expand Down
1 change: 1 addition & 0 deletions exporter/splunkhecexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
go.opentelemetry.io/collector v0.21.1-0.20210303005052-9c476019fc0f
go.uber.org/zap v1.16.0
google.golang.org/grpc/examples v0.0.0-20200728194956-1c32b02682df // indirect
google.golang.org/protobuf v1.25.0

)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"go.opentelemetry.io/collector/testutil/metricstestutil"
"go.opentelemetry.io/collector/translator/internaldata"
"google.golang.org/protobuf/types/known/timestamppb"
)

// GenerateDummyMetrics generates two dummy metrics
Expand All @@ -46,7 +47,7 @@ func createGaugeIntMetric(i int) *metricspb.Metric {
time.Now(),
[]string{"label_value_0", "label_value_1"},
&metricspb.Point{
Timestamp: metricstestutil.Timestamp(ts),
Timestamp: timestamppb.New(ts),
Value: &metricspb.Point_Int64Value{Int64Value: int64(i)},
},
),
Expand Down
1 change: 1 addition & 0 deletions receiver/awsecscontainermetricsreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ require (
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.21.1-0.20210303005052-9c476019fc0f
go.uber.org/zap v1.16.0
google.golang.org/protobuf v1.25.0
)