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

🌱 Add ssh cache metrics #11635

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cahillsf
Copy link
Member

@cahillsf cahillsf commented Jan 2, 2025

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #10527

/area util

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/util Issues or PRs related to utils cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 2, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign enxebre for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 2, 2025
@@ -99,16 +125,16 @@ func (r *ssaCache) Has(key string) bool {
// once we found out that it would not produce a diff.
// The identifier consists of: gvk, namespace, name and resourceVersion of the original object and a hash of the modified
// object. This ensures that we re-run the request as soon as either original or modified changes.
func ComputeRequestIdentifier(scheme *runtime.Scheme, original, modified client.Object) (string, error) {
func ComputeRequestIdentifier(scheme *runtime.Scheme, original, modified client.Object) (id, kind string, err error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

not sure if this is the best way to reuse the fact that we're pulling out GVK when computing the request ID

type newCacheOption func(*newCacheConfig)

// WithOwner allows definition of the owner field to be used in NewCache.
func WithOwner(owner string) newCacheOption {
Copy link
Member Author

@cahillsf cahillsf Jan 2, 2025

Choose a reason for hiding this comment

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

it actually looks like we get a provider label when pulling this metric, which may make this cache_owner label extension redundant?

added an example call here in local testing:
r.ssaCache = ssa.NewCache(ssa.WithOwner("kubeadmcontrolplane"))

and was getting metrics like this:

  {
    "metric": {
      "__name__": "capi_ssa_cache_request_total",
      "cache_owner": "kubeadmcontrolplane",
      "instance": "10.244.0.17:8443",
      "job": "capi-providers",
      "kind": "ssa_cache",
      "namespace": "capi-kubeadm-control-plane-system",
      "pod": "capi-kubeadm-control-plane-controller-manager-85d788c785-gw247",
      "provider": "control-plane-kubeadm",
      "status": "miss"
    },
    "values": [
      [
        1735767358.995,
        "358"
      ],
...

@cahillsf cahillsf force-pushed the add-ssa-cache-metrics branch from 540ea95 to 87ba1bc Compare January 2, 2025 23:52
@cahillsf cahillsf force-pushed the add-ssa-cache-metrics branch from 87ba1bc to 33017f9 Compare January 2, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/util Issues or PRs related to utils cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics for SSA cache
2 participants