Add service to fetch and format a grafana charts embed
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:
- Previous MR (adds Grafana Client & Proxy endpoint): !18210 (merged)
- Next MR (adds GFM filter & dashboard endpoint): !18285 (merged)
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
- [n/a] Changelog entry
- [n/a] Documentation created/updated or follow-up review issue created
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [n/a] Database guides
-
Separation of EE specific content
Performance and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
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