Skip to content

Prometheus exporter counters are flattened for queues and threads #3725

Description

@mathias-lolo

vpp_get_stats

vpp_get_stats dump /if/rx | awk -v idx="$IFIDX" '
/\/if\/rx$/ {
    match($0, /\[([0-9]+) @ ([0-9]+)\]: ([0-9]+) packets/, a)
    if (a[1] == idx) printf "thread=%s  packets=%d\n", a[2], a[3]
}' | sort -t= -k2 -n
thread=0  packets=0
thread=1  packets=0
thread=2  packets=0
thread=3  packets=0
thread=4  packets=0
thread=5  packets=127098
thread=6  packets=129992
thread=7  packets=160072
thread=8  packets=135293

prometheus exporter

curl -s localhost:9482/metrics   | grep "interfaces_rx_q.*packets.*interface=\"$IFNAME\""   | awk '
{            
    match($0, /thread="([0-9]+)"/, tarr)
    match($0, / ([0-9]+)$/, varr)
    threads[tarr[1]] += varr[1]
}
END {
    for (th in threads) printf "thread=%s  packets=%d\n", th, threads[th]
}' | sort -t= -k2 -n
thread=0  packets=553560
thread=1  packets=0
thread=2  packets=0
thread=3  packets=0
thread=4  packets=0
thread=5  packets=0
thread=6  packets=0
thread=7  packets=0
thread=8  packets=0

In src/vpp/app/dump_metrics.c in print_metric_v2 loop variables(j,k) are swapped causing all counters to be summarized (LLM tells me).
This seems to be the same for both packets and bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions