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

Convert mimir-mixin from deprecated graph panel type to timeseries #7413

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Feb 17, 2024

What this PR does

Note, it turned out it's simpler to convert all dashboards at once, than trying to do that dashboard-by-dashboard, because of how jsonnet mixins are structured.

To make review simpler, I suggest looking through the individual commits in mimir-mixin/, where I divided the changes into parts: "update the utils" and "update the dashboards". The majority of other changes are autogenerated from make.

Overall, after eyeballing all dashboards for a day, I'm fairly confident that everything there is fine 🤞

Below, attaching random before & after screenshots. Note, I tested the dashboards in Grafana 10.0, which doesn't automatically convert graph panels to timeseries (i.e. what one sees on the screenshots below is what one gets).

Mimir / Overview Screenshot 2024-02-19 at 08 36 28

Before

Screenshot 2024-02-19 at 08 36 37

After

Mimir / Writes Screenshot 2024-02-19 at 08 37 37

Before

Screenshot 2024-02-19 at 08 37 48

After

Mimir / Reads Screenshot 2024-02-19 at 08 48 40

Before

Screenshot 2024-02-19 at 08 48 49

After

Which issue(s) this PR fixes or relates to

Fixes #7188

Checklist

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

@narqo narqo requested a review from krajorama February 19, 2024 07:53
@narqo narqo marked this pull request as ready for review February 19, 2024 07:53
@narqo narqo requested a review from a team as a code owner February 19, 2024 07:53
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

Overall looks good, a few small comments. Thanks for breaking this up into multiple commits for review.

@@ -167,6 +175,21 @@ local utils = import 'mixin-utils/utils.libsonnet';
recordingRulePrefix(selectors)::
std.join('_', [matcher.label for matcher in selectors]),

// Overrite upstream's "stack" field to make it compatible with timeseriesPanel.
Copy link
Contributor

@56quarters 56quarters Feb 20, 2024

Choose a reason for hiding this comment

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

Can you expand this comment a bit. It took me a little while to figure out why this was required since we're using $.timeseriesPanel() in a few places below. I.e. explain that we're using some utility methods for panels from grafana-builder/grafana.libsonnet that can't be converted without coordinating updates to a bunch of different mixins in jsonnet-libs.

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 rephrased the comment. Could you have another look, if it's less obscure now

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good. In the future, please don't rebase / force-push after review. It makes it harder to figure out which changes are new since last time.

$.queryPanel($.resourceUtilizationQuery('memory_working', $._config.instance_names.read, $._config.container_names.read), '{{%s}}' % $._config.per_instance_label) +
{ yaxes: $.yaxes('bytes') },
{ fieldConfig+: { defaults+: { unit: 'bytes' } } },
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Overrides of the unit seems to have come up a few times, worth making a helper method in dashboard-utils.libsonnet?

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 was thinking if we can skip that for this PR. Maybe later we could refactor the jsonnet-lib's timeseriesPanel() mixin, to allow passing the "unit" argument:

$.timeseriesPanel(title, unit="short")

For me, this fits better in the panels' JSON model

$.queryPanel(
'sum(rate(cortex_distributor_samples_in_total{%(job)s, user="$user"}[$__rate_interval]))'
% { job: $.jobMatcher($._config.job_names.distributor) },
'rate',
) +
{ legend: { show: false } } +
{ options+: { legend+: { showLegend: false } } } +
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Utility method to hide the legend?

Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
make build-mixin build-helm-tests

Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
@56quarters 56quarters merged commit 33ef390 into main Feb 21, 2024
30 checks passed
@56quarters 56quarters deleted the 7188-graph-panel branch February 21, 2024 16:16
@dimitarvdimitrov
Copy link
Contributor

this deserves a changelog entry, it's a nice fix. @narqo, can you add one in the root-level CHANGELOG.md under the Mixin section?

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.

Stop using deprecated panel type graph in mimir-mixin
3 participants