-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add metric filter option to metrics transform processor #1447
Add metric filter option to metrics transform processor #1447
Conversation
340a9bc
to
bcef517
Compare
Codecov Report
@@ Coverage Diff @@
## master #1447 +/- ##
===========================================
+ Coverage 70.87% 88.80% +17.92%
===========================================
Files 29 341 +312
Lines 1298 16690 +15392
===========================================
+ Hits 920 14822 +13902
- Misses 321 1403 +1082
- Partials 57 465 +408
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
} | ||
|
||
func (f internalFilterRegexp) getMatches(toMatch metricNameMapping) []*metricspb.Metric { | ||
const capExpectedMatches = 10 |
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.
Any reasoning for this value?
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.
Just seemed like a sensible default. If a user is using regexp
match type, they probably expect more than 1 match.
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.
Sounds good. Perhaps add this as a comment to the code? Otherwise, it's still going to be a magic number :)
if transform.Action == Update { | ||
nameToMetricMapping.remove(metricName, metric) | ||
} | ||
nameToMetricMapping.add(metric.MetricDescriptor.Name, metric) |
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.
Shouldn't this be transform.NewName
?
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.
The metric name has been transformed at this point so either would work.
I wanted to use metric.MetricDescriptor.Name
here so this works even if transform.NewName
supports expansion (and thus the new name can differ from the raw value of transform.NewName
).
I've now added expansion to this PR - see comment below.
@jpkrohling FYI while addressing your comments, I also added one minor feature to this PR, which is that if the |
processor/metricstransformprocessor/metrics_transform_processor_testcases_test.go
Show resolved
Hide resolved
15fd9a1
to
b4701ee
Compare
Signed-off-by: Bogdan Drutu <[email protected]>
* TraceContext propagator now handles `tracestate`. Signed-off-by: Anthony J Mirabella <[email protected]> * Prevent invalid tracestate from invalidating traceparent. Signed-off-by: Anthony J Mirabella <[email protected]> * Fail tests early if unable to construct expected TraceContext Signed-off-by: Anthony J Mirabella <[email protected]>
Link to tracking Issue: #1088 (comment)
Description:
Add a simple include filter option with
strict
orregexp
match type so that transforms can be applied to a range of metrics. When using theregexp
match type,new_name
supports expansion.This implementation is compatible with the config proposed here so could be switched out for that implementation in the future if desired. Also retained the
metric_name
config option for backwards compatibility but removed references to this from the documentation.Continues optimizing for the
strict
match case, i.e. retainO(n) + O(t)
forstrict
matches where metric names are unique, at the cost of makingregexp
matching slightly slower.regexp
matches will beO(n) * O(t)
.Also resolves an edge case where if multiple metrics have the same name only one of them would previously have been transformed.
Documentation:
Updated the documentation to specify how to use the
match_type
filter, and generally cleaned up the README to be more easily digested.