Draft: Time measurement PPX: Binding several keys for the same measurement
Context
The current PPX rewriter intentionally fails if several attributes of the same kind are detected on the same expression.
This validation step was added when the payload (which gives a key that can be bound to measurements) of [@time.duration]
, [time.duration_lwt]
, and [time.timestamp_pre]
attributes contained only the label.
At this time, adding a new attribute to an expression that was already annotated with the same kind of attribute was redundant and caused useless work (the time measurement and the handling of the state was done several times for nothing).
This is why this behavior had been prohibited.
Summary
Today, things have changed as the key was enriched with metadata. It could now be useful to bind different keys / meanings to the same measurement, depending on end user needs. It would be great if the user could annotate several times a same expression with [@time.duration]
, [time.duration_lwt]
, and [time.timestamp_pre]
attributes.
However, this feature should be done in a cleaver way: If several attributes of the same kind are detected on the same expression, the rewriter should make the measurement only once and then bind it to the corresponding keys (which is not the case actually).
On its side, annotating several times a same expression with [@time.flush]
should still be prohibited.
This issue follows this discussion on !3410 (merged).
Why is it ok to have multiple attributes of different kinds but not multiple of same one ?