fluxcd / flux2-monitoring-example

Prometheus monitoring for the Flux control plane
https://fluxcd.io/flux/monitoring/
Apache License 2.0
50 stars 133 forks source link

Enhance the `gotk_resource_info` metric #3

Closed stefanprodan closed 1 year ago

stefanprodan commented 1 year ago

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

Changes

⚠️ 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"
}