redpanda-data / benthos

MIT License
214 stars 61 forks source link

Unable to get Metrics for individual Switch Cases after upgrading to 4.27.0 #58

Closed diptomondal007 closed 1 month ago

diptomondal007 commented 3 months ago

Description: After upgrading from Benthos 4.10.0 to 4.27.0, we are unable to get the metrics of each switch case individually. In version 4.10.0, metrics were obtained separately for each switch case, but in version 4.27.0, the metrics are not separated by switch cases.

To Reproduce:

  1. Use the following configuration in Benthos 4.10.0:
    input:
    generate:
    count: 0
    mapping: |
      root.foo = 42
    output:
    switch:
    cases:
      - check: true
        output:
          label: ""
          retry:
            output:
              fallback:
                - http_client:
                    url: "address"
                    verb: POST
                    headers:
                      Content-Type: application/json
                - http_client:
                    url: "address"
                    verb: POST
                    headers:
                      Content-Type: application/json
      - check: false
        output:
          label: ""
          retry:
            output:
              fallback:
                - http_client:
                    url: "address"
                    verb: POST
                    headers:
                      Content-Type: application/json
                - http_client:
                    url: "address"
                    verb: POST
                    headers:
                      Content-Type: application/json
  2. Run the configuration in Benthos 4.10.0 and execute curl localhost:4195/metrics.
  3. The metrics being output as root.output.switch.0.output.fallback.0.
  4. Upgrade to Benthos 4.27.0.
  5. Run the same configuration and execute curl localhost:4195/metrics.
  6. Observe the metrics being output as root.output.switch.output.retry.output.fallback.0 without individual case differentiation.

Expected behavior:

Metrics should be separated by switch cases as in the previous version, for example:

mihaitodor commented 3 months ago

Hey @diptomondal007 👋 Nice find! I traced this issue down to v4.25.0 in bc1ebaf and raised #61 to address it.