forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdag-custom-metrics.yaml
103 lines (100 loc) · 3.39 KB
/
dag-custom-metrics.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# The following workflow executes the tasks in parallel and emit the data for each task
# DAG <-- The custom metric will emit the status and duration for entire workflow
# / \
# / \
# / \
# / \
# / \
# / \
# / \
# / \
# / \
# / \
# TEST-TWO TEST-ONE
# / \ / \
# / \ / \
# / \ / \
# / \ / \
# TEST-TWO-B TEST-TWO-A TEST-ONE-B TEST-ONE-B <-- The custom metric will emit the status and duration for each task in parallel
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: dag-task-
spec:
entrypoint: dag-task
metrics: # Custom metric workflow level
prometheus:
- name: playground_workflow_duration
help: "Duration gauge by workflow level"
labels:
- key: "playground_id_workflow"
value: "test"
- key: status
value: "{{workflow.status}}"
gauge:
realtime: false
value: "{{workflow.duration}}"
- name: playground_workflow_result_counter
help: "Count of workflow execution by result status - workflow level"
labels:
- key: "playground_id_workflow_counter"
value: "test"
- key: status
value: "{{workflow.status}}"
counter:
value: "1"
templates:
- name: dag-task
dag:
tasks:
- name: TEST-ONE
template: echo
arguments:
parameters:
- name: message
value: "console output-->TEST-{{item.command}}"
- name: tag
value: "{{item.tag}}"
withItems:
- { tag: TEST-ONE-A, command: ONE-A }
- { tag: TEST-ONE-B, command: ONE-B }
- name: TEST-TWO
template: echo
arguments:
parameters:
- name: message
value: "console output-->TEST-{{item.command}}"
- name: tag
value: "{{item.tag}}"
withItems:
- { tag: TEST-TWO-A, command: TWO-A }
- { tag: TEST-TWO-B, command: TWO-B }
- name: echo
inputs:
parameters:
- name: message
- name: tag
metrics: # Custom metric template level
prometheus:
- name: playground_workflow_duration_task_seconds
help: "Duration gauge by task name in seconds - task level"
labels:
- key: "playground_task_name"
value: "{{inputs.parameters.tag}}"
- key: status
value: "{{status}}"
gauge:
realtime: false
value: "{{duration}}"
- name: playground_workflow_result_task_counter
help: "Count of task execution by result status - task level"
labels:
- key: "playground_task_name_counter"
value: "{{inputs.parameters.tag}}"
- key: status
value: "{{status}}"
counter:
value: "1"
container:
image: alpine:3.7
command: [echo, "{{inputs.parameters.message}}"]