-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[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
Conversation
Please add a changelog. |
internal/splunk/common.go
Outdated
@@ -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) |
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.
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
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.
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
…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.-->
Description
Splunk HEC metrics accepts metrics when
"event": ""
. This aligns with Splunk HEC behaviorLink to tracking issue
Fixes 38464
Testing
Unit tests
Documentation