Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write dashboard: allow using cortex_request_duration_seconds native histogram #8757

Merged
merged 5 commits into from
Jul 18, 2024

Conversation

duricanikolic
Copy link
Contributor

@duricanikolic duricanikolic commented Jul 17, 2024

What this PR does

Allow using cortex_request_duration_seconds native histogram in
overview dashboard everywhere.

Which issue(s) this PR fixes or relates to

Related to #7154
Depends on grafana/jsonnet-libs#1285

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@duricanikolic duricanikolic self-assigned this Jul 17, 2024
@duricanikolic duricanikolic changed the title Yuri/native hist write dashboard Write dashboard: allow using cortex_request_duration_seconds native histogram Jul 17, 2024
@duricanikolic duricanikolic force-pushed the yuri/native-hist-write-dashboard branch from 3715e6e to 49b9e52 Compare July 17, 2024 18:57
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic force-pushed the yuri/native-hist-write-dashboard branch from 49b9e52 to e0e37d6 Compare July 17, 2024 19:02
@duricanikolic duricanikolic marked this pull request as ready for review July 17, 2024 20:07
@duricanikolic duricanikolic requested a review from a team as a code owner July 17, 2024 20:07
@krajorama
Copy link
Contributor

Generated relevant diff with _config.gateway_enabled: true:

