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

[v2] Annotation Autodiscovery improvements #1244

Open
petewall opened this issue Feb 14, 2025 · 0 comments
Open

[v2] Annotation Autodiscovery improvements #1244

petewall opened this issue Feb 14, 2025 · 0 comments
Assignees

Comments

@petewall
Copy link
Collaborator

Some improvements to the annotationAutodiscovery feature:

  • Have a switch to enable/disable pods or services:
pods:
  enabled: true

services:
  enabled: true
  • Make it easy to set static labels and extract common labels:
pods:
  labels:
    pod: __meta_kubernetes_pod_name
    namesapace: __meta_kubernetes_namespace
    node: __meta_kubernetes_pod_node_name
    region: __meta_kubernets_pod_label_region
  staticLabels:
    color: red
  • Add the ability to extract __param_<key>__ parameters:
annotations:
  metricsScrapeParams: k8s.grafana.com/metrics.param.

Which would set:

    rule {
      action = "labelmap"
      regex = "__meta_kubernetes_pod_annotation_k8s_grafana_com_metrics_param_(.+)"
      replacement = "__param_$1"
    }
  • Add label matchers to better filter pods and services:
labelMatchers:
  region: us
pods:
  labelMatchers:
    color: blue

will result in:

discovery.kubernetes "pods" {
  role = "pod"
  selectors {
    role = "pod"
    label = "region=us,color=blue"
  }
}

This is more efficient that filtering in the discovery.relabel section. It could be, and should be, unique per pods and services.

@petewall petewall self-assigned this Feb 18, 2025
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

No branches or pull requests

1 participant