Skip to content

feat: Add ACL related metrics #291

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dttung2905
Copy link

Hi team,

This PR aims to add more ACL related metrics for kminion, inititally brought up by #137. It will now support 2 different types of metrics

  • Total number of ACLs
  • Total number of ACLs broken down by different type

Below is an example output under /metrics endpoint

# HELP kminion_kafka_acls_by_type The number of ACLs by resource type
# TYPE kminion_kafka_acls_by_type gauge
kminion_kafka_acls_by_type{resource_type="cluster"} 1
kminion_kafka_acls_by_type{resource_type="group"} 2
kminion_kafka_acls_by_type{resource_type="topic"} 3
kminion_kafka_acls_by_type{resource_type="transactional_id"} 4
# HELP kminion_kafka_acls_total The total number of ACLs in the cluster
# TYPE kminion_kafka_acls_total gauge
kminion_kafka_acls_total 10

Signed-off-by: dttung2905 <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Apr 5, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dttung2905
Copy link
Author

Hi @weeco, could you help to take a look at this PR when you have time 🙏 ?

return true
}

func getResourceTypeName(ACLResponse *kmsg.DescribeACLsResponse) map[string]int {
Copy link
Contributor

Choose a reason for hiding this comment

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

The resourcetype already has a string method

Copy link
Author

Choose a reason for hiding this comment

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

its done

"go.uber.org/zap"
)

func (e *Exporter) collectACLInfo(ctx context.Context, ch chan<- prometheus.Metric) bool {
Copy link
Contributor

@weeco weeco Apr 14, 2025

Choose a reason for hiding this comment

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

Should only be done if configured. Config should probably default to false to not break existing deployments with tight permissions setup

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @weeco for the quick reply , I have updated the code to reflect this

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.

3 participants