***************
*** 468,474 ****
                    "steppedLine": false,
                    "targets": [
                       {
!                         "expr": "sum(rate(cortex_request_duration_seconds_count{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]))",
                          "format": "time_series",
                          "instant": true,
                          "refId": "A"
--- 468,480 ----
                    "steppedLine": false,
                    "targets": [
                       {
!                         "expr": "sum (rate(cortex_request_duration_seconds_count{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval])) < ($latency_metrics * +Inf)",
!                         "format": "time_series",
!                         "instant": true,
!                         "refId": "A_classic"
!                      },
!                      {
!                         "expr": "sum (histogram_count(rate(cortex_request_duration_seconds{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]))) < ($latency_metrics * -Inf)",
                          "format": "time_series",
                          "instant": true,
                          "refId": "A"
***************
*** 697,703 ****
                    "span": 4,
                    "targets": [
                       {
!                         "expr": "sum by (status) (\n  label_replace(label_replace(rate(cortex_request_duration_seconds_count{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]),\n  \"status\", \"${1}xx\", \"status_code\", \"([0-9])..\"),\n  \"status\", \"${1}\", \"status_code\", \"([a-zA-Z]+)\"))\n",
                          "format": "time_series",
                          "legendFormat": "{{status}}",
                          "refId": "A"
--- 703,715 ----
                    "span": 4,
                    "targets": [
                       {
!                         "expr": "sum by (status) (\n  label_replace(label_replace(rate(cortex_request_duration_seconds_count{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]),\n  \"status\", \"${1}xx\", \"status_code\", \"([0-9])..\"),\n  \"status\", \"${1}\", \"status_code\", \"([a-zA-Z]+)\"))\n < ($latency_metrics * +Inf)",
!                         "format": "time_series",
!                         "legendFormat": "{{status}}",
!                         "refId": "A_classic"
!                      },
!                      {
!                         "expr": "sum by (status) (\n  label_replace(label_replace(histogram_count(rate(cortex_request_duration_seconds{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval])),\n  \"status\", \"${1}xx\", \"status_code\", \"([0-9])..\"),\n  \"status\", \"${1}\", \"status_code\", \"([a-zA-Z]+)\"))\n < ($latency_metrics * -Inf)",
                          "format": "time_series",
                          "legendFormat": "{{status}}",
                          "refId": "A"
***************
*** 746,767 ****
                    "span": 4,
                    "targets": [
                       {
!                         "expr": "histogram_quantile(0.99, sum by (le) (cluster_job_route:cortex_request_duration_seconds_bucket:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3",
                          "format": "time_series",
                          "legendFormat": "99th percentile",
!                         "refId": "A"
                       },
                       {
!                         "expr": "histogram_quantile(0.50, sum by (le) (cluster_job_route:cortex_request_duration_seconds_bucket:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3",
                          "format": "time_series",
                          "legendFormat": "50th percentile",
!                         "refId": "B"
                       },
                       {
!                         "expr": "1e3 * sum(cluster_job_route:cortex_request_duration_seconds_sum:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}) / sum(cluster_job_route:cortex_request_duration_seconds_count:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})",
                          "format": "time_series",
                          "legendFormat": "Average",
!                         "refId": "C"
                       }
                    ],
                    "title": "Latency",
--- 758,797 ----
                    "span": 4,
                    "targets": [
                       {
!                         "expr": "histogram_quantile(0.99, sum by (le) (cluster_job_route:cortex_request_duration_seconds_bucket:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3 < ($latency_metrics * +Inf)",
                          "format": "time_series",
                          "legendFormat": "99th percentile",
!                         "refId": "A_classic"
!                      },
!                      {
!                         "expr": "histogram_quantile(0.99, sum (cluster_job_route:cortex_request_duration_seconds:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3 < ($latency_metrics * -Inf)",
!                         "format": "time_series",
!                         "legendFormat": "99th percentile",
!                         "refId": "A_native"
                       },
                       {
!                         "expr": "histogram_quantile(0.50, sum by (le) (cluster_job_route:cortex_request_duration_seconds_bucket:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3 < ($latency_metrics * +Inf)",
                          "format": "time_series",
                          "legendFormat": "50th percentile",
!                         "refId": "B_classic"
                       },
                       {
!                         "expr": "histogram_quantile(0.50, sum (cluster_job_route:cortex_request_duration_seconds:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) * 1e3 < ($latency_metrics * -Inf)",
!                         "format": "time_series",
!                         "legendFormat": "50th percentile",
!                         "refId": "B_native"
!                      },
!                      {
!                         "expr": "1e3 * sum(cluster_job_route:cortex_request_duration_seconds_sum:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}) /\nsum(cluster_job_route:cortex_request_duration_seconds_count:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})\n < ($latency_metrics * +Inf)",
                          "format": "time_series",
                          "legendFormat": "Average",
!                         "refId": "C_classic"
!                      },
!                      {
!                         "expr": "1e3 * sum(histogram_sum(cluster_job_route:cortex_request_duration_seconds:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"})) /\nsum(histogram_count(cluster_job_route:cortex_request_duration_seconds:sum_rate{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}))\n < ($latency_metrics * -Inf)",
!                         "format": "time_series",
!                         "legendFormat": "Average",
!                         "refId": "C_native"
                       }
                    ],
                    "title": "Latency",
***************
*** 808,814 ****
                    "targets": [
                       {
                          "exemplar": true,
!                         "expr": "histogram_quantile(0.99, sum by(le, pod) (rate(cortex_request_duration_seconds_bucket{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval])))",
                          "format": "time_series",
                          "legendFormat": "",
                          "legendLink": null
--- 838,851 ----
                    "targets": [
                       {
                          "exemplar": true,
!                         "expr": "histogram_quantile(0.99, sum by (le,pod) (rate(cortex_request_duration_seconds_bucket{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]))) < ($latency_metrics * +Inf)",
!                         "format": "time_series",
!                         "legendFormat": "",
!                         "legendLink": null
!                      },
!                      {
!                         "exemplar": true,
!                         "expr": "histogram_quantile(0.99, sum by (pod) (rate(cortex_request_duration_seconds{cluster=~\"$cluster\", job=~\"($namespace)/((gateway|cortex-gw.*))\", route=~\"api_(v1|prom)_push|otlp_v1_metrics\"}[$__rate_interval]))) < ($latency_metrics * -Inf)",
                          "format": "time_series",
                          "legendFormat": "",
                          "legendLink": null

which looks ok

Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I don't see classic-only mentions of the metric.

CHANGELOG.md Outdated
* Overview dashboard: status, read/write latency and queries/ingestion per sec panels, `cortex_request_duration_seconds` metric.
* [ENHANCEMENT] Dashboards: allow switching between using classic or native histograms in dashboards.
* Overview dashboard: status, read/write latency and queries/ingestion per sec panels, `cortex_request_duration_seconds` metric. #7674 #8502
* Write dashboard: `cortex_request_duration_seconds` metric. #8757
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
* Write dashboard: `cortex_request_duration_seconds` metric. #8757
* Writes dashboard: `cortex_request_duration_seconds` metric. #8757

* Overview dashboard: status, read/write latency and queries/ingestion per sec panels, `cortex_request_duration_seconds` metric.
* [ENHANCEMENT] Dashboards: allow switching between using classic or native histograms in dashboards.
* Overview dashboard: status, read/write latency and queries/ingestion per sec panels, `cortex_request_duration_seconds` metric. #7674
* Write dashboard: `cortex_request_duration_seconds` metric. #8757
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Write dashboard: `cortex_request_duration_seconds` metric. #8757
* Writes dashboard: `cortex_request_duration_seconds` metric. #8757

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic merged commit e10027d into main Jul 18, 2024
31 checks passed
@duricanikolic duricanikolic deleted the yuri/native-hist-write-dashboard branch July 18, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants