2020-04-07 08:09:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module CustomMetricsHelper
|
|
|
|
def custom_metrics_data(project, metric)
|
|
|
|
{
|
2020-07-27 08:09:50 -04:00
|
|
|
'custom-metrics-path' => url_for([project, metric]),
|
2020-04-07 08:09:34 -04:00
|
|
|
'metric-persisted' => metric.persisted?.to_s,
|
2021-06-18 11:10:16 -04:00
|
|
|
'edit-project-service-path' => edit_project_service_path(project, ::Integrations::Prometheus),
|
2020-04-07 08:09:34 -04:00
|
|
|
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
|
|
|
|
'title' => metric.title.to_s,
|
|
|
|
'query' => metric.query.to_s,
|
|
|
|
'y-label' => metric.y_label.to_s,
|
|
|
|
'unit' => metric.unit.to_s,
|
|
|
|
'group' => metric.group.to_s,
|
|
|
|
'legend' => metric.legend.to_s
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|