feat(metrics): add pipeline_id and pipeline_name labels to prometheus metrics#681
feat(metrics): add pipeline_id and pipeline_name labels to prometheus metrics#681pgaijin66 wants to merge 4 commits intocodefresh-io:mainfrom
Conversation
… metrics Gated behind METRICS_INCLUDE_PIPELINE_NAME env var. When set, workflow and agent histogram metrics include pipeline_id and pipeline_name labels. Pipeline names are sanitized to lowercase alphanumeric with underscores.
|
Hey @zarbis, would appreciate a review on this when you get a chance. Pretty small change that saves operators from building workarounds just to get readable pipeline names in their Grafana dashboards. Thanks! |
Cover sanitizeLabelValue and metric observation functions.
|
Hey @pgaijin66, highly appreciate your contribution! I would also greatly appreciate your input on how/when you rely on Runner metrics. This will help us to better understand your use case and align it with our internal vision for these metrics. In the meantime, I would recommend using Please find the full list of available metrics, and some Grafana dashboards in the docs: https://codefresh.io/docs/docs/installation/runner/classic-runtime-monitoring/ |
| CreatedAt string `json:"createdAt"` | ||
| ReName string `json:"reName"` | ||
| WorkflowId string `json:"workflowId"` | ||
| PipelineId string `json:"pipelineId"` |
There was a problem hiding this comment.
@pgaijin66 Unfortunately, neither pipelineId nor pipelineName are part of the incoming Task metadata, so this approach will not work.
|
@pgaijin66 Unfortunately, proposed solution will not work: see #681 (comment). I don't see other straightforward way to enrich Runner's metrics with With this said, I am inviting you to continue discussion here: #681 (comment). Please explore mentioned above available metrics of the Looking for your feedback! |
Summary
When building Grafana dashboards for Codefresh pipeline metrics, the runner/engine only exports
pipeline_idas a hash in metric labels. There's nopipeline_name, so dashboards end up showing opaque IDs instead of human-readable pipeline names.The workarounds people end up doing are all pretty annoying:
/metricsendpoint that maps IDs to names, then joining in PromQLAll of these add unnecessary dependencies for something that should just be available natively.
Changes
pipeline_idandpipeline_namelabels to workflow and agent histogram metricsMETRICS_INCLUDE_PIPELINE_NAMEenv var (fully opt-in, no change when unset)PipelineIdandPipelineNamefields to task metadataUsage
Set the env var on the runner deployment to enable pipeline labels:
Expected behavior
Without
METRICS_INCLUDE_PIPELINE_NAME(default, no change):With
METRICS_INCLUDE_PIPELINE_NAME=true:Affected metrics
runner_wf_duration_since_creation_secrunner_wf_duration_in_runner_secrunner_wf_processing_secrunner_agent_processing_sec