-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add OC to OTLP translation functions #546
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,10 @@ func TimeToTimestamp(t time.Time) *timestamp.Timestamp { | |
Nanos: int32(nanoTime % 1e9), | ||
} | ||
} | ||
|
||
func TimestampToTime(ts *timestamp.Timestamp) (t time.Time) { | ||
if ts == nil { | ||
return | ||
} | ||
return time.Unix(ts.Seconds, int64(ts.Nanos)) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is quite useful in many places. I think we should have a package to deal with timestamps in general as I've seen this and very similar function scattered across packages in this and contrib repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved this from Jaeger translation code. This can be now reused everywhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Later we should move it out of internal so contrib can also use it, a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we making this private temporarily to prevent usage before this is ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one of the reasons. The other is that I may keep it private and require certain modifications to go through functions. It will become clearer in future PRs. Let's keep it private for now.