Skip to content

[receiver/splunkhec] HEC metrics accepts empty string Event #38585

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 4 commits into from
Mar 14, 2025

Conversation

timannguyen
Copy link
Contributor

Description

Splunk HEC metrics accepts metrics when "event": "". This aligns with Splunk HEC behavior

Link to tracking issue

Fixes 38464

Testing

Unit tests

Documentation

@atoulme
Copy link
Contributor

atoulme commented Mar 12, 2025

Please add a changelog. make chlog-new will create a template for this.

@@ -66,7 +66,7 @@ type Event struct {

// IsMetric returns true if the Splunk event is a metric.
func (e *Event) IsMetric() bool {
return e.Event == HecEventMetricType || (e.Event == nil && len(e.GetMetricValues()) > 0)
return e.Event == HecEventMetricType || ((e.Event == nil || e.Event == "") && len(e.GetMetricValues()) > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you test against splunk if this is the correct check? I was told: As tested out, the event field is optional. When presented, it can also be any string and does not have to be of value metric. A possible way of updating this would be to change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Testing it out and Splunk is only checking if the event has metric_name to determine it as a metrics. Any string in event or the absent of event does not change its type if it has at least one metric_name:* field.

let me update this

@atoulme atoulme merged commit b8218ac into open-telemetry:main Mar 14, 2025
171 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 14, 2025
hapatel-splunk pushed a commit to hapatel-splunk/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
…emetry#38585)

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

Splunk HEC metrics accepts metrics when `"event": ""`. This aligns with
Splunk HEC behavior

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

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

Unit tests

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

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[receiver/splunkhec] Metrics ingestion behavior is not consistent with Splunk Cloud/Enterprise
4 participants