Skip to content

feat: Expose HRQ limit and usage on metrics endpoint.#30

Merged
utam0k merged 4 commits into
pfnet:masterfrom
ryotarai:ryotarai/exporter
Oct 20, 2025
Merged

feat: Expose HRQ limit and usage on metrics endpoint.#30
utam0k merged 4 commits into
pfnet:masterfrom
ryotarai:ryotarai/exporter

Conversation

@ryotarai

Copy link
Copy Markdown
Collaborator

This exposes HRQ limit and usage on the metrics endpoint.

The metric labels align with kube_resourcequota metric of kube-state-metrics.

$ curl --silent localhost:8080/metrics | grep hnc_hierarchicalresourcequota
# HELP hnc_hierarchicalresourcequota HRQ hard/used like kube_resourcequota
# TYPE hnc_hierarchicalresourcequota gauge
hnc_hierarchicalresourcequota{hrq="test-a",namespace="test-parent",resource="cpu",type="hard"} 20
hnc_hierarchicalresourcequota{hrq="test-a",namespace="test-parent",resource="cpu",type="used"} 0
hnc_hierarchicalresourcequota{hrq="test-a",namespace="test-parent",resource="memory",type="hard"} 4.294967296e+10
hnc_hierarchicalresourcequota{hrq="test-a",namespace="test-parent",resource="memory",type="used"} 0

@ryotarai ryotarai marked this pull request as ready for review September 16, 2025 00:37
@superbrothers

Copy link
Copy Markdown
Member
  • Please document metrics in HRQ's documentation.
  • Please verify that the hnc_ prefix for metric names aligns with the existing metric prefix.

@ryotarai

ryotarai commented Oct 1, 2025

Copy link
Copy Markdown
Collaborator Author
$ curl --silent localhost:8080/metrics | grep -v ^# | cut -d'_' -f1 | sort | uniq 
certwatcher
controller
go
hnc
process
rest
workqueue
$ curl --silent localhost:8080/metrics | grep ^hnc_   
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="AncestorHaltActivities"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="DeletingCRD"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="IllegalManagedAnnotation"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="IllegalManagedLabel"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="IllegalParent"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="InCycle"} 0
hnc_namespace_conditions{Condition="ActivitiesHalted",Reason="ParentMissing"} 0
hnc_namespace_conditions{Condition="BadConfiguration",Reason="SubnamespaceAnchorMissing"} 0
hnc_reconcilers_hierconfig_concurrent_peak 0
hnc_reconcilers_hierconfig_namespace_writes_total 62
hnc_reconcilers_hierconfig_total 22
hnc_reconcilers_object_concurrent_peak{GroupKind=""} 0
hnc_reconcilers_object_total{GroupKind=""} 8

@superbrothers

Copy link
Copy Markdown
Member

@utam0k Could you please take a look at this PR?

Comment thread internal/hrq/metrics.go Outdated
@ryotarai ryotarai requested a review from utam0k October 16, 2025 13:22

@utam0k utam0k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@utam0k utam0k merged commit e88557e into pfnet:master Oct 20, 2025
2 checks passed
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