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

Provide support for Perses dashboards in Mixins. #7702

Open
nicolastakashi opened this issue Sep 5, 2024 · 4 comments
Open

Provide support for Perses dashboards in Mixins. #7702

nicolastakashi opened this issue Sep 5, 2024 · 4 comments

Comments

@nicolastakashi
Copy link
Contributor

nicolastakashi commented Sep 5, 2024

Is your proposal related to a problem?

Perses is an open-source project aimed at simplifying the creation and management of dashboards for observability and monitoring. It offers a more flexible and modern alternative to existing solutions like Grafana.

Recently, Perses was accepted into the CNCF Sandbox, marking a significant milestone for the project. Given this momentum, we believe now is the perfect time to start incorporating support for Perses dashboards into the existing monitoring Mixins.

Currently, Perses dashboards can be created using the Perses GoLang SDK, as we do not support Jsonnet at the moment.

I’d love to hear your thoughts on this approach.

Describe the solution you'd like

(Describe your proposed solution here.)

N/A

N/A

Additional context

N/A

Copy link

dosubot bot commented Sep 5, 2024

Currently, there are no existing integrations or references to Perses in the Thanos codebase or documentation. To add support for Perses dashboards in the Mixins, you would need to create and customize jsonnet files similar to how Grafana dashboards are managed. This involves defining the necessary configurations and selectors for Perses dashboards in the config.libsonnet file and creating specific jsonnet files for each component.

You can follow the existing structure used for Grafana dashboards as a reference. For example, you can look at how dashboards/rule.libsonnet is set up for Grafana and adapt it for Perses. Additionally, you will need to update the jsonnetfile.json to include any dependencies required for Perses.

Here is a basic outline of steps you might take:

  1. Update config.libsonnet: Add configurations specific to Perses dashboards.
  2. Create jsonnet files for Perses dashboards: Similar to dashboards/rule.libsonnet, create jsonnet files for each Thanos component.
  3. Update jsonnetfile.json: Include dependencies required for Perses.

For example, you might add a new section in config.libsonnet:

{
  perses+:: {
    selector: 'job=~".*thanos-perses.*"',
    title: '%(prefix)sPerses' % $.dashboard.prefix,
  },
  // Additional configurations for other components...
}

And create a new jsonnet file for a Perses dashboard, e.g., dashboards/perses.libsonnet:

local g = import '../lib/thanos-perses-builder/builder.libsonnet';
local utils = import '../lib/utils.libsonnet';

{
  local thanos = self,
  perses+:: {
    selector: error 'must provide selector for Thanos Perses dashboard',
    title: error 'must provide title for Thanos Perses dashboard',
    dashboard:: {
      selector: std.join(', ', thanos.dashboard.selector + ['job=~"$job"']),
      dimensions: std.join(', ', thanos.dashboard.dimensions + ['job']),
    },
  },
  persesDashboards+:: {
    [if thanos.perses != null then 'perses.json']:
      g.dashboard(thanos.perses.title)
      .addRow(
        g.row('Perses Metrics')
        .addPanel(
          g.panel('Metric Panel') +
          g.queryPanel(
            'sum by (%(dimensions)s) (rate(thanos_perses_metric_total{%(selector)s}[$__rate_interval]))' % thanos.perses.dashboard,
            '{{ metric }}',
          )
        )
      )
  },
}

This is a simplified example, and you would need to adapt it to fit the specific requirements and structure of Perses dashboards.

To continue talking to Dosu, mention @dosu.

@MichaHoffmann
Copy link
Contributor

Is Perses not compatible with Grafana dashboard JSON definitions?

@Nexucis
Copy link
Contributor

Nexucis commented Sep 9, 2024

Perses provides a different JSON definition for the dashboard and provides a migration system to convert the Grafana dashboard to the Perses one.

But I would say on a long term, it's better to provide the Perses definition directly. Like @nicolastakashi mentioned, you can code your dashboard with the Go SDK that Perses is providing

@Nexucis
Copy link
Contributor

Nexucis commented Sep 9, 2024

and FYI, Perses doesn't provide any support for Jsonnet. Only Cuelang or Golang are supported for the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants