1apiVersion: "config.istio.io/v1alpha2" 2kind: handler 3metadata: 4 name: prometheus 5 namespace: istio-system 6spec: 7 compiledAdapter: prometheus 8 params: 9 # metricsExpirationPolicy: 10 # metricsExpiryDuration: "15s" 11 # expiryCheckIntervalDuration: "5s" 12 metrics: 13 - name: requests_total 14 instance_name: requestcount.metric.istio-system 15 kind: COUNTER 16 label_names: 17 - reporter 18 - source_app 19 - source_namespace 20 - source_principal 21 - source_workload 22 - source_workload_namespace 23 - source_version 24 - destination_app 25 - destination_namespace 26 - destination_principal 27 - destination_workload 28 - destination_workload_namespace 29 - destination_version 30 - destination_service 31 - destination_service_name 32 - destination_service_namespace 33 - request_protocol 34 - response_code 35 - connection_mtls 36 - name: request_duration_seconds 37 instance_name: requestduration.metric.istio-system 38 kind: DISTRIBUTION 39 label_names: 40 - reporter 41 - source_app 42 - source_namespace 43 - source_principal 44 - source_workload 45 - source_workload_namespace 46 - source_version 47 - destination_app 48 - destination_namespace 49 - destination_principal 50 - destination_workload 51 - destination_workload_namespace 52 - destination_version 53 - destination_service 54 - destination_service_name 55 - destination_service_namespace 56 - request_protocol 57 - response_code 58 - connection_mtls 59 buckets: 60 explicit_buckets: 61 bounds: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] 62 - name: request_bytes 63 instance_name: requestsize.metric.istio-system 64 kind: DISTRIBUTION 65 label_names: 66 - reporter 67 - source_app 68 - source_namespace 69 - source_principal 70 - source_workload 71 - source_workload_namespace 72 - source_version 73 - destination_app 74 - destination_namespace 75 - destination_principal 76 - destination_workload 77 - destination_workload_namespace 78 - destination_version 79 - destination_service 80 - destination_service_name 81 - destination_service_namespace 82 - request_protocol 83 - response_code 84 - connection_mtls 85 buckets: 86 exponentialBuckets: 87 numFiniteBuckets: 8 88 scale: 1 89 growthFactor: 10 90 - name: response_bytes 91 instance_name: responsesize.metric.istio-system 92 kind: DISTRIBUTION 93 label_names: 94 - reporter 95 - source_app 96 - source_namespace 97 - source_principal 98 - source_workload 99 - source_workload_namespace 100 - source_version 101 - destination_app 102 - destination_namespace 103 - destination_principal 104 - destination_workload 105 - destination_workload_namespace 106 - destination_version 107 - destination_service 108 - destination_service_name 109 - destination_service_namespace 110 - request_protocol 111 - response_code 112 - connection_mtls 113 buckets: 114 exponentialBuckets: 115 numFiniteBuckets: 8 116 scale: 1 117 growthFactor: 10 118 - name: tcp_sent_bytes_total 119 instance_name: tcpbytesent.metric.istio-system 120 kind: COUNTER 121 label_names: 122 - reporter 123 - source_app 124 - source_namespace 125 - source_principal 126 - source_workload 127 - source_workload_namespace 128 - source_version 129 - destination_app 130 - destination_namespace 131 - destination_principal 132 - destination_workload 133 - destination_workload_namespace 134 - destination_version 135 - destination_service 136 - destination_service_name 137 - destination_service_namespace 138 - connection_mtls 139 - name: tcp_received_bytes_total 140 instance_name: tcpbytereceived.metric.istio-system 141 kind: COUNTER 142 label_names: 143 - reporter 144 - source_app 145 - source_namespace 146 - source_principal 147 - source_workload 148 - source_workload_namespace 149 - source_version 150 - destination_app 151 - destination_namespace 152 - destination_principal 153 - destination_workload 154 - destination_workload_namespace 155 - destination_version 156 - destination_service 157 - destination_service_name 158 - destination_service_namespace 159 - connection_mtls 160 - name: tcp_connections_opened_total 161 instance_name: tcpconnectionsopened.metric.istio-system 162 kind: COUNTER 163 label_names: 164 - reporter 165 - source_app 166 - source_namespace 167 - source_principal 168 - source_workload 169 - source_workload_namespace 170 - source_version 171 - destination_app 172 - destination_namespace 173 - destination_principal 174 - destination_workload 175 - destination_workload_namespace 176 - destination_version 177 - destination_service 178 - destination_service_name 179 - destination_service_namespace 180 - connection_mtls 181 - name: tcp_connections_closed_total 182 instance_name: tcpconnectionsclosed.metric.istio-system 183 kind: COUNTER 184 label_names: 185 - reporter 186 - source_app 187 - source_namespace 188 - source_principal 189 - source_workload 190 - source_workload_namespace 191 - source_version 192 - destination_app 193 - destination_namespace 194 - destination_principal 195 - destination_workload 196 - destination_workload_namespace 197 - destination_version 198 - destination_service 199 - destination_service_name 200 - destination_service_namespace 201 - connection_mtls 202--- 203apiVersion: "config.istio.io/v1alpha2" 204kind: rule 205metadata: 206 name: promhttp 207 namespace: istio-system 208spec: 209 match: (context.protocol == "http" || context.protocol == "grpc") && (match((request.useragent | "-"), "kube-probe*") == false) && (match((request.useragent | "-"), "Prometheus*") == false) 210 actions: 211 - handler: prometheus 212 instances: 213 - requestcount.metric 214 - requestduration.metric 215 - requestsize.metric 216 - responsesize.metric 217--- 218apiVersion: "config.istio.io/v1alpha2" 219kind: rule 220metadata: 221 name: promtcp 222 namespace: istio-system 223spec: 224 match: context.protocol == "tcp" 225 actions: 226 - handler: prometheus 227 instances: 228 - tcpbytesent.metric 229 - tcpbytereceived.metric 230--- 231apiVersion: "config.istio.io/v1alpha2" 232kind: rule 233metadata: 234 name: promtcpconnectionopen 235 namespace: istio-system 236spec: 237 match: context.protocol == "tcp" && ((connection.event | "na") == "open") 238 actions: 239 - handler: prometheus 240 instances: 241 - tcpconnectionsopened.metric 242--- 243apiVersion: "config.istio.io/v1alpha2" 244kind: rule 245metadata: 246 name: promtcpconnectionclosed 247 namespace: istio-system 248spec: 249 match: context.protocol == "tcp" && ((connection.event | "na") == "closed") 250 actions: 251 - handler: prometheus 252 instances: 253 - tcpconnectionsclosed.metric 254