(function(){vare={unitSuffix:"",labels:{},data:[]},t={options:{},init:function(e){if(this.options=e,!this.options.metrics_proxy_enabled)thrownewError("prometheus metrics provider currently requires the ui_config.metrics_proxy to be configured in the Consul agent.")},httpGet:function(e,t,r){if(t){vars=-1!==e.indexOf("?")?"&":"?"
returnthis.fetchSeries(n,s).then(this.reformatSeries(" rps",{Total:"Total inbound requests per second",Successes:"Successful responses (with an HTTP response code not in the 5xx range) per second.",Errors:"Error responses (with an HTTP response code in the 5xx range) per second."}))},fetchDataRateSeries:function(e,t,r,s){varn=`8 * sum by (label) (label_replace(irate(envoy_tcp_downstream_cx_tx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Outbound", "__name__", ".*") or label_replace(irate(envoy_tcp_downstream_cx_rx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Inbound", "__name__", ".*"))`
returnthis.fetchSeries(n,s).then(this.reformatSeries("bps",{Total:"Total bandwidth",Inbound:"Inbound data rate (data recieved) from the network in bits per second.",Outbound:"Outbound data rate (data transmitted) from the network in bits per second."}))},makeSubject:function(e,t,r,s){varn=`${r}/${e} (${t})`
returnn+="upstream"==s?',envoy_tcp_prefix=~"upstream.*"':',envoy_tcp_prefix="public_listener"'},groupQuery:function(e,t){return"upstream"==e?t+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==e&&(t+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)"),t},groupByInfix:function(e){return"upstream"==e?"upstream":"downstream"==e&&"source"},metricPrefixHTTP:function(e){return"downstream"==e?"envoy_cluster_upstream_rq":"envoy_http_downstream_rq"},metricPrefixTCP:function(e){return"downstream"==e?"envoy_cluster_upstream_cx":"envoy_tcp_downstream_cx"},fetchRPS:function(e,t,s,n,a){varc=this.makeHTTPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u=`sum(rate(${this.metricPrefixHTTP(n)}_completed{${c}}[15m]))`
returnthis.fetchStat(this.groupQuery(n,u),"RPS",`<b>${i}</b> request rate averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchER:function(e,t,s,n,a){varc=this.makeHTTPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u=""
"upstream"==n?u+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==n&&(u+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)")
returnthis.fetchStat(h,"ER",`Percentage of <b>${i}</b> requests which were 5xx status over the last 15 minutes`,(function(e){returnr(e)+"%"}),this.groupByInfix(n))},fetchPercentile:function(e,t,r,n,a,c){vari=this.makeHTTPSelector(t,r,n,a),u=this.makeSubject(t,r,n,a),o="le"
varh=`histogram_quantile(${e/100}, sum by(${o}) (rate(${this.metricPrefixHTTP(a)}_time_bucket{${i}}[15m])))`
returnthis.fetchStat(h,`P${e}`,`<b>${u}</b> ${e}th percentile request service time over the last 15 minutes`,s,this.groupByInfix(a))},fetchConnRate:function(e,t,s,n,a){varc=this.makeTCPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u=`sum(rate(${this.metricPrefixTCP(n)}_total{${c}}[15m]))`
returnthis.fetchStat(this.groupQuery(n,u),"CR",`<b>${i}</b> inbound TCP connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceRx:function(e,t,s,n,a){varc=this.makeTCPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u=`8 * sum(rate(${this.metricPrefixTCP(n)}_rx_bytes_total{${c}}[15m]))`
returnthis.fetchStat(this.groupQuery(n,u),"RX",`<b>${i}</b> received bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceTx:function(e,t,s,n,a){varc=this.makeTCPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u=`8 * sum(rate(${this.metricPrefixTCP(n)}_tx_bytes_total{${c}}[15m]))`
returnthis.fetchStat(this.groupQuery(n,u),"TX",`<b>${i}</b> transmitted bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceNoRoute:function(e,t,s,n,a){varc=this.makeTCPSelector(e,t,s,n),i=this.makeSubject(e,t,s,n),u="_no_route"
returnthis.fetchStat(this.groupQuery(n,o),"NR",`<b>${i}</b> unroutable (failed) connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchStat:function(e,t,r,s,n){n||(e+=" OR on() vector(0)")