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

Enhance the gotk_resource_info metric #3

Merged
merged 2 commits into from
Aug 21, 2023
Merged

Enhance the gotk_resource_info metric #3

merged 2 commits into from
Aug 21, 2023

Conversation

stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Aug 21, 2023

This PR extends the gotk_resource_info metric with metadata specific to each GitOps Toolkit resource kind.

Changes

  • Add suspended labels to all info metrics
  • Add url and revision labels to GitRepository, OCIRepository, HelmRepository metrics
  • Add bucket_name, endpoint and revision labels to Bucket metrics
  • Add chart_name, chart_version and revision labels to HelmChart metrics
  • Add source_name and revision labels to Kustomization objects
  • Add chart_source_name, chart_name and revision labels to HelmRelease objects
  • Add webhook_path labels to Receiver metrics
  • Add image labels to ImageRepository metrics
  • Add source_name labels to ImagePolicy metrics
  • Update cluster dashboard to hide these new labels from the table panels.

⚠️ Given that revision can result in high cardinality metrics, we should instruct user how to remove this label if they don't have a use for it.

Examples

Kustomization:

gotk_resource_info{
    customresource_group="kustomize.toolkit.fluxcd.io",
    customresource_kind="Kustomization",
    customresource_version="v1", 
    exported_namespace="flux-system",
    name="monitoring-controllers", 
    source_name="monitoring",
    revision="metrics@sha1:63f64aa7109ed7cd6ff76be3dc0d0a1580a38c9b",
    ready="True"
}

GitRepositry:

gotk_resource_info{
    customresource_group="source.toolkit.fluxcd.io",
    customresource_kind="GitRepository",
    customresource_version="v1", 
    exported_namespace="flux-system", 
    name="monitoring",
    revision="metrics@sha1:e8f85cc9ac1a17f6224d3046d4f714e8ff8b539c",
    url="https://github.com/fluxcd/flux2-monitoring-example.git",
    ready="True"
}

HelmRelease:

gotk_resource_info{
    customresource_group="helm.toolkit.fluxcd.io",
    customresource_kind="HelmRelease",
    customresource_version="v2beta1",
    exported_namespace="monitoring", 
    name="loki-stack", 
    chart_source_name="grafana-charts",
    chart_name="loki-stack",
    revision="2.9.11",
    ready="True"
}

HelmChart:

gotk_resource_info{
    customresource_group="source.toolkit.fluxcd.io",
    customresource_kind="HelmChart",
    customresource_version="v1beta2",
    exported_namespace="monitoring",
    name="monitoring-loki-stack",
    chart_name="loki-stack",
    chart_version="2.x",
    revision="2.9.11",
    ready="True"
}

HelmRepository:

gotk_resource_info{
    customresource_group="source.toolkit.fluxcd.io",
    customresource_kind="HelmRepository",
    customresource_version="v1beta2",
    exported_namespace="monitoring",
    name="grafana-charts",
    revision="sha256:c10ae0b0798a616b1aa494128294f223e5c36047e35508fbab57d0a30f0a834f",
    url="https://grafana.github.io/helm-charts",
    ready="True"
}

@stefanprodan stefanprodan requested a review from a team August 21, 2023 09:03
@stefanprodan stefanprodan changed the title Enhance resource_info Enhance the gotk_resource_info metric Aug 21, 2023
- Add `suspended` labels to all info metrics
- Add `url` and `revision` labels to source metrics
- Add `source_name` and `revision` labels to Kustomization objects
- Add `chart_name` and `revision` labels to HelmRelease objects

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Update the panel transforms to hide the new fields. This helps keep the
panel tables as before.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Tried it manually and it LGTM.
Thanks.

@stefanprodan stefanprodan merged commit 88b17f7 into main Aug 21, 2023
4 checks passed
@stefanprodan stefanprodan deleted the metrics branch August 21, 2023 13:40
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.

2 participants