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

Ignore all metrics except set of metrics #344

Closed
alvarocabanas opened this issue Sep 20, 2022 · 3 comments · Fixed by #346
Closed

Ignore all metrics except set of metrics #344

alvarocabanas opened this issue Sep 20, 2022 · 3 comments · Fixed by #346
Assignees
Labels
bug Categorizes issue or PR as related to a bug. priority/short-term Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@alvarocabanas
Copy link
Contributor

As a user, I want to only collect a defined set of metric names and exclude everything else.

transformations:
  - description: allow
     ignore_metrics:
      - except:
        - apiserver_audit_requests_rejected_total

This behavior, even if it's contemplated in the tests, it's not working properly.

@alvarocabanas alvarocabanas added the bug Categorizes issue or PR as related to a bug. label Sep 20, 2022
@workato-integration
Copy link

@alvarocabanas alvarocabanas added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/short-term Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Sep 20, 2022
@paologallinaharbur paologallinaharbur self-assigned this Sep 23, 2022
@paologallinaharbur
Copy link
Member

Trying to reproducing it locally.
having:

  transformations:
    - description: allow
      ignore_metrics:
        - except:
            - go

seems to be working as expected
Screenshot 2022-09-23 at 16 11 21

Moreover, there is a test covering that use case and the code seems without issues.

		exceptRulesLen += len(rule.Except)
		for _, prefix := range rule.Except {
			if strings.HasPrefix(name, prefix) {
				return false
			}
		}
[...]
		// Prefixes
		prefixesLen += len(rule.Prefixes)
		for _, prefix := range rule.Prefixes {
			if strings.HasPrefix(name, prefix) {
				return true
			}
		}

I am trying to verify if we reproduced it locally at some point

@paologallinaharbur
Copy link
Member

The issue is related to lowDatamode and the way multiple rules are managed.

	if prefixesLen > 0 || metricTypesLen > 0 {
		return false
	}

This is considered at the end of all rules, therefore it is enough that one had a prefix to make useless a rule with only excludes

Having:

transformations:
- description: allow
  ignore_metrics:
  - except:
    - apiserver_audit_requests_rejected_total
- description: Low data mode defaults
  ignore_metrics:
  - prefixes:
    - kube_
    - container_
    - machine_
    - cadvisor_

Then becomes similar to:

- description: allow
  ignore_metrics:
  - except:
    - apiserver_audit_requests_rejected_total
  - prefixes:
    - kube_
    - container_
    - machine_
    - cadvisor_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug. priority/short-term Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants