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

Mixin: support multiple querier scaled objects #3962

Merged
merged 5 commits into from
Jan 18, 2023

Conversation

colega
Copy link
Contributor

@colega colega commented Jan 16, 2023

What this PR does

We're experimenting with multiple querier scaled objects, querier-burst and querier-burst-backup. This adapts the mixin to support them on the dashboards.

This is how it looks with hpa_name: 'keda-hpa-querier(-burst(-backup)?)?':

image

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

We're experimenting with multiple querier scaled objects, querier-burst
and querier-burst-backup. This adapts the mixin to support them on the
dashboards.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega force-pushed the support-multiple-querier-scaled-objects branch from 6357778 to 66a2037 Compare January 16, 2023 11:44
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega marked this pull request as ready for review January 16, 2023 14:52
@colega colega requested a review from a team as a code owner January 16, 2023 14:52
@pracucci pracucci self-requested a review January 16, 2023 16:14
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM. I left a comment about min/max.

Comment on lines 215 to 216
'sum(kube_horizontalpodautoscaler_spec_min_replicas{%s, horizontalpodautoscaler=~"%s"})' % [$.namespaceMatcher(), $._config.autoscaling.querier.hpa_name],
'sum(kube_horizontalpodautoscaler_spec_max_replicas{%s, horizontalpodautoscaler=~"%s"})' % [$.namespaceMatcher(), $._config.autoscaling.querier.hpa_name],
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks weird summing min/max. I understand what you're doing here, but the original idea of displaying min/max was that the current number of replicas will be between that band. That's no more true. What if we do min(kube_horizontalpodautoscaler_spec_min_replicas) and max(kube_horizontalpodautoscaler_spec_max_replicas) instead? Would be slightly more accurate.

If you accept this suggestion, then shouldn't be a stack anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of the lines of "current" could be under "min", but the topmost would be between min and max.

I think that having min(min) would be also misleading, as that would make that number show half of the real min.

Maybe I should just add another row of panels for querier-burst and querier-burst-backup and make that feature explicitly enabled?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Discussed offline. I'm up to remove min and keep max as max(max).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've left each one of the max values, as they might be different, and doing the max(max) could hide some of the autoscaler being at max value.

@colega
Copy link
Contributor Author

colega commented Jan 16, 2023

I'll hold on merging this because the hpa replicas metric never goes to 0, and I need to find a workaround for that.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega requested a review from pracucci January 17, 2023 15:57
@colega
Copy link
Contributor Author

colega commented Jan 17, 2023

@pracucci I've updated the PR and updated the screenshot in the description.

I removed the min replicas completely, as agreed, and rendered the "scaling metric / target" as "desired replicas".

I also added a warning about the "Current" replicas reporting 1 when it's actually 0.

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM, but I always have nitpicks 🚀 (happy to merge as-is as well, the queries SGTM)

operations/mimir-mixin/dashboards/reads.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/dashboards/reads.libsonnet Outdated Show resolved Hide resolved
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Good job, LGTM! I just left a minor comment.

$.filterKedaMetricByHPA('keda_metrics_adapter_scaler_metrics_value', $._config.autoscaling.querier.hpa_name),
'kube_horizontalpodautoscaler_spec_target_metric{%s, horizontalpodautoscaler="%s"}' % [$.namespaceMatcher(), $._config.autoscaling.querier.hpa_name],
|||
keda_metrics_adapter_scaler_metrics_value
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you should wrap it with ceil() to have a more accurate measurement of the desired replicas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer leaving it as decimal, this way it's clear that it's just the number coming from the metric, not the actual "desired replicas" that HPA has already decided.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
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.

3 participants