Gnmi metric filters behaviour

I have the following gnmi config (one per node):

[[inputs.gnmi]]
addresses = [“testnode:6030”]
username = “$USERID”
password = “$PASSWORD”

[[inputs.gnmi.subscription]]
name = “smashcounters”
origin = “eos_native”
path = “/Smash/counters/strataDebugCounter/StrataCounters/current/intfDebugCounter”
subscription_mode = “sample”
sample_interval = “60s”

[[inputs.gnmi.subscription]]
name = “lanz”
origin = “eos_native”
path = “/LANZ”
subscription_mode = “sample”
sample_interval = “60s”

The “smashcounters” subscription returns a massive amount of fields, but I am only interested in a tiny subset. I can use:

fieldpass = [“*platformCounters/rxVlanDrop”]

to filter by field, but what I found is this only works at the toplevel inputs.gnmi. The config allows metric filters to be specified in the [[inputs.gnmi.subscription]] sections but they are ignored. Looking at the code and testcases I do not see tests for this use case.

I know I can repeat [[inputs.gnmi]] sections, but this has undesirable side effects - each [[inputs.gnmi]]
opens a new connection to the node. Subscriptions are thus not shared over a single connection.

I would really like to filter as much as possible at the input stage. Currently I am letting all the fields pass to the output stage and then only allowing what I want into Kafka.

Fieldpass and the other metric filters work at the input level. They have no knowledge of the various subscriptions you are making.

You could use a starlark processor to write some logic to remove any fields you want depending on the subscription.