openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
177 stars 57 forks source link

Access to Deletes Field in Event Processors #362

Closed wendall-robinson closed 9 months ago

wendall-robinson commented 9 months ago

Hello,

I hope this finds you well. My team just converted our telemetry application to use the Event type format from the JSON type to make use of the event processors. Today I noticed that in some of the event processors, I didn't check them all, we don't have access to the deletes field of the event message like we do to the tags, tag-names, values and value-names fields. Here is an example for event-add-tag which is one we are particularly interested in.

In our use case we process deletes as is but we are exploring adding a unique tag based on some matching condition in the delete path. Is omitting access to this field by design or something that can be added?

We also noticed that some delete messages, and only delete messages, do not have their path attributes parsed and placed into the Tags field of the event message.

Here is an example of the event message when we add a VRF to a switch and the attributes are added to Tags:

Subscription Name: arista_vrf
Timestamp: 1706059374930759556
Tags: map[network-instance_name:test-vrf source:arista_switch_one:6030 subscription-name:arista_vrf]
Deletes: []
Values: map[/network-instances/network-instance/config/name:test-vrf]

Here is an example when we delete the VRF and the path attributes are still in the path and not in the Tags

Subscription Name: arista_vrf
Timestamp: 1706061281759387195
Tags: map[source:arista_switch_one:6030 subscription-name:arista_vrf]
Deletes: [network-instances/network-instance[name=test-vrf]]
Values: map[]

Thank you in advance for any information

Wendall Robinson Staff Software Engineer - Software Networking, Equinix Metal

karimra commented 9 months ago

Hi,

Initially , the event format and the processors were meant to be used with stream sample subscriptions and TSDB outputs. In that context, deletes are not needed (and not sent by the router). What you are asking for can definitely be added, there will be separate event messages for updates and deletes. The keys from the deleted path will be added as tags and the path will be stripped from the keys (just like values). Then, add a deletes field to processors (for those where it makes sense). could you share which output type you plan to use or are already using ?

wendall-robinson commented 9 months ago

Hello @karimra ,

I appreciate the context and information here. We currently use the NATs type output and for the foreseeable future we will likely continue to use it.

karimra commented 9 months ago

@wendall-robinson v0.35.1 now extracts tags from deleted paths and the event-add-tag has a deletes: attribute. Please give it a try when you have time.

wendall-robinson commented 9 months ago

Thank you, As usual @karimra you are doing amazing work. We really appreciate it!