Skip to content

Commit 004e3e3

Browse files
committed
Fix for QA failure
1 parent 5f701b5 commit 004e3e3

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

qa/1890

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,45 @@ _filter_opentelemetry_labels()
5656
# end
5757
}
5858

59+
_reorder_labels()
60+
{
61+
awk '
62+
/^[^#].*{.*=.*}/ {
63+
match($0, /^([^{]+){([^}]+)}(.*)$/, a)
64+
metric = a[1]
65+
labels_str = a[2]
66+
rest = a[3]
67+
68+
delete labels
69+
n = split(labels_str, pairs, ",")
70+
for (i = 1; i <= n; i++) {
71+
match(pairs[i], /^([^=]+)=(.+)$/, kv)
72+
key = kv[1]
73+
value = kv[2]
74+
labels[key] = value
75+
}
76+
77+
order = "url agent hostname domainname machineid source my_sum_attribute"
78+
split(order, order_arr, " ")
79+
80+
output = metric "{"
81+
first = 1
82+
for (i = 1; i <= length(order_arr); i++) {
83+
key = order_arr[i]
84+
if (key in labels) {
85+
if (!first) output = output ","
86+
output = output key "=" labels[key]
87+
first = 0
88+
}
89+
}
90+
output = output "}" rest
91+
print output
92+
next
93+
}
94+
{print}
95+
'
96+
}
97+
5998
need_restore=true
6099
_prepare_pmda opentelemetry
61100
trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -83,7 +122,7 @@ fi
83122

84123
echo; echo === /metrics webapi listing. The instname label should appear only once.
85124
curl -Gs 'http://localhost:44322/metrics?names=opentelemetry.duplicate.somemetric' \
86-
| _filter_opentelemetry_labels
125+
| _filter_opentelemetry_labels | _reorder_labels
87126

88127
echo; echo === verify metric name validity using pminfo
89128
pminfo -v opentelemetry

0 commit comments

Comments
 (0)