Skip to content

Add service to fetch and format a grafana charts embed

Sarah Yasonik requested to merge sy-grafana-service into master

What does this MR do?

Adds a service which formats an embeddable dashboard json which the FE can use to render a chart based on a grafana dashboard panel & datasource.

Issue: #31376 (closed)

For additional context on the BE implementation for this feature:

Changes:

  • Adds GrafanaMetricEmbedService, which is responsible for fetching & formatting a gitlab-compatible embeddable dashboard based on a Grafana dashboard and datasource.
  • The data flow for this service is consistent with the existing services (Call Finder -> Select a service -> Fetch the dashboard -> Add DB info/reformat the dashboard -> Return dashboard).
  • As the service needs to make external API calls, it includes the ReactiveCaching module & needs to be polled.

Note: A changelog will not be included as there will be no impact to users as a result of this change. Documentation for the feature will also come in a future 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.

Screenshots

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 Dmytro Zaporozhets (DZ)

Merge request reports