argoproj / argoproj/argo-workflows
Use template name in custom metric label definition
- Dominant language
- Go
- Stars
- 17k
- Forks
- 3.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 138
Description
# Summary
We want to collect duration steps for every part of the workflow but for now template name is not available in variables so we can not refer to it while defining labels.
# Use Cases
Collect the same metrics for all steps/tasks in workflow.
```yaml
templateDefaults:
metrics:
prometheus:
- name: result_counter
help: "Count of step execution by result status"
labels:
- key: template_name
value: "{{templateName}}"
- key: status
value: "{{status}}" # Argo variable in `labels`
counter:
value: "1"
```
Also it would be nice to have some common metrics defined on the controller level so later it's possible to reference this definitions in specs. i.e.:
```yaml
metrics:
prometheus:
- name: result_counter
metricsRef: result_counter
```
---
**Message from the maintainers**:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.
Contributor guide
Research direction
Start by tracing workflow templateDefaults.metrics.prometheus label definitions and the templateName and status variables shown in the example. Determine how controller-level metrics could be referenced through metricsRef in workflow specs; done means template names are usable in custom labels and shared definitions can be referenced as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, prometheus
- Domain
- backend, observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100