{{$action := .action}} # start, gather

steps:
  - name: {{$action}} Kubelet Measurements
    measurements:
    - Identifier: KubeletPodStartupSLIDuration
      Method: GenericPrometheusQuery
      Params:
        action: {{$action}}
        metricName: KubeletPodStartupSLIDuration
        metricVersion: v1
        unit: s
        dimensions:
          - node
        queries:
        - name: Perc99
          query: histogram_quantile(0.99, sum(rate(kubelet_pod_start_sli_duration_seconds_bucket[10m])) by (node, le))
          threshold: 5
        - name: Perc90
          query: histogram_quantile(0.90, sum(rate(kubelet_pod_start_sli_duration_seconds_bucket[10m])) by (node, le))
        - name: Perc50
          query: histogram_quantile(0.50, sum(rate(kubelet_pod_start_sli_duration_seconds_bucket[10m])) by (node, le))
    - Identifier: KubeletPodStartupDuration
      Method: GenericPrometheusQuery
      Params:
        action: {{$action}}
        metricName: KubeletPodStartupDuration
        metricVersion: v1
        unit: s
        dimensions:
          - node
        queries:
        - name: Perc99
          query: histogram_quantile(0.99, sum(rate(kubelet_pod_start_duration_seconds_bucket[10m])) by (node, le))
        - name: Perc90
          query: histogram_quantile(0.90, sum(rate(kubelet_pod_start_duration_seconds_bucket[10m])) by (node, le))
        - name: Perc50
          query: histogram_quantile(0.50, sum(rate(kubelet_pod_start_duration_seconds_bucket[10m])) by (node, le))
    - Identifier: KubeletPodStartupTotalDuration
      Method: GenericPrometheusQuery
      Params:
        action: {{$action}}
        metricName: KubeletPodStartupTotalDuration
        metricVersion: v1
        unit: s
        dimensions:
          - node
        queries:
        - name: Perc99
          query: histogram_quantile(0.99, sum(rate(kubelet_pod_start_total_duration_seconds_bucket[10m])) by (node, le))
        - name: Perc90
          query: histogram_quantile(0.90, sum(rate(kubelet_pod_start_total_duration_seconds_bucket[10m])) by (node, le))
        - name: Perc50
          query: histogram_quantile(0.50, sum(rate(kubelet_pod_start_total_duration_seconds_bucket[10m])) by (node, le))
    - Identifier: KubeletRuntimeOperationDurationWithoutPullImage
      Method: GenericPrometheusQuery
      Params:
        action: {{$action}}
        metricName: KubeletRuntimeOperationDurationWithoutPullImage
        metricVersion: v1
        unit: s
        dimensions:
          - node
          - operation_type
        queries:
        - name: Perc99
          query: histogram_quantile(0.99, sum(rate(kubelet_runtime_operations_duration_seconds_bucket{operation_type!="pull_image"}[10m])) by (node, operation_type, le))
        - name: Perc90
          query: histogram_quantile(0.90, sum(rate(kubelet_runtime_operations_duration_seconds_bucket{operation_type!="pull_image"}[10m])) by (node, operation_type, le))
        - name: Perc50
          query: histogram_quantile(0.50, sum(rate(kubelet_runtime_operations_duration_seconds_bucket{operation_type!="pull_image"}[10m])) by (node, operation_type, le))
        - name: Sum
          query: kubelet_runtime_operations_duration_seconds_sum{operation_type!="pull_image"}
    - Identifier: KubeletRuntimeOperationDurationWithPullImage
      Method: GenericPrometheusQuery
      Params:
        action: {{$action}}
        metricName: KubeletRuntimeOperationDurationWithPullImage
        metricVersion: v1
        unit: s
        dimensions:
          - node
          - operation_type
        queries:
        - name: Perc99
          query: histogram_quantile(0.99, sum(avg_over_time(kubelet_runtime_operations_duration_seconds_bucket{operation_type="pull_image"}[5m])) by (node, operation_type, le))
        - name: Perc90
          query: histogram_quantile(0.90, sum(avg_over_time(kubelet_runtime_operations_duration_seconds_bucket{operation_type="pull_image"}[5m])) by (node, operation_type, le))
        - name: Perc50
          query: histogram_quantile(0.50, sum(avg_over_time(kubelet_runtime_operations_duration_seconds_bucket{operation_type="pull_image"}[5m])) by (node, operation_type, le))
        - name: Sum
          query: kubelet_runtime_operations_duration_seconds_sum{operation_type="pull_image"}
