-
Notifications
You must be signed in to change notification settings - Fork 2.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
[processor/attributes] validate metrics configuration parameters before processing #37435
base: main
Are you sure you want to change the base?
Conversation
…re processing Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
a501483
to
47af88a
Compare
if len(mp.MetricNames) > 0 { | ||
return errors.New("metric_names should not be specified for trace spans") | ||
} | ||
|
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.
According to the documentation, metric_names
should be allowed only for metrics
@@ -176,7 +182,7 @@ func (mp *MatchProperties) ValidateForSpans() error { | |||
|
|||
// ValidateForLogs validates properties for logs. | |||
func (mp *MatchProperties) ValidateForLogs() error { | |||
if len(mp.SpanNames) > 0 || len(mp.Services) > 0 || len(mp.SpanKinds) > 0 { | |||
if len(mp.SpanNames) > 0 || len(mp.Services) > 0 || len(mp.SpanKinds) > 0 || len(mp.MetricNames) > 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.
According to the documentation, metric_names
should be allowed only for metrics
@@ -193,8 +193,8 @@ must be specified with a non-empty value for a valid configuration. The `log_bod | |||
- For logs, one of `log_bodies`, `log_severity_texts`, `log_severity_number`, `attributes`, `resources` | |||
or `libraries` must be specified with a non-empty value for a valid configuration. The `span_names`, | |||
`span_kinds`, `metric_names` and `services` fields are invalid. | |||
- For metrics, `metric_names` must be specified with a valid non-empty value for | |||
a valid configuration. The `span_names`, `span_kinds`, `resources`, `log_bodies`, `log_severity_texts`, | |||
- For metrics, one of `metric_names` or `resources` must be specified with a valid non-empty value for |
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.
resources
are valid for metrics, see ResourceAttributes
in the creation of MetricMatchProperties
from MatchProperties
Description
Add validation for metrics-only configuration parameters
Link to tracking issue
Fixes #36077