serving icon indicating copy to clipboard operation
serving copied to clipboard

The revision_request_count metric does not appear to resemble a counter metric.

Open yabea opened this issue 1 year ago • 7 comments

Ask your question here:

Hi, I'm using the metrics of knative serving, and I see that the type of the revision_request_count metric is counter. I have also confirmed in code that it is a counter type. but the collected data is not continuosly increasing. image

What could be the reason for this?

txs.

yabea avatar Feb 21 '24 12:02 yabea

Hi @yabea here are some more details and example similar to the above:

image

  • You have multiple series, one per pod, thus the different countings. For the cardinality issue check: https://github.com/knative/serving/issues/11248
  • When Prometheus scrapes a pod it will get the value of counter exported at scraping time.

skonto avatar Mar 05 '24 11:03 skonto

Hi, I have also encountered the same issue. If no requests come for ~10 minutes, the graph starts showing no value in my case as well. Whenever a request comes, the count starts from 1. Upon digging further I found out that other metrics are also null in the same time period when there is no data in the graph. Metrics such as revision_app_request_count, revision_app_request_latencies_bucket, revision_request_latencies_bucket, revision_request_latencies_sum etc. are all null. The only metrics available are of golang- revision_go_* metrics. Whenever a request comes in I can see all of the metrics start from scratch. I checked this by entering the container and sending a curl request to http://localhost:9091/metrics.

shauryagoel avatar Mar 11 '24 10:03 shauryagoel

@shauryagoel hi, could you add more details like screenshot of your prom query and pod status eg. does it scale down or not?

skonto avatar Mar 11 '24 11:03 skonto

I am using knative v1.7 and here is a sample yaml which gives the error-

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello
  namespace: testing
  annotations:
    prometheus.io/scrape: 'true'
    prometheus.io/port: '9091'
    prometheus.io/path: /metrics
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/target: '10'
        autoscaling.knative.dev/min-scale: '1'
        autoscaling.knative.dev/max-scale: '100'
    spec:
      containers:
        - image: ghcr.io/knative/helloworld-go:latest
          ports:
            - containerPort: 8080
          env:
            - name: TARGET
              value: World

The pod does not scale down as min scale is set to 1 above. Still I am getting the same error. Prom query- revision_app_request_count{configuration_name="hello"} Output is similar to what is attached in the issue; data is missing.

shauryagoel avatar Mar 11 '24 11:03 shauryagoel

Could you try with a community supported version? 1.7 is too old.

skonto avatar Mar 11 '24 11:03 skonto

Hi, is there some parameter which adjusts the duration of the metrics export? This parameter is most likely set to around 10min as discussed previously. I am currently unable to deploy to a higher version of knative as we have a knative dependency of <=1.9.

shauryagoel avatar Mar 14 '24 05:03 shauryagoel

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jun 13 '24 01:06 github-actions[bot]