Skip to content

[receiver/splunkhecreceiver] timestamp accepts nano, micro, milli, and seconds #38637

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

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

timannguyen
Copy link
Contributor

…d seconds

Description

Splunk HEC accepts nano, micro, milli, and sec. It will now guess the time before converting it to nanoseconds. to prevent overflow.

Link to tracking issue

Fixes 36571

Testing

unit test

Documentation

https://docs.splunk.com/Documentation/SplunkCloud/latest/Data/FormateventsforHTTPEventCollector#Event_metadata

Copy link
Contributor

@VihasMakwana VihasMakwana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but can you update PR description?

@splunkericl

This comment was marked as resolved.

Copy link
Contributor

@dehaansa dehaansa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a bugfix changelog entry.

As the other commenter noted, this should also be fixed in the splunkhec_to_metricdata.go file, otherwise this appears to be a valuable fix, thanks for the contribution.

func convertTimestamp(sec float64) pcommon.Timestamp {
return pcommon.Timestamp(sec * 1e9)
/*
Splunk HEC timestamps can be in nanoseconds, microseconds, milliseconds, and seconds epoch.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you happen to have a documentation link for this statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timannguyen
Copy link
Contributor Author

@splunkericl

This comment was marked as resolved.

@atoulme
Copy link
Contributor

atoulme commented Mar 17, 2025

Please add a changelog entry, start by executing make chlog-new from root of the checkout and fill in the yaml file. Please move this PR as ready to review afterwards.

@atoulme atoulme marked this pull request as draft March 17, 2025 22:17
@timannguyen
Copy link
Contributor Author

Please add a changelog entry, start by executing make chlog-new from root of the checkout and fill in the yaml file. Please move this PR as ready to review afterwards.

My bad. done

@timannguyen timannguyen marked this pull request as ready for review March 18, 2025 14:24
@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label Mar 18, 2025
@atoulme atoulme merged commit ac7c359 into open-telemetry:main Mar 18, 2025
179 of 180 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 18, 2025
Fiery-Fenix pushed a commit to Fiery-Fenix/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
…d seconds (open-telemetry#38637)

…d seconds

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Splunk HEC accepts nano, micro, milli, and sec. It will now guess the
time before converting it to nanoseconds. to prevent overflow.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
[36571](open-telemetry#36571)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

unit test

<!--Describe the documentation added.-->
#### Documentation


https://docs.splunk.com/Documentation/SplunkCloud/latest/Data/FormateventsforHTTPEventCollector#Event_metadata

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Antoine Toulme <[email protected]>
hapatel-splunk pushed a commit to hapatel-splunk/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
…d seconds (open-telemetry#38637)

…d seconds

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Splunk HEC accepts nano, micro, milli, and sec. It will now guess the
time before converting it to nanoseconds. to prevent overflow.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
[36571](open-telemetry#36571)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

unit test

<!--Describe the documentation added.-->
#### Documentation


https://docs.splunk.com/Documentation/SplunkCloud/latest/Data/FormateventsforHTTPEventCollector#Event_metadata

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Antoine Toulme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/splunkhec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/splunkhecreceiver] timestamp overflows when not in seconds
6 participants