gnmic icon indicating copy to clipboard operation
gnmic copied to clipboard

How to use encoding: bytes with convert-int-processor ?

Open andrgras opened this issue 7 months ago • 5 comments
trafficstars

Hi,

I have configuration to collect statistics, now I wanted to add "port_stats" but seems it doesn't work, I don't see anything in Influx. Seems convert-int-processor has broken output. How to fix it?

subscriptions:
  bearer_traffic_stats:
    paths:
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/gtp-u/bearer-traffic/resource[group-id=*]/dropped-downlink-packets-session-not-found"
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/gtp-u/bearer-traffic/resource[group-id=*]/per-access-type"
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/gtp-u/bearer-traffic/resource[group-id=*]/per-reference-point"
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/gtp-u/management"
    stream-mode: sample
    sample-interval: 1m
    encoding: JSON
  cpu:
    paths:
      - "/state/vm[vm-id=*]/control-plane"
      - "/state/vm[vm-id=*]/forwarding-plane"
    stream-mode: sample
    sample-interval: 1m
    encoding: JSON
  session_management:
    paths:
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/session-management/performance"
      - "/state/mobile-gateway/pdn[gw-id=1]/statistics/session-management/capacity"
    stream-mode: sample
    sample-interval: 1m
    encoding: JSON
  port_stats:
    paths:
      - "/state/port[port-id=1/1/9]/statistics/in-octets"
      - "/state/port[port-id=1/1/9]/statistics/out-octets"
    stream-mode: sample
    sample-interval: 1m
    encoding: bytes

processors:
  convert-int-processor:
    event-convert:
      value-names:
        - ".*packets.*$"
        - ".*bytes.*$"
      type: int
  sample-processor:
    event-strings:
      value-names:
        - ".*"
      transforms:
        - path-base:
            apply-on: "name"

andrgras avatar Apr 14 '25 21:04 andrgras

Can you provide a sample output of how port_stats responses look like in the cli without processors ?

karimra avatar Apr 15 '25 14:04 karimra

"source": "10.103.146.124:57400",
"timestamp": 1744782119489797450,
"time": "2025-04-16T08:41:59.48979745+03:00",
"updates": [
  {
    "Path": "state/port[port-id=1/1/9]/statistics/in-octets",
    "values": {
      "state/port/statistics/in-octets": "1938459431"

"source": "10.103.146.124:57400",
"timestamp": 1744782208969069530,
"time": "2025-04-16T08:43:28.96906953+03:00",
"updates": [
  {
    "Path": "state/port[port-id=1/1/9]/statistics/out-octets",
    "values": {
      "state/port/statistics/out-octets": "1478741738"

andrgras avatar Apr 16 '25 05:04 andrgras

@karimra any comments on this?

andrgras avatar May 16 '25 12:05 andrgras

Any comments on this?

andrgras avatar Jul 11 '25 12:07 andrgras

Your value is named octets and the processor only looks at bytes and packets?

sdktr avatar Aug 02 '25 05:08 sdktr