9
9
default : ' 1'
10
10
type : string
11
11
run_number :
12
- description : ' Number of run tries per runner'
12
+ description : ' Number of run tries per runner (values greater than 1 are not supported with grafana) '
13
13
required : false
14
14
default : ' 1'
15
15
type : string
18
18
required : false
19
19
default : manual-run
20
20
type : string
21
- aggregate :
22
- description : ' Aggregate data'
21
+ push_results :
22
+ description : ' Push metrics into github'
23
+ required : false
24
+ default : false
25
+ type : boolean
26
+ send_to_grafana :
27
+ description : ' Send metrics to grafana'
23
28
required : false
24
29
default : false
25
30
type : boolean
32
37
default : ' 1'
33
38
type : string
34
39
run_number :
35
- description : ' Number of run tries per runner'
40
+ description : ' Number of run tries per runner (values greater than 1 are not supported with grafana) '
36
41
required : false
37
42
default : ' 1'
38
43
type : string
41
46
required : false
42
47
default : manual-run
43
48
type : string
44
- aggregate :
45
- description : ' Aggregate data'
49
+ push_results :
50
+ description : ' Push metrics into github'
51
+ required : false
52
+ default : false
53
+ type : boolean
54
+ send_to_grafana :
55
+ description : ' Send metrics to grafana'
46
56
required : false
47
57
default : false
48
58
type : boolean
49
59
50
60
env :
51
61
data_branch : monitoring-data
52
62
data_path : monitoring/data
53
- aggregated_data_branch : monitoring-aggregated-data
54
- aggregated_data_path : monitoring/aggregated_data
55
63
monitoring_properties : monitoring/monitoring.properties
56
64
push_script : monitoring/push_with_rebase.sh
57
65
65
73
id : set-matrix
66
74
run : |
67
75
arr=$(echo [$(seq -s , ${{ inputs.runners }})])
68
- echo "::set-output name= matrix:: $arr"
76
+ echo "matrix= $arr" >> $GITHUB_OUTPUT
69
77
echo $arr
70
78
71
79
build_and_collect_statistics :
@@ -112,27 +120,31 @@ jobs:
112
120
- name : Get current date
113
121
id : date
114
122
run : |
115
- echo "::set-output name= date:: $(date +'%Y-%m-%d')"
116
- echo "::set-output name= timestamp:: $(date +%s)"
117
- echo "::set-output name= last_month:: $(date --date='last month' +%s)"
123
+ echo "date= $(date +'%Y-%m-%d-%H-%M-%S ')" >> $GITHUB_OUTPUT
124
+ echo "timestamp= $(date +%s)" >> $GITHUB_OUTPUT
125
+ echo "last_month= $(date --date='last month' +%s)" >> $GITHUB_OUTPUT
118
126
119
127
- name : Get metadata
120
128
id : metadata
121
129
run : |
122
- echo "::set-output name= commit:: $(git rev-parse HEAD)"
123
- echo "::set-output name= short_commit:: $(git rev-parse --short HEAD)"
124
- echo "::set-output name= branch:: $(git name-rev --name-only HEAD)"
125
- echo "::set-output name= build:: $(date +'%Y.%-m')"
130
+ echo "commit= $(git rev-parse HEAD)" >> $GITHUB_OUTPUT
131
+ echo "short_commit= $(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
132
+ echo "branch= $(git name-rev --name-only HEAD)" >> $GITHUB_OUTPUT
133
+ echo "build= $(date +'%Y.%-m')" >> $GITHUB_OUTPUT
126
134
127
135
- name : Insert metadata
136
+ id : insert
128
137
shell : bash
129
138
run : |
130
- OUT_FILE="$data_path/data-$branch-$date-$timestamp-$short_commit-${{ matrix.value }}.json"
139
+ OUT_FILE="$data_path/$date-$branch-$short_commit-${{ matrix.value }}.json"
140
+ echo "output=$OUT_FILE" >> $GITHUB_OUTPUT
141
+
131
142
INPUTS=($(seq ${{ inputs.run_number }}))
132
143
INPUTS=(${INPUTS[@]/#/stats-})
133
144
INPUTS=(${INPUTS[@]/%/.json})
134
145
INPUTS=${INPUTS[@]}
135
146
echo $INPUTS
147
+
136
148
python monitoring/insert_metadata.py \
137
149
--stats_file $INPUTS \
138
150
--output_file "$OUT_FILE" \
@@ -151,7 +163,14 @@ jobs:
151
163
build : ${{ steps.metadata.outputs.build }}
152
164
run_id : ${{ github.run_id }}-${{ matrix.value }}
153
165
166
+ - name : Upload statistics
167
+ uses : actions/upload-artifact@v3
168
+ with :
169
+ name : statistics-${{ matrix.value }}
170
+ path : ${{ steps.insert.outputs.output }}
171
+
154
172
- name : Commit and push statistics
173
+ if : ${{ inputs.push_results }}
155
174
run : |
156
175
chmod +x $push_script
157
176
./$push_script
@@ -161,63 +180,17 @@ jobs:
161
180
message : ${{ inputs.message_prefix }}-${{ steps.date.outputs.date }}
162
181
github_token : ${{ secrets.GITHUB_TOKEN }}
163
182
183
+ - name : Send metrics to grafana
184
+ if : ${{ inputs.send_to_grafana }}
185
+ run : |
186
+ python monitoring/prepare_metrics.py --stats_file $stats_file --output_file grafana_metrics.json
187
+ echo "TODO send metrics to grafana"
188
+ env :
189
+ stats_file : ${{ steps.insert.outputs.output }}
190
+
164
191
- name : Upload logs
165
192
if : ${{ always() }}
166
193
uses : actions/upload-artifact@v3
167
194
with :
168
195
name : logs-${{ matrix.value }}
169
196
path : logs/
170
-
171
- aggregate :
172
- needs : build_and_collect_statistics
173
- if : ${{ inputs.aggregate }}
174
- runs-on : ubuntu-latest
175
- steps :
176
- - name : Checkout repository
177
- uses : actions/checkout@v3
178
-
179
- - name : Checkout monitoring data
180
- uses : actions/checkout@v3
181
- with :
182
- ref : ${{ env.data_branch }}
183
- path : ${{ env.data_path }}
184
-
185
- - name : Checkout aggregated monitoring data
186
- uses : actions/checkout@v3
187
- with :
188
- ref : ${{ env.aggregated_data_branch }}
189
- path : ${{ env.aggregated_data_path }}
190
-
191
- - uses : actions/setup-python@v4
192
- with :
193
- python-version : ' 3.9'
194
-
195
- - name : Get current date
196
- id : date
197
- run : |
198
- echo "::set-output name=date::$(date +'%Y-%m-%d')"
199
- echo "::set-output name=timestamp::$(date +%s)"
200
- echo "::set-output name=last_month::$(date --date='last month' +%s)"
201
-
202
- - name : Build aggregated data (last month)
203
- run : |
204
- OUT_FILE=$aggregated_data_path/aggregated-data-$date.json
205
- python monitoring/build_aggregated_data.py \
206
- --input_data_dir $data_path \
207
- --output_file $OUT_FILE \
208
- --timestamp_from $timestamp_from \
209
- --timestamp_to $timestamp
210
- env :
211
- date : ${{ steps.date.outputs.date }}
212
- timestamp : ${{ steps.date.outputs.timestamp }}
213
- timestamp_from : ${{ steps.date.outputs.last_month }}
214
-
215
- - name : Commit and push aggregated statistics
216
- run : |
217
- chmod +x $push_script
218
- ./$push_script
219
- env :
220
- target_branch : ${{ env.aggregated_data_branch }}
221
- target_directory : ${{ env.aggregated_data_path }}
222
- message : ${{ inputs.message_prefix }}-${{ steps.date.outputs.date }}
223
- github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments