k8s.io/perf-tests/clusterloader2@v0.0.0-20240304094227-64bdb12da87e/examples/generic_query_example.yaml (about)

     1  # Simple example of the use of generic query measurement.
     2  #
     3  # Notes on parameters:
     4  #       metricName will be logged in place of "GenericPrometheusQuery"
     5  #       query must be parametrized by duration and return exactly 1 sample
     6  #       threshold is optional
     7  #       requireSamples is optional and causes the test to fail if no samples are found
     8  
     9  {{$duration := "60s"}}
    10  {{$namespaces := 1}}
    11  
    12  name: generic-query
    13  namespace:
    14    number: {{$namespaces}}
    15  steps:
    16  - name: Start measurements
    17    measurements:
    18    - Identifier: gq
    19      Method: GenericPrometheusQuery
    20      Params:
    21        action: start
    22        metricName: API request latency
    23        metricVersion: v1
    24        unit: ms
    25        queries:
    26          - name: Perc99
    27            query: histogram_quantile(0.99, sum(rate(apiserver_request_sli_duration_seconds_bucket[%v])) by (le))
    28            threshold: 60
    29          - name: Perc90
    30            query: histogram_quantile(0.9, sum(rate(apiserver_request_sli_duration_seconds_bucket[%v])) by (le))
    31          - name: Perc50
    32            query: histogram_quantile(0.5, sum(rate(apiserver_request_sli_duration_seconds_bucket[%v])) by (le))
    33            threshold: 5
    34            requireSamples: true
    35          - name: non-existent
    36            query: histogram_quantile(0.5, sum(rate(fake_apiserver_request_sli_duration_seconds_bucket[%v])) by (le))
    37            threshold: 42
    38  - name: Sleep
    39    measurements:
    40    - Identifier: sleep
    41      Method: Sleep
    42      Params:
    43        duration: {{$duration}}
    44  - name: Gather measurements
    45    measurements:
    46    - Identifier: gq
    47      Method: GenericPrometheusQuery
    48      Params:
    49        action: gather
    50        enableViolations: true