templating metrics with Helm #11539
-
Hi, I have many argo-workflow templates and I need to define a custom metrics to monitor the duration of each workflow, but everytime I got this error
although I make sure that the template is correct, here is the template-file, is there any help? apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: wft-cassandra-e2e
spec:
entrypoint: cassandra-e2e
templates:
- name: cassandra-e2e
metrics:
prometheus:
- name: exec_duration_gauge
labels:
- key: name
value: wft-cassandra-e2e
help: "Duration gauge by name"
gauge:
realtime: true
value: {{ duration }}
dag:
tasks:
- name: load
templateRef:
name: load
template:load
- name: load-2
depends: load
templateRef:
name: load-2
template: load-2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think you meant to use See also the example in the docs: # ...
gauge:
value: "{{ workflow.duration }}" EDIT: |
Beta Was this translation helpful? Give feedback.
It sounds like you're trying to put the resource through Helm?
You did not mention that in your question, but that is a very important detail 😕 That would explain why it interpreted
duration
as a function, despite not using an Argo expression. Andworkflow
is indeed not a Helm function, it is an Argo variable.I thought the error sounded off initially, but did not think Helm were being used without mention...
If you're using Helm templating, you need to escape Argo's own templating. helm/helm#2798 lists several ways of doing so. The one I am most familiar with is "Option 1" from this SO answer (written by an Argo CD maintainer).
Here's how you could use that for your template:
# ...