Skip to content

Commit

Permalink
Cleanup usage of TimestampUnixNanos and its API (open-telemetry#2549)
Browse files Browse the repository at this point in the history
Updates open-telemetry/opentelemetry-collector#2488

Important Changes:

* Rename pdata.TimestampUnixNanos to pdata.Timestamp
* Remove pdata.TimestampUnixNanos and helpers, move them of the pdata.Timestamp type.
* Fix bug around IsZero, this function should return true if the time is January 1, year 1, 00:00:00 UTC not epoch.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Feb 25, 2021
1 parent 52decc7 commit 7686de0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion log.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

var (
TestLogTime = time.Date(2020, 2, 11, 20, 26, 13, 789, time.UTC)
TestLogTimestamp = pdata.TimestampUnixNano(TestLogTime.UnixNano())
TestLogTimestamp = pdata.TimestampFromTime(TestLogTime)
)

func GenerateLogDataEmpty() pdata.Logs {
Expand Down
6 changes: 3 additions & 3 deletions metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (

var (
TestMetricStartTime = time.Date(2020, 2, 11, 20, 26, 12, 321, time.UTC)
TestMetricStartTimestamp = pdata.TimestampUnixNano(TestMetricStartTime.UnixNano())
TestMetricStartTimestamp = pdata.TimestampFromTime(TestMetricStartTime)

TestMetricExemplarTime = time.Date(2020, 2, 11, 20, 26, 13, 123, time.UTC)
TestMetricExemplarTimestamp = pdata.TimestampUnixNano(TestMetricExemplarTime.UnixNano())
TestMetricExemplarTimestamp = pdata.TimestampFromTime(TestMetricExemplarTime)

TestMetricTime = time.Date(2020, 2, 11, 20, 26, 13, 789, time.UTC)
TestMetricTimestamp = pdata.TimestampUnixNano(TestMetricTime.UnixNano())
TestMetricTimestamp = pdata.TimestampFromTime(TestMetricTime)
)

const (
Expand Down
6 changes: 3 additions & 3 deletions trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (

var (
TestSpanStartTime = time.Date(2020, 2, 11, 20, 26, 12, 321, time.UTC)
TestSpanStartTimestamp = pdata.TimestampUnixNano(TestSpanStartTime.UnixNano())
TestSpanStartTimestamp = pdata.TimestampFromTime(TestSpanStartTime)

TestSpanEventTime = time.Date(2020, 2, 11, 20, 26, 13, 123, time.UTC)
TestSpanEventTimestamp = pdata.TimestampUnixNano(TestSpanEventTime.UnixNano())
TestSpanEventTimestamp = pdata.TimestampFromTime(TestSpanEventTime)

TestSpanEndTime = time.Date(2020, 2, 11, 20, 26, 13, 789, time.UTC)
TestSpanEndTimestamp = pdata.TimestampUnixNano(TestSpanEndTime.UnixNano())
TestSpanEndTimestamp = pdata.TimestampFromTime(TestSpanEndTime)
)

func GenerateTraceDataEmpty() pdata.Traces {
Expand Down

0 comments on commit 7686de0

Please sign in to comment.