Skip to content

Instantly share code, notes, and snippets.

@Stono
Last active January 21, 2024 11:16
Show Gist options
  • Save Stono/9ad07fca8c447c3ee3ac2c8a546d8acf to your computer and use it in GitHub Desktop.
Save Stono/9ad07fca8c447c3ee3ac2c8a546d8acf to your computer and use it in GitHub Desktop.
groups:
# These sum(irate()) functions are in separate groups, so they run in parallel
- name: istio.workload.istio_request_duration_milliseconds_bucket
interval: 10s
rules:
- record: workload:istio_request_duration_milliseconds_bucket:rate1m
expr: |
sum(irate(istio_request_duration_milliseconds_bucket{reporter="source", source_workload!=""}[1m]))
by (
source_workload,
source_workload_namespace,
destination_service,
destination_workload,
destination_workload_namespace,
le
)
- name: istio.workload.istio_request_bytes_bucket
interval: 10s
rules:
- record: workload:istio_request_bytes_bucket:rate1m
expr: |
sum(irate(istio_request_bytes_bucket{reporter="source", source_workload!=""}[1m]))
by (
source_workload,
source_workload_namespace,
destination_service,
destination_workload,
destination_workload_namespace,
le
)
- name: istio.workload.istio_response_bytes_bucket
interval: 10s
rules:
- record: workload:istio_response_bytes_bucket:rate1m
expr: |
sum(irate(istio_response_bytes_bucket{reporter="source", source_workload!=""}[1m]))
by (
source_workload,
source_workload_namespace,
destination_service,
destination_workload,
destination_workload_namespace,
le
)
- name: istio.workload.istio_requests_total
interval: 10s
rules:
- record: federate:istio_requests_total:rate1m
expr: |
sum(irate(istio_requests_total{reporter="source", source_workload!=""}[1m]))
by (
source_workload,
source_workload_namespace,
destination_service,
destination_workload,
destination_workload_namespace,
response_code,
response_flags
)
# These rules should be fast, and only operate on the aggregates defined above
- name: istio.recording-rules-percentiles
interval: 10s
rules:
- record: federate:istio_request_duration_milliseconds_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
workload:istio_request_duration_milliseconds_bucket:rate1m
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
workload:istio_request_duration_milliseconds_bucket:rate1m
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
workload:istio_request_duration_milliseconds_bucket:rate1m
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
workload:istio_request_duration_milliseconds_bucket:rate1m
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_request_duration_milliseconds_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_request_duration_milliseconds_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
workload:istio_request_bytes_bucket:rate1m
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
workload:istio_request_bytes_bucket:rate1m
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
workload:istio_request_bytes_bucket:rate1m
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
workload:istio_request_bytes_bucket:rate1m
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_request_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_request_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
workload:istio_response_bytes_bucket:rate1m
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.50,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "50", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
workload:istio_response_bytes_bucket:rate1m
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.90,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "90", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
workload:istio_response_bytes_bucket:rate1m
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.95,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "95", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
workload:istio_response_bytes_bucket:rate1m
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:source:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
source_workload,
source_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
- record: federate:istio_response_bytes_bucket:destination:rate1m
expr: |
label_replace(
histogram_quantile(0.99,
sum(workload:istio_response_bytes_bucket:rate1m)
by (
destination_service,
destination_workload,
destination_workload_namespace,
le
)
)
, "percentile", "99", "source_workload", ".*")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment