すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Service Mesh:トラフィックのサーキットブレーキングと調整保護のための Grafana ダッシュボードとアラートルールの構成

最終更新日:Apr 18, 2025

Service Mesh (ASM) は、非侵入型のサーキットブレーキング、調整、およびトラフィック監視をサポートしています。このトピックでは、サーキットブレーキングと調整のための一般的なダッシュボード構成とアラートルールについて説明します。

サーキットブレーキング

トラフィックサーキットブレーキングは、短期間に過剰なトラフィックによって引き起こされるシステムクラッシュを防ぐ過負荷保護メカニズムです。クラウドネイティブ サービス間に東西トラフィック呼び出しが存在する場合、サービスに障害が発生すると(たとえば、応答の遅延や障害率の増加)、呼び出しチェーン上の一連のサービスでカスケード障害が発生する可能性があります。

サービス間の東西トラフィックのサーキットブレーキングルールを構成することにより、リクエストの失敗率または応答タイムアウト数がしきい値に達したときに、アップストリーム サービスからのリクエストを積極的に「遮断」できます。これは、アップストリーム サービスを保護すると同時に、障害が呼び出しチェーン全体に広がるのを効果的に防ぎ、システム全体のカスケード障害を回避します。

サーキットブレーキングルール を構成した後、各メッシュプロキシは、プロキシするリクエストに基づいてリクエストの失敗率または応答タイムアウト数を計算します。したがって、同じ障害が発生しているアップストリーム サービスに対して、クライアントメッシュプロキシはわずかに異なる時間にサーキットブレーキングをトリガーする場合があります。

ダッシュボードの例

image

各パネルの説明は次のとおりです。

パネル

説明

リクエスト

全体的なリクエストステータス。次のメトリックが含まれます。

  • リクエストの総数(total_requests)。具体的な値は [リクエスト合計] パネルに対応します。

  • サーキットブレーキングをトリガーしたリクエストの数(throttled_requests)。具体的な値は [調整されたリクエスト] パネルに対応します。

  • 成功したリクエストの総数(ok_requests)。具体的な値は [リクエスト OK] パネルに対応します。

リクエスト OK の割合

リクエスト総数に対する成功したリクエストの割合。

調整されたリクエストの割合

リクエスト総数に対するサーキットブレーキングをトリガーしたリクエストの割合。

次の JSON を Grafana ダッシュボードにインポートして、クラスタのサーキットブレーキングダッシュボードを作成できます。また、次の JSON コンテンツに基づいてダッシュボードを変更またはカスタマイズすることもできます。

