Embedding Grafana metrics panels in GFM
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 toServiceSelector
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
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