Add metrics for APIBinding and APIExport usage data#4147
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Elbehery. Thanks for your PR. I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Track the number of APIBindings in each phase (Binding, Bound, or empty for newly created) via a system-wide GaugeVec with a single "phase" label. Phase transitions are tracked in the apibinding controller event handlers using a per-key map protected by a mutex, following the same pattern used for kcp_workspace_count. Signed-off-by: elbehery <elbeherymustafa@gmail.com>
Track the number of APIBindings with each condition type and status (True, False, Unknown) via a GaugeVec with "condition" and "status" labels. Per-binding condition snapshots are maintained in the controller and diffed on update to keep the gauges accurate without cardinality explosion from per-resource labels. Signed-off-by: elbehery <elbeherymustafa@gmail.com>
Record the time in milliseconds from APIBinding creation to reaching the Bound phase as a histogram. The observation is taken once in the phase update handler on the Bound transition, so each binding contributes exactly one sample. Buckets cover the expected range from sub-second to 5 minutes. Signed-off-by: elbehery <elbeherymustafa@gmail.com>
Track the number of APIExports with each condition type and status (True, False, Unknown) via a GaugeVec with "condition" and "status" labels. Per-export condition snapshots are maintained in the apiexport controller and diffed on update to keep the gauges accurate, mirroring the approach used for kcp_apibinding_condition_status. Signed-off-by: elbehery <elbeherymustafa@gmail.com>
Record the time in milliseconds from APIExport creation to becoming fully operational (IdentityValid=True and VirtualWorkspaceURLsReady=True both set) as a histogram. Each export contributes exactly one sample, tracked via a per-key set that is cleaned up on delete. Buckets cover the same range as the apibinding counterpart. Signed-off-by: elbehery <elbeherymustafa@gmail.com>
510e2d3 to
01b37f4
Compare
Implements the metrics proposed in #4041. Adds five new Prometheus metrics to improve
observability of
APIBindingandAPIExportlifecycle and health, following the samepatterns already used for
kcp_workspace_countandkcp_logicalcluster_count.All metrics are system-wide aggregates with no per-resource labels to avoid cardinality
explosion.
New metrics
kcp_apibinding_phasephaseBinding,Bound, or empty for newly created)kcp_apibinding_condition_statuscondition,statusTrue/False/Unknown)kcp_apibinding_ready_duration_msBoundphasekcp_apiexport_condition_statuscondition,statuskcp_apiexport_ready_duration_msIdentityValid=TrueandVirtualWorkspaceURLsReady=True)Implementation
sync.Mutex-protected mapin each controller; on update only the diff is applied to the gauges.
(guarded by a phase-transition check for bindings, a
readyAPIExportsset for exports)so controller restarts do not double-count.
delete, and concurrency cases.
cc @mjudeikis @ntnn @SimonTheLeg