展開して JSON コンテンツを表示

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"  // Grafana
        },
        "enable": true, // 有効
        "hide": true, // 非表示
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts", // アノテーションとアラート
        "type": "dashboard" // ダッシュボード
      }
    ]
  },
  "editable": true, // 編集可能
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 168,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",  // テキスト
            "axisLabel": "",
            "axisPlacement": "auto",  // 自動
            "barAlignment": 0,
            "drawStyle": "line", // 線
            "fillOpacity": 0,
            "gradientMode": "none", // なし
            "hideFrom": {
              "legend": false, // 凡例
              "tooltip": false, // ツールチップ
              "viz": false // ビジュアライゼーション
            },
            "lineInterpolation": "linear", // 線形
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear" // 線形
            },
            "showPoints": "auto", // 自動
            "stacking": {
              "group": "A",
              "mode": "none" // なし
            }
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "total_requests" // 合計リクエスト数
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "blue", // 青
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "unlimited_requests" // 無制限のリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-green", // 濃い緑
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "limited_requests" // 制限付きのリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-red", // 濃い赤
                  "mode": "fixed" // 固定
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list", // リスト
          "placement": "bottom", // 下
          "showLegend": true // 凡例を表示
        },
        "tooltip": {
          "mode": "single", // シングル
          "sort": "none", // なし
          "targets": []
        }
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "instant": false,
          "legendFormat": "total_requests", // 合計リクエスト数
          "range": true, // 有効値
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30 - sum(rate(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "ok_requests", // OK リクエスト
          "range": true, // 有効値
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(rate(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[60s])) * 30", // 60 秒
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "throttled_requests", // 調整されたリクエスト
          "range": true, // 有効値
          "refId": "C"
        }
      ],
      "title": "Requests", // リクエスト
      "transparent": true, // 透明
      "type": "aliyun-timeseries-panel"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Total", // リクエスト合計
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 4,
        "y": 8
      },
      "id": 5,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[$__range])) - sum(increase(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK", // リクエスト OK
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 8,
        "y": 8
      },
      "id": 4,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Throttled", // 調整されたリクエスト
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "red", // 赤
                "value": null
              },
              {
                "color": "green", // 緑
                "value": 90
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 0,
        "y": 16
      },
      "id": 6,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "(sum(increase(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[$__range])) - sum(increase(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[$__range]))) / sum(increase(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[$__range])) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK Percent", // リクエスト OK の割合
      "type": "gauge" // ゲージ
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              },
              {
                "color": "red", // 赤
                "value": 10
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 6,
        "y": 16
      },
      "id": 7,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_asm_circuit_breaker_total_broken_requests{namespace=~\"$namespace\",pod_name=~\"$pod\",cluster=~\".*$service.*\"}[$__range])) / sum(increase(istio_requests_total{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[$__range])) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Throttled Percent", // 調整されたリクエストの割合
      "type": "gauge" // ゲージ
    }
  ],
  "refresh": false,
  "schemaVersion": 38,
  "style": "dark", // ダーク
  "tags": [], // タグ
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "datesource", // データソース
          "value": "datasource" // データソース
        },
        "hide": 0,
        "includeAll": false,
        "label": "datasource", // データソース
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [], // オプション
        "query": "prometheus",
        "queryValue": "datesource", // データソース
        "refresh": 1, // リフレッシュ
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource" // データソース
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (namespace))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "namespace", // 名前空間
        "multi": false,
        "name": "namespace", // 名前空間
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (namespace))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*namespace=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (pod_name))",
        "description": "", // 説明
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "pod", // ポッド
        "multi": false,
        "name": "pod", // ポッド
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (pod_name))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*pod_name=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (cluster))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "multi": false,
        "name": "service", // サービス
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_asm_circuit_breaker_total_broken_requests) by (cluster))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*_.*_.*_(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      }
    ]
  },
  "time": {
    "from": "2025-03-19T07:40:00.388Z",
    "to": "2025-03-19T07:43:09.493Z"
  },
  "timepicker": {},
  "timezone": "browser", // ブラウザ
  "title": "Circuit Breaker", // サーキットブレーカー
  "uid": "5d5bcd97-33a9-499f-94f6-aea7081b9777",
  "version": 5,
  "weekStart": ""
}

アラート ルールの例

アラート構成

説明

カスタム PromQL 文

(sum by(cluster, namespace) (increase(envoy_asm_circuit_breaker_total_broken_requests[1m]))) > 10

過去 1 分間のサーキットブレークされたリクエストの数を、サーキットブレーキングをトリガーしたサービスの名前空間とサービス名でグループ化してクエリします。 1 分間のサーキットブレークされたリクエストの数が 10 を超えると、アラートがトリガーされます。

アラート メッセージ

サービスレベルのサーキットブレーキングが発生しました! 名前空間: {{$labels.namespace}}、サーキットブレーキングのターゲット サービス: {{$labels.cluster}}。 1 分間の現在のサーキットブレークされたリクエストの数: {{ $value }}

サーキットブレーキングをトリガーしたサービスの名前空間とサービス名、および過去 1 分間にサーキットブレークされたそのサービスへのリクエストの数を表示するアラートメッセージ形式を示しています。

グローバル調整保護

Envoy プロキシでは、グローバル調整は、サービスメッシュ全体のリクエストレートを制御するために使用されるメカニズムです。 Envoy のレート制限サービスに基づいて実装されます。このサービスは、サービスメッシュ全体からのトラフィックを一元的に処理し、事前定義されたルールとクォータに従ってリクエストレートを制限できます。

グローバル調整 は、ローカル調整と組み合わせて使用​​して、さまざまなレベルの調整機能を提供できます。

ダッシュボードの例

image

各パネルの説明は次のとおりです。

パネル

説明

リクエスト

全体的なリクエストステータス。次のメトリックが含まれます。

  • リクエストの総数(total_requests)。具体的な値は [リクエスト合計] パネルに対応します。

  • 調整をトリガーしたリクエストの数(limited_requests)。具体的な値は [制限に達したリクエスト] パネルに対応します。

  • 成功したリクエストの総数(unlimited_requests)。具体的な値は [リクエスト OK] パネルに対応します。

リクエスト OK の割合

リクエスト総数に対する成功したリクエストの割合。

制限に達したリクエストの割合

リクエスト総数に対する調整をトリガーしたリクエストの割合。

次の JSON を Grafana ダッシュボードにインポートして、クラスタのグローバル調整ダッシュボードを作成できます。また、次の JSON コンテンツに基づいてダッシュボードを変更またはカスタマイズすることもできます。

展開して JSON コンテンツを表示

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --" // Grafana
        },
        "enable": true, // 有効
        "hide": true, // 非表示
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts", // アノテーションとアラート
        "type": "dashboard" // ダッシュボード
      }
    ]
  },
  "editable": true, // 編集可能
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 166,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text", // テキスト
            "axisLabel": "",
            "axisPlacement": "auto", // 自動
            "barAlignment": 0,
            "drawStyle": "line", // 線
            "fillOpacity": 0,
            "gradientMode": "none", // なし
            "hideFrom": {
              "legend": false, // 凡例
              "tooltip": false, // ツールチップ
              "viz": false // ビジュアライゼーション
            },
            "lineInterpolation": "linear", // 線形
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear" // 線形
            },
            "showPoints": "auto", // 自動
            "stacking": {
              "group": "A",
              "mode": "none" // なし
            }
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "total_requests" // 合計リクエスト数
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "blue", // 青
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "unlimited_requests" // 無制限のリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-green", // 濃い緑
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "limited_requests" // 制限付きのリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-red", // 濃い赤
                  "mode": "fixed" // 固定
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list", // リスト
          "placement": "bottom", // 下
          "showLegend": true // 凡例を表示
        },
        "tooltip": {
          "mode": "single", // シングル
          "sort": "none", // なし
          "targets": []
        }
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30 + sum(rate(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "instant": false,
          "legendFormat": "total_requests", // 合計リクエスト数
          "range": true, // 有効値
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "unlimited_requests", // 無制限のリクエスト
          "range": true, // 有効値
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(rate(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "limited_requests", // 制限付きのリクエスト
          "range": true, // 有効値
          "refId": "C"
        }
      ],
      "title": "Requests", // リクエスト
      "transparent": true, // 透明
      "type": "aliyun-timeseries-panel"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) + sum(increase(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Total", // リクエスト合計
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 4,
        "y": 8
      },
      "id": 5,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK", // リクエスト OK
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 8,
        "y": 8
      },
      "id": 4,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Reached Limits", // 制限に達したリクエスト
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "red", // 赤
                "value": null
              },
              {
                "color": "green", // 緑
                "value": 90
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 0,
        "y": 16
      },
      "id": 6,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) / (sum(increase(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) + sum(increase(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK Percent", // リクエスト OK の割合
      "type": "gauge" // ゲージ
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              },
              {
                "color": "red", // 赤
                "value": 10
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 6,
        "y": 16
      },
      "id": 7,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) / (sum(increase(envoy_cluster_ratelimit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) + sum(increase(envoy_cluster_ratelimit_over_limit{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Reached Limits Percent", // 制限に達したリクエストの割合
      "type": "gauge" // ゲージ
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark", // ダーク
  "tags": [], // タグ
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "datasource", // データソース
          "value": "datasource" // データソース
        },
        "hide": 0,
        "includeAll": false,
        "label": "datasource", // データソース
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [], // オプション
        "query": "prometheus",
        "queryValue": "datasource", // データソース
        "refresh": 1, // リフレッシュ
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource" // データソース
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (namespace) or sum(envoy_cluster_ratelimit_ok) by (namespace))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "namespace", // 名前空間
        "multi": false,
        "name": "namespace", // 名前空間
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (namespace) or sum(envoy_cluster_ratelimit_ok) by (namespace))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*namespace=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (pod_name) or sum(envoy_cluster_ratelimit_ok) by (pod_name))",
        "description": "", // 説明
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "pod", // ポッド
        "multi": false,
        "name": "pod", // ポッド
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (pod_name) or sum(envoy_cluster_ratelimit_ok) by (pod_name))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*pod_name=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (service_istio_io_canonical_name) or sum(envoy_cluster_ratelimit_ok) by (service_istio_io_canonical_name))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "service", // サービス
        "multi": false,
        "name": "service", // サービス
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_cluster_ratelimit_over_limit) by (service_istio_io_canonical_name) or sum(envoy_cluster_ratelimit_ok) by (service_istio_io_canonical_name))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*service_istio_io_canonical_name=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      }
    ]
  },
  "time": {
    "from": "now-5m", // 5 分前
    "to": "now" // 現在
  },
  "timepicker": {},
  "timezone": "browser", // ブラウザ
  "title": "Global Rate Limit", // グローバルレート制限
  "uid": "d8f95bbc-efb6-41e7-8929-25551b22f3d2",
  "version": 25,
  "weekStart": ""
}

アラート ルールの例

アラート構成

説明

カスタム PromQL 文

sum (increase(envoy_cluster_ratelimit_over_limit[1m])) by (namespace, service_istio_io_canonical_name) > 10

過去 1 分間の調整されたリクエストの数を、調整をトリガーしたサービスの名前空間とサービス名でグループ化してクエリします。 1 分間の調整されたリクエストの数が 10 を超えると、アラートがトリガーされます。

アラート メッセージ

調整がトリガーされました! 名前空間: {{$labels.namespace}}、調整のターゲット サービス: {{$labels.service_istio_io_canonical_name}}。 1 分間の現在の調整されたリクエストの数: {{ $value }}

調整をトリガーしたサービスの名前空間とサービス名、および過去 1 分間に調整されたそのサービスへのリクエストの数を表示するアラートメッセージ形式を示しています。

ローカル調整保護

Envoy プロキシは、トークンバケットアルゴリズムを使用してローカル調整を実装します。トークンバケットアルゴリズムは、特定の数のトークンバケットに基づいて、サービスに送信されるリクエストの数を制限する方法です。バケットには一定のレートで常にトークンが補充されます。リクエストがサービスに送信されると、バケットからトークンが削除されます。バケットが空の場合、リクエストは拒否されます。

ローカル調整 は、グローバル調整と組み合わせて使用​​して、さまざまなレベルの調整機能を提供できます。

ダッシュボードの例

image

各パネルの説明は次のとおりです。

パネル

説明

リクエスト

全体的なリクエストステータス。次のメトリックが含まれます。

  • リクエストの総数(total_requests)。具体的な値は [リクエスト合計] パネルに対応します。

  • 調整をトリガーしたリクエストの数(limited_requests)。具体的な値は [制限に達したリクエスト] パネルに対応します。

  • 成功したリクエストの総数(unlimited_requests)。具体的な値は [リクエスト OK] パネルに対応します。

リクエスト OK の割合

リクエスト総数に対する成功したリクエストの割合。

制限に達したリクエストの割合

リクエスト総数に対する調整をトリガーしたリクエストの割合。

次の JSON を Grafana ダッシュボードにインポートして、クラスタのローカル調整ダッシュボードを作成できます。また、次の JSON コンテンツに基づいてダッシュボードを変更またはカスタマイズすることもできます。

展開して JSON コンテンツを表示

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --" // Grafana
        },
        "enable": true, // 有効
        "hide": true, // 非表示
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts", // アノテーションとアラート
        "type": "dashboard" // ダッシュボード
      }
    ]
  },
  "editable": true, // 編集可能
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 167,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text", // テキスト
            "axisLabel": "",
            "axisPlacement": "auto", // 自動
            "barAlignment": 0,
            "drawStyle": "line", // 線
            "fillOpacity": 0,
            "gradientMode": "none", // なし
            "hideFrom": {
              "legend": false, // 凡例
              "tooltip": false, // ツールチップ
              "viz": false // ビジュアライゼーション
            },
            "lineInterpolation": "linear", // 線形
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear" // 線形
            },
            "showPoints": "auto", // 自動
            "stacking": {
              "group": "A",
              "mode": "none" // なし
            }
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value":null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "total_requests" // 合計リクエスト数
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "blue", // 青
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "unlimited_requests" // 無制限のリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-green", // 濃い緑
                  "mode": "fixed" // 固定
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName", // 名前別
              "options": "limited_requests" // 制限付きのリクエスト
            },
            "properties": [
              {
                "id": "color", // 色
                "value": {
                  "fixedColor": "dark-red", // 濃い赤
                  "mode": "fixed" // 固定
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list", // リスト
          "placement": "bottom", // 下
          "showLegend": true // 凡例を表示
        },
        "tooltip": {
          "mode": "single", // シングル
          "sort": "none", // なし
          "targets": []
        }
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(envoy_http_local_rate_limiter_http_local_rate_limit_enabled{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "instant": false,
          "legendFormat": "total_requests", // 合計リクエスト数
          "range": true, // 有効値
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "exemplar": false,
          "expr": "sum(rate(envoy_http_local_rate_limiter_http_local_rate_limit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "format": "time_series", // 時系列
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "unlimited_requests", // 無制限のリクエスト
          "range": true, // 有効値
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(rate(envoy_http_local_rate_limiter_http_local_rate_limit_enforced{namespace=~\"$namespace\",pod_name=~\"$pod\",service_istio_io_canonical_name=~\"$service\"}[60s])) * 30", // 60 秒
          "hide": false, // 非表示
          "instant": false,
          "legendFormat": "limited_requests", // 制限付きのリクエスト
          "range": true, // 有効値
          "refId": "C"
        }
      ],
      "title": "Requests", // リクエスト
      "transparent": true, // 透明
      "type": "aliyun-timeseries-panel"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_enabled{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Total", // リクエスト合計
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 4,
        "y": 8
      },
      "id": 5,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK", // リクエスト OK
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "mappings": [], // マッピング
          "thresholds": {
            "mode": "absolute", // 絶対値
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 8,
        "y": 8
      },
      "id": 4,
      "options": {
        "colorMode": "value", // 値
        "graphMode": "area", // エリア
        "justifyMode": "auto", // 自動
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto" // 自動
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_enforced{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range]))",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Reached Limits", // 制限に達したリクエスト
      "type": "stat" // 統計
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "red", // 赤
                "value": null
              },
              {
                "color": "green", // 緑
                "value": 90
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 0,
        "y": 16
      },
      "id": 6,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_ok{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) / sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_enabled{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests OK Percent", // リクエスト OK の割合
      "type": "gauge" // ゲージ
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds" // しきい値
          },
          "custom": {
            "neutral": -1
          },
          "mappings": [], // マッピング
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage", // パーセンテージ
            "steps": [
              {
                "color": "green", // 緑
                "value": null
              },
              {
                "color": "red", // 赤
                "value": 10
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 6,
        "y": 16
      },
      "id": 7,
      "options": {
        "orientation": "auto", // 自動
        "reduceOptions": {
          "calcs": [
            "lastNotNull" // 最後の非 NULL 値
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false, // しきい値ラベルを表示しない
        "showThresholdMarkers": true // しきい値マーカーを表示
      },
      "pluginVersion": "10.0.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code", // コード
          "expr": "sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_enforced{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) / sum(increase(envoy_http_local_rate_limiter_http_local_rate_limit_enabled{namespace=~\"$namespace\", pod_name=~\"$pod\", service_istio_io_canonical_name=~\"$service\"}[$__range])) * 100",
          "instant": false,
          "range": true, // 有効値
          "refId": "A"
        }
      ],
      "title": "Requests Reached Limits Percent", // 制限に達したリクエストの割合
      "type": "gauge" // ゲージ
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark", // ダーク
  "tags": [], // タグ
  "templating": {
    "list": [
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "datasource", // データソース
          "value": "datasource" // データソース
        },
        "hide": 0,
        "includeAll": false,
        "label": "datasource", // データソース
        "multi": false,
        "name": "DS_PROMETHEUS",
        "options": [], // オプション
        "query": "prometheus",
        "queryValue": "datasource", // データソース
        "refresh": 1, // リフレッシュ
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource" // データソース
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (namespace))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "namespace", // 名前空間
        "multi": false,
        "name": "namespace", // 名前空間
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (namespace))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*namespace=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (pod_name))",
        "description": "", // 説明
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "pod", // ポッド
        "multi": false,
        "name": "pod", // ポッド
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (pod_name))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*pod_name=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "All", // すべて
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "ykIxRIhNk"
        },
        "definition": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (service_istio_io_canonical_name))",
        "hide": 0,
        "includeAll": true, // すべてを含む
        "label": "service", // サービス
        "multi": false,
        "name": "service", // サービス
        "options": [], // オプション
        "query": {
          "query": "query_result(sum(envoy_http_local_rate_limiter_http_local_rate_limit_enabled) by (service_istio_io_canonical_name))",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1, // リフレッシュ
        "regex": "/.*service_istio_io_canonical_name=\"(.*)\".*/",
        "skipUrlSync": false,
        "sort": 0, // ソート
        "type": "query" // クエリ
      }
    ]
  },
  "time": {
    "from": "now-5m", // 5 分前
    "to": "now" // 現在
  },
  "timepicker": {},
  "timezone": "browser", // ブラウザ
  "title": "Local Rate Limit", // ローカルレート制限
  "uid": "859fe8e7-c7dd-46f4-a1c0-c0c7010bcf19",
  "version": 7,
  "weekStart": ""
}

アラート ルールの例

アラート構成

説明

カスタム PromQL 文

sum (increase(envoy_http_local_rate_limiter_http_local_rate_limit_enforced[1m])) by (namespace, service_istio_io_canonical_name) > 10

過去 1 分間の調整されたリクエストの数を、調整をトリガーしたサービスの名前空間とサービス名でグループ化してクエリします。 1 分間の調整されたリクエストの数が 10 を超えると、アラートがトリガーされます。

アラート メッセージ

調整がトリガーされました! 名前空間: {{$labels.namespace}}、調整のターゲット サービス: {{$labels.service_istio_io_canonical_name}}。 1 分間の現在の調整されたリクエストの数: {{ $value }}

調整をトリガーしたサービスの名前空間とサービス名、および過去 1 分間に調整されたそのサービスへのリクエストの数を表示するアラートメッセージ形式を示しています。

関連操作

Grafana ダッシュボードのインポート

  1. [ARMS コンソール] にログインします。

  2. 左側のナビゲーションウィンドウで、[統合管理] をクリックします。

  3. [統合環境] タブで、[コンテナ環境] を選択し、クラスタ名で環境を検索して、ターゲット環境をクリックして入力します。 [ダッシュボードディレクトリ] をクリックします。

    image

    image

  4. [ダッシュボード] タブの右側にある [インポート] ボタンをクリックします。

    image

  5. JSON コンテンツを [パネル JSON からインポート] 領域に貼り付けて、[読み込み] ボタンをクリックします。デフォルト設定を維持し、[インポート] をクリックして、ダッシュボードのインポートを完了します。

    説明

    JSON ファイルをアップロードしてダッシュボードをインポートすることもできます。