Need help dropping gNMI metric

Hello dear experts,

Need help please removing a metric from gNMI input.

gNMI input config is as follows:

    [[inputs.gnmi]]
       addresses = [ "" ]
       username = ""
       password = ""
       encoding = "json"
       redial = "10s"
       keepalive_time = "15s"
       keepalive_timeout = "90s"
       tls_enable = false
       namedrop = [ "ttest_port_stats_egress_queue_queue_queue_id" ]
      [[inputs.gnmi.subscription]]
       name = "ttest_egress_queue"
       origin = "nokia-state"
       path = "/state/port[port-id=*]/statistics/egress-queue/queue[queue-id=*]/drop-unicast-packets"
       subscription_mode = "sample"
       sample_interval = "60s"
      [[inputs.gnmi.subscription]]
       name = "ttest_port_stats"
       origin = "nokia-state"
       path = "/state/port[port-id=*]/statistics/"
       subscription_mode = "sample"
       sample_interval = "60s"
    [[processors.enum]]
    [[processors.converter]]
      [processors.converter.fields]
        integer = ["out_*", "in_*", "up_time", "drop_unicast_packets", "drop_multicast_packets", "drop_unicast_octets", "drop_multicast_octets"]

The problem is that “/state/port[port-id=*]/statistics/” produces some nested metrics, one of which I need to remove.

This problematic metric looks like that when I curl telegraf:9273/metrics:

ttest_port_stats_egress_queue_queue_queue_id{
	egress_queue_queue_drop_multicast_octets="0",
	egress_queue_queue_drop_unicast_octets="0",
	egress_queue_queue_forward_multicast_octets="0",
	egress_queue_queue_forward_multicast_packets="0",
	egress_queue_queue_forward_unicast_octets="33450830",
	egress_queue_queue_forward_unicast_packets="365075",
	path="/state/port/statistics/egress-queue/queue",
	port_id="x",
	queue_id="1",
	rmrw="allowed",
	source="127.0.0.1"
} 1

I want to get rid of this metric, but still be able to subscribe to “/state/port[port-id=*]/statistics/egress-queue/queue[queue-id=*]/drop-unicast-packets”

I also tried:

       namedrop = [ "*queue_id" ]
       namedrop = [ "*queue_queue_id" ]
       namedrop = [ "queue_id" ]
       tagdrop = [ "egress_queue_queue_forward_unicast_packets" ]
       fieldexclude = [ "egress_queue_queue_forward_unicast_packets", "queue_id" ]

But still I see the metric in telegraf and in Grafana.

Can you paste an example metric output using –test showing the one that needs to be dropped?

Hello,

I tried to run it with –test, but I don’t see gNMI metrics in the output.

Here’s the output without irrelevant metrics:

2025-08-22T04:50:13Z I! Loading config: /etc/telegraf/telegraf.conf
2025-08-22T04:50:13Z I! Loading config: /etc/telegraf.d/test.conf
2025-08-22T04:50:13Z I! Starting Telegraf 1.32.1 brought to you by InfluxData the makers of InfluxDB
2025-08-22T04:50:13Z I! Available plugins: 235 inputs, 9 aggregators, 32 processors, 26 parsers, 62 outputs, 6 secret-stores
2025-08-22T04:50:13Z I! Loaded inputs: gnmi prometheus (3x)
2025-08-22T04:50:13Z I! Loaded aggregators:
2025-08-22T04:50:13Z I! Loaded processors: converter enum
2025-08-22T04:50:13Z I! Loaded secretstores:
2025-08-22T04:50:13Z W! Outputs are not used in testing mode!
2025-08-22T04:50:13Z I! Tags enabled: rmrw=allowed
2025-08-22T04:50:13Z D! [agent] Initializing plugins
2025-08-22T04:50:13Z I! [inputs.prometheus] Using the label selector:  and field selector: 
2025-08-22T04:50:13Z I! [inputs.prometheus] Using the label selector:  and field selector: 
2025-08-22T04:50:13Z I! [inputs.prometheus] Using the label selector:  and field selector: 
2025-08-22T04:50:13Z D! [inputs.gnmi] Internal alias mapping: map[nokia-state:/state/port/statistics/egress-queue/queue/drop-unicast-packets:ttest_egress_queue nokia-state:/state/port/statistics/egress-queue/queue/drop-multicast-packets:ttest_egress_queue nokia-state:/state/port/statistics/egress-queue/queue/pipeline-drop-unicast-octets:ttest_egress_queue nokia-state:/state/port/statistics/egress-queue/queue/pipeline-drop-multicast-octets:ttest_egress_queue nokia-state:/state/port/statistics:ttest_port_stats]
2025-08-22T04:50:13Z D! [agent] Starting service inputs
...
2025-08-22T04:50:14Z D! [agent] Stopping service inputs
2025-08-22T04:50:14Z D! [inputs.gnmi] Connection to gNMI device x.x.x.x:xxxx closed
2025-08-22T04:50:14Z D! [agent] Input channel closed
2025-08-22T04:50:14Z D! [agent] Processor channel closed
2025-08-22T04:50:14Z D! [agent] Processor channel closed
2025-08-22T04:50:14Z D! [agent] Stopped Successfully

Found –test-wait option:

> ttest_port_stats,
	path=/state/port/statistics/egress-queue/queue,
	port_id=1/1/1,
	queue_id=1,
	rmrw=allowed,
	source=127.0.0.1 
	egress_queue/queue/drop_multicast_octets="0",
	egress_queue/queue/drop_unicast_octets="0",
	egress_queue/queue/forward_multicast_octets="0",
	egress_queue/queue/forward_multicast_packets="0",
	egress_queue/queue/forward_unicast_octets="0",
	egress_queue/queue/forward_unicast_packets="0",
	egress_queue/queue/queue_id=1 
	1755839681718405480

Cannot filter by path, as I still need these metrics:

> ttest_egress_queue,
	path=/state/port/statistics/egress-queue/queue,
	port_id=1/1/1,
	queue_id=1,
	rmrw=allowed,
	source=127.0.0.1 
	drop_multicast_packets=0i 
	1755839681717340605

Tried namedrop = [ “egress_queue_queue_queue_id” ], didn’t work

Feels like this did the trick:

fielddrop = ["egress_queue/queue/drop_multicast_octets", "egress_queue/queue/drop_multicast_packets", "egress_queue/queue/drop_unicast_octets", "egress_queue/queue/forward_multicast_octets", "egress_queue/queue/forward_multicast_packets", "egress_queue/queue/forward_unicast_octets", "egress_queue/queue/forward_unicast_packets", "egress_queue/queue/pipeline_drop_multicast_octets", "egress_queue/queue/queue_id" ]