Skip to content
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

[filterprocessor] filter metrics using resource attributes #2251

Merged

Conversation

hossain-rayhan
Copy link
Contributor

Description:
New Feature: This contribution adds the capability of filtering metrics using resource attributes.
Current filter processor can include/exclude metrics based on metric_name field. However, It would be good if we can filter metrics using metric_name and resource attributes together. For example, we have container.cpu.utilized metrics and it comes from three different containers. Customer cares about metrics from only one container and want to exclude other two. All the metrics have a resource attribute container.id and we want to filter the metrics using this field.

Link to tracking Issue:
#2050

Testing:
Unit test added.
Manually tested using logging exporter.

Documentation:
README updated with example.

Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
@hossain-rayhan hossain-rayhan requested a review from a team December 4, 2020 12:07
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #2251 (84f6fd6) into master (28e3cc1) will increase coverage by 0.02%.
The diff coverage is 95.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2251      +/-   ##
==========================================
+ Coverage   92.00%   92.03%   +0.02%     
==========================================
  Files         273      273              
  Lines       15391    15405      +14     
==========================================
+ Hits        14161    14178      +17     
+ Misses        849      846       -3     
  Partials      381      381              
Impacted Files Coverage Δ
processor/filterprocessor/filter_processor.go 93.68% <95.12%> (+0.03%) ⬆️
...ternal/processor/filtermatcher/attributematcher.go 100.00% <100.00%> (ø)
internal/processor/filtermatcher/filtermatcher.go 100.00% <100.00%> (ø)
testutil/testutil.go 81.03% <0.00%> (-0.58%) ⬇️
internal/data/spanid.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28e3cc1...84f6fd6. Read the comment docs.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

I am asking for changes because I want to avoid duplicate code.

internal/processor/filtermetric/config.go Outdated Show resolved Hide resolved
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
Signed-off-by: Rayhan Hossain <hossain.rayhan@outlook.com>
@hossain-rayhan
Copy link
Contributor Author

Hi @bogdandrutu, could you have another look on this.

@hossain-rayhan
Copy link
Contributor Author

Hi @bogdandrutu, I saw that you resolved our improvement conversation, thanks. Is there any other feedback to make it better or we are good to go? Would be great if we can merge it before holidays. 😄

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2021

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 5, 2021
@hossain-rayhan
Copy link
Contributor Author

Hi @bogdandrutu, happy new year! would you have a final look on this?

@bogdandrutu bogdandrutu merged commit c80de2b into open-telemetry:master Jan 12, 2021
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants