Skip to content

Embedding Grafana metrics panels in GFM

Sarah Yasonik requested to merge sy-grafana-embeds-be into master

What does this MR do?

Allows grafana dashboards panels to be embedded in GFM. See issue: #31376 (closed).

Changes:

  • Adds support for interacting with with GrafanaMetricEmbedService, including adding configuration to ServiceSelector to allow the service to be discoverable.
  • Adds a new MetricsDashboard endpoint to allow the FE to fetch a grafana embeddable dashboard.
  • Updates the base MetricsDashboard endpoint module to accommodate a pollable response.
  • Adds InlineGrafanaMetricsFilter, which allows the GFM pipeline to recognize a link to a grafana dashboard & insert a placeholder element for the FE to replace with metrics data.
  • A changelog is not included as this is behind a feature flag.

Context

This is based on the addition of a new service found here: !18520 (merged)

Some additional FE changes can be found here: !18426 (merged)

A feature test will be added in a future MR, as this behavior is ultimately dependent on the FE to work correctly. Documentation will also be added in another MR.

Testing

Testing requires a configure Grafana instance, hooked up to a prometheus data source which is configured to collect data from an application. An API token should be generated in the instance and saved to the grafana_integrations table. (FE for this interaction is in review). I've found the simplest way to get this full configuration is to run a gitlab omnibus instance locally & use the grafana instance which monitors the gitlab instance. For scripts and instructions, feel free to DM me.

Currently also testing if there's a simple way to do this with just GDK.

Screenshots

Screen_Shot_2019-10-14_at_4.47.35_PM

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Sarah Yasonik

Merge request reports