Skip to content

jsonnet: add Prometheus-trigger autoscaling option for metrics-generator - #7362

Merged
mapno merged 7 commits into
grafana:mainfrom
mapno:generator-autoscaling-prometheus-trigger
Jun 4, 2026
Merged

jsonnet: add Prometheus-trigger autoscaling option for metrics-generator#7362
mapno merged 7 commits into
grafana:mainfrom
mapno:generator-autoscaling-prometheus-trigger

Conversation

@mapno

@mapno mapno commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

Adds an optional Prometheus-based KEDA trigger for the metrics-generator autoscaler, alongside the existing CPU trigger.

  • metrics_generator.keda.query == '': existing CPU trigger (target_cpu, unchanged behavior).
  • metrics_generator.keda.query != '': KEDA Prometheus trigger via the shared prometheusTrigger helper, using metricType: Value with threshold: 1 — the query must return the exact desired pod count.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
@mapno
mapno force-pushed the generator-autoscaling-prometheus-trigger branch 2 times, most recently from c257933 to 8a85e25 Compare June 3, 2026 10:34
@mapno
mapno marked this pull request as ready for review June 3, 2026 10:54
Copilot AI review requested due to automatic review settings June 3, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an optional Prometheus-based KEDA autoscaling mode for the Tempo metrics-generator Jsonnet manifests, allowing replica count to be driven by a PromQL query (instead of the existing CPU trigger) when configured.

Changes:

  • Extend metrics_generator.keda config with a query field; when set, generate a KEDA Prometheus trigger (metricType Value, threshold 1) instead of the CPU trigger.
  • Update the make chlog-new target to default the changelog entry filename to the current git branch.
  • Refresh the compiled Jsonnet lockfile and add a .chloggen/ entry documenting the enhancement.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
operations/jsonnet/microservices/autoscaling.libsonnet Adds the Prometheus-trigger option for metrics-generator KEDA autoscaling and documents the new config field.
operations/jsonnet-compiled/jsonnetfile.lock.json Updates Jsonnet dependency lock versions as part of regeneration.
Makefile Adjusts chlog-new to generate branch-named changelog entries by default.
.chloggen/generator-autoscaling-prometheus-trigger.yaml Adds a changelog entry for the new autoscaling option.
Comment thread operations/jsonnet/microservices/autoscaling.libsonnet
Comment thread operations/jsonnet/microservices/autoscaling.libsonnet
Comment thread operations/jsonnet/microservices/autoscaling.libsonnet
Comment thread .chloggen/generator-autoscaling-prometheus-trigger.yaml
Comment thread operations/jsonnet/microservices/autoscaling.libsonnet
Comment thread Makefile Outdated
Copilot AI review requested due to automatic review settings June 3, 2026 11:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread Makefile Outdated
Comment thread .chloggen/generator-autoscaling-prometheus-trigger.yaml
mattdurham
mattdurham previously approved these changes Jun 4, 2026
mapno added 7 commits June 4, 2026 15:22
Adds metrics_generator.keda.query so the metrics-generator can scale on a
Prometheus query instead of CPU. When set, a KEDA Prometheus trigger is used
with metricType Value and threshold 1 (the query must return the exact desired
pod count); when empty it falls back to the existing CPU trigger. The motivating
use case is clamping CPU-derived demand to the live-store partition count so
generators never exceed the number of partitions.
Copilot AI review requested due to automatic review settings June 4, 2026 13:23
@mapno
mapno force-pushed the generator-autoscaling-prometheus-trigger branch from ae3108b to 1462d66 Compare June 4, 2026 13:23
@mapno
mapno enabled auto-merge (squash) June 4, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@mapno
mapno merged commit 8e0cfa6 into grafana:main Jun 4, 2026
42 of 56 checks passed
@mapno
mapno deleted the generator-autoscaling-prometheus-trigger branch June 4, 2026 13:41
knylander-grafana added a commit that referenced this pull request Jun 30, 2026
…autoscaling (#7485)

* docs: document compare() topN limit and metrics-generator Prometheus autoscaling

- functions.md: note the compare() second parameter must be an integer
  between 1 and 1000 (#7467)
- tanka.md: document the optional metrics-generator KEDA Prometheus query
  trigger alongside the existing CPU trigger (#7362)

* Correct passive voice to active in KEDA section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants