0

I created custom metrics with IstioOperator as such (example only in inboundSidecar, but I also add it for outboundSidecar and Gateway)

 telemetry:
      v2:
        prometheus:
          configOverride:
            inboundSidecar:
              debug: true
              definitions:
                - name: proxy_latency_milliseconds
                  type: 'HISTOGRAM'
                  value: "(request.duration - duration(response.headers['x-envoy-upstream-service-time']+'ms')).getMilliseconds()"
              stat_prefix: istio

I want this proxy_latency_milliseconds to be differentiated based on whether it is in inbound sidecar, outbound sidecar, or gateway. For default istio metrics, there is label called reporter, but I can't find that label on this custom metrics. How do I get it?

I have tried adding a custom dimension label by name proxy_type, each with a different value such as:

                - dimensions:
                    request_host: request.host
                    request_method: request.method
                    route_name: route_name
                    response_code_details: '(response.code_details == "via_upstream") ? response.code_details : "other"'
                    proxy_type: "inbound"

however, when I see the actual metrics, it is actually shown as "unknown" instead of "inbound" or "outbound" or "gateway".

Jon Bates
  • 3,055
  • 2
  • 30
  • 48
Isa A
  • 1,342
  • 13
  • 31

1 Answers1

0

You should be able to reuse the reporter value, can you please try to add a label to your custom metric and add the $REPORTER there, as shown below?

definitions:
                - name: proxy_latency_milliseconds
                  type: 'HISTOGRAM'
                  value: "(request.duration - duration(response.headers['x-envoy-upstream-service-time']+'ms')).getMilliseconds()"
                  labels:
                    reporter: "$REPORTER"
Isaiah4110
  • 9,855
  • 1
  • 40
  • 56
  • That's nice to know, I'll try later. how I solved it was to add another single quote inside the double quotes. Such as "'inbound'" or "'gateway'" – Isa A Apr 07 '23 at 06:54