apiVersion: v1
kind: ConfigMap
metadata:
  name: iter8config-metrics
data:
  query_templates: |-
    iter8_sample_size: "sum(increase(istio_requests_total{source_workload_namespace!='knative-serving',reporter='source'}[$interval]$offset_str)) by ($entity_labels)"
    iter8_latency: "(sum(increase(istio_request_duration_seconds_sum{source_workload_namespace!='knative-serving',reporter='source'}[$interval]$offset_str)) by ($entity_labels)) / (sum(increase(istio_request_duration_seconds_count{source_workload_namespace!='knative-serving',reporter='source'}[$interval]$offset_str)) by ($entity_labels))"
    iter8_error_count: "sum(increase(istio_requests_total{source_workload_namespace!='knative-serving',response_code=~'5..',reporter='source'}[$interval]$offset_str)) by ($entity_labels)"
    iter8_error_rate: "sum(increase(istio_requests_total{source_workload_namespace!='knative-serving',response_code=~'5..',reporter='source'}[$interval]$offset_str)) by ($entity_labels) / sum(increase(istio_requests_total{source_workload_namespace!='knative-serving',reporter='source'}[$interval]$offset_str)) by ($entity_labels)"
  metrics: |-
    - name: iter8_latency
      metric_type: Performance
      sample_size_query_template: iter8_sample_size
    - name: iter8_error_count
      metric_type: Correctness
      sample_size_query_template: iter8_sample_size
    - name: iter8_error_rate
      metric_type: Correctness
      sample_size_query_template: iter8_sample_size

