Single source of truth for profile metrics definitions in the UI
- Dominant language
- Go
- Stars
- 11.7k
- Forks
- 802
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 80
Description
#### Is your feature request related to a problem? Please describe.
Currently, the code base uses different (hardcoded) sources of truth to recognize and display profile metrics in the UI.
In order to ease maintainability and prevent display bugs like we've had in the past ([for example](https://github.com/grafana/pyroscope/pull/2733)), we should refactor the UI code base to use a single source of truth for profile metrics definitions.
#### Describe the solution you'd like
As a first step, we can continue using [this JSON file](https://github.com/grafana/pyroscope/blob/main/public/app/constants/profile-metrics.json), which describes all the possible profile metrics (including names, units, descriptions, etc.). We need to identify all the components where we can use it instead of hardcoded data that does not come from the JSON file.
#### Describe alternatives you've considered
The backend could return these profile types. The advantage being that, instead of static definitions, the UI could fetch updated definitions on-demand, which wouldn't require any code change when definitions are added/updated/fixed.
It seems that there's already an endpoint for: https://github.com/grafana/pyroscope/blob/main/api/querier/v1/querier.proto#L10
#### Additional context
`-`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.