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

Feature request: configurable prometheus queries #138

Closed
djfinnoy opened this issue Aug 31, 2023 · 2 comments
Closed

Feature request: configurable prometheus queries #138

djfinnoy opened this issue Aug 31, 2023 · 2 comments

Comments

@djfinnoy
Copy link

djfinnoy commented Aug 31, 2023

We use kube-eagle and victoria metrics.

Right now, I have to set up a scrape job from cadvisor solely dedicated to krr:

  # These metrics are required by https://github.com/robusta-dev/krr
  - job_name: kubelet
    scheme: https
    tls_config:
      ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
      insecure_skip_verify: true
    bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
    kubernetes_sd_configs:
      - role: node
    relabel_configs:
      - action: labelmap
        regex: __meta_kubernetes_node_label_(.+)
      - target_label: __address__
        replacement: kubernetes.default.svc:443
      - source_labels: [__meta_kubernetes_node_name]
        regex: (.+)
        target_label: __metrics_path__
        replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor
    metric_relabel_configs:
      # We only need the following metrics because they are needed by robusta-dev/krr, everything else we get from kube-eagle
      - action: keep
        if: '{__name__=~"(container_cpu_usage_seconds_total|container_memory_working_set_bytes)"}'

I think it would be an improvement if one could overwrite the queries mentioned in the docs to whatever fits the local setup.
Let users figure out the equivalent queries for tools like kube-eagle.

@djfinnoy djfinnoy changed the title Feature request: support kube-eagle metrics Feature request: configurable prometheus queries Aug 31, 2023
@LeaveMyYard
Copy link
Contributor

Hey, @djfinnoy !

I think this feature is already implemented, as you can first define any prometheus metric you want here:
https://github.com/robusta-dev/krr/tree/main/robusta_krr/core/integrations/prometheus/metrics

And then use it in a strategy, like here:
https://github.com/robusta-dev/krr/blob/main/robusta_krr/strategies/simple.py

The only thing that it will require you to write a bit of python, but I tried to do everything to make is as simple as possible.

@djfinnoy
Copy link
Author

djfinnoy commented Sep 3, 2023

Good stuff, thank you.

@djfinnoy djfinnoy closed this as completed Sep 3, 2023
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

2 participants