Skip to content

Commit

Permalink
[chore] unexport DurationAsMicroseconds (open-telemetry#26565)
Browse files Browse the repository at this point in the history
Linked issue open-telemetry#26304

Signed-off-by: Jared Tan <[email protected]>
  • Loading branch information
JaredTan95 committed Sep 11, 2023
1 parent 0c216f2 commit f5d1520
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .chloggen/esexporter-checkapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: elasticsearchexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Do not export the function `DurationAsMicroseconds`

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26304]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exporter/awskinesisexporter
exporter/azuremonitorexporter
exporter/coralogixexporter
exporter/dynatraceexporter
exporter/elasticsearchexporter
exporter/f5cloudexporter
exporter/kafkaexporter
exporter/loadbalancingexporter
Expand Down
6 changes: 3 additions & 3 deletions exporter/elasticsearchexporter/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (m *encodeModel) encodeSpan(resource pcommon.Resource, span ptrace.Span) ([
document.AddAttributes("Attributes", span.Attributes())
document.AddAttributes("Resource", resource.Attributes())
document.AddEvents("Events", span.Events())
document.AddInt("Duration", DurationAsMicroseconds(span.StartTimestamp().AsTime(), span.EndTimestamp().AsTime())) // unit is microseconds
document.AddInt("Duration", durationAsMicroseconds(span.StartTimestamp().AsTime(), span.EndTimestamp().AsTime())) // unit is microseconds

if m.dedup {
document.Dedup()
Expand All @@ -102,8 +102,8 @@ func spanLinksToString(spanLinkSlice ptrace.SpanLinkSlice) string {
return string(linkArrayBytes)
}

// DurationAsMicroseconds calculate span duration through end - start nanoseconds and converts time.Time to microseconds,
// durationAsMicroseconds calculate span duration through end - start nanoseconds and converts time.Time to microseconds,
// which is the format the Duration field is stored in the Span.
func DurationAsMicroseconds(start, end time.Time) int64 {
func durationAsMicroseconds(start, end time.Time) int64 {
return (end.UnixNano() - start.UnixNano()) / 1000
}

0 comments on commit f5d1520

Please sign in to comment.