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

Can't to exclude attributes #1128

Open
laa88rf opened this issue Feb 5, 2025 · 4 comments
Open

Can't to exclude attributes #1128

laa88rf opened this issue Feb 5, 2025 · 4 comments

Comments

@laa88rf
Copy link

laa88rf commented Feb 5, 2025

Hello.

I have unneded Kafka metrics. For example:

# HELP kafka_network_RequestMetrics_50thPercentile Attribute exposed for management kafka.network:name=ResponseQueueTimeMs,type=RequestMetrics,attribute=50thPercentile
# TYPE kafka_network_RequestMetrics_50thPercentile untyped
kafka_network_RequestMetrics_50thPercentile{name="LocalTimeMs",request="AddOffsetsToTxn"} 0.0
kafka_network_RequestMetrics_50thPercentile{name="LocalTimeMs",request="AddPartitionsToTxn"} 0.0

I want delete it from /metrics page.
I tried the following:

blacklistObjectNames: ["kafka.log:*", "kafka.network:name=ResponseQueueTimeMs,type=RequestMetrics,attribute=50thPercentile", "kafka.cluster:type=Partition,*"]
rules:
  - pattern: ".*"

also:

excludeObjectNameAttributes:
        "kafka.network:type=RequestMetrics":
                - 50thPercentile

Also:

rules:
- pattern: "(.*)"
  name: "$1"
  action: drop
  labels:
    __name__: ".*(_50thPercentile)$"

and many more options. And none of them work.
Version 1.1.0

Please help me.
Also, please add relevant information about exclude/drop metrics.

Thank you.

@laa88rf
Copy link
Author

laa88rf commented Feb 6, 2025

Ok. I have a progress.

When I using:

autoExcludeObjectNameAttributes: true
includeObjectNameAttributes:
  "kafka.network:type=RequestMetrics":
    - "50thPercentile"

rules:
  - pattern: ".*"

I have only 50thPercentile metric. It's not very obvious.
Of course, I can list the metrics, but it's not convenient

@dhoard
Copy link
Collaborator

dhoard commented Feb 12, 2025

@laa88rf I understand the inconvenience. This was a design decision to prevent performance issues when using regular expressions.

The current algorithm can use a map to include/exclude object name attributes, which is fast. Using regular expressions would result in an algorithm that is O(MN), dramatically affecting scrape time.

@laa88rf
Copy link
Author

laa88rf commented Feb 12, 2025

@dhoard thank you for your answer. Could you please provide any examples.
I tried to write a configuration file using AI, but I got strange variables like drop and skip, which I didn't find in the examples.

@dhoard
Copy link
Collaborator

dhoard commented Feb 12, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants