gnmic
gnmic copied to clipboard
event-override-ts: Add changing precision of event timestamp
Override TS can change the precision of an event using "now". It would be great to add an option to change the precision of event original timestamp.
This is what I'm currently using in Starlark to change the timestamp from ns to ms.
change-ts-precision:
event-starlark:
source: |
def apply(*events):
for e in events:
# change timestmap to ms
e.timestamp = int(e.timestamp / 1000 /1000)
return events
My issue with implementing this is having to "guess" the unit of the original timestamp.
Making it a configurable attribute (from: ns
) feels a bit too rigid of an option to me.
Isn't the original timestamp already known and using a "ns"? Can the from: ns
be ignored for that case?
Yes, for servers which behave according to the spec. I guess we can ignore misbehaving servers in this case.
I can see possibly issues when using gnmic -> nats -> gnmic.