gnmic icon indicating copy to clipboard operation
gnmic copied to clipboard

event-override-ts: Add changing precision of event timestamp

Open smalenfant opened this issue 1 year ago • 4 comments

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

smalenfant avatar Jun 19 '23 14:06 smalenfant

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.

karimra avatar Jun 28 '23 00:06 karimra

Isn't the original timestamp already known and using a "ns"? Can the from: ns be ignored for that case?

smalenfant avatar Jun 28 '23 13:06 smalenfant

Yes, for servers which behave according to the spec. I guess we can ignore misbehaving servers in this case.

karimra avatar Jun 28 '23 13:06 karimra

I can see possibly issues when using gnmic -> nats -> gnmic.

smalenfant avatar Jun 28 '23 14:06 smalenfant