Open DifferentialOrange opened 1 year ago
Due to the implementation of internal storage, it is possible to overwrite existing observations if they have two or more labels:
tarantool> c = metrics.gauge('coll') --- ... tarantool> c:set(3, {lab = 'val', lab2 = 'val2'}) --- ... tarantool> c:collect() --- - - label_pairs: lab2: val2 lab: val timestamp: 1675671598982881 value: 3 metric_name: coll ... tarantool> c:set(4, {['lab\tval\tlab2'] = 'val2'}) --- ... tarantool> c:collect() --- - - label_pairs: "lab\tval\tlab2": val2 timestamp: 1675671636647270 value: 4 metric_name: coll ...
It is highly unlikely that someone would become a victim of this bug unintentionally, but this behavior still seems a bit problematic.
Moreover, using special symbols breaks prometheus export:
# HELP coll # TYPE coll gauge coll{lab val lab2="val2"} 4
error while linting: text format parsing error in line 3: expected '=' after label name, found 'v'
The metric counter is code hot path. Be careful it seems that new if can decrease perf a little.
if
Due to the implementation of internal storage, it is possible to overwrite existing observations if they have two or more labels:
It is highly unlikely that someone would become a victim of this bug unintentionally, but this behavior still seems a bit problematic.
Moreover, using special symbols breaks prometheus export: