EVOLUTION-MANAGER
Edit File: prometheusPlugin.4d0490a94b199a11f40c.js
(window.webpackJsonp=window.webpackJsonp||[]).push([[44],{EaOu:function(e,t,r){"use strict";r.r(t);var a=r("Obii"),n=r("mrSG"),i=r("BkRI"),s=r.n(i),o=r("la6v"),l=r.n(o),u=r("+2Rf"),c=r.n(u),h=r("PbtU"),m=r("F/XL"),d=r("0/uQ"),p=r("p0ib"),v=r("VNr4"),f=r("xMyE"),g=r("VnD/"),b=r("67Y/"),y=r("LvDl"),_=r.n(y),x=r("NPB1"),w=function(){function e(e,t){this.datasource=e,this.query=t,this.datasource=e,this.query=t,this.range=Object(x.a)().timeRange()}return e.prototype.process=function(){if(this.query.match(/^label_names\(\)\s*$/))return this.labelNamesQuery();var e=this.query.match(/^label_values\((?:(.+),\s*)?([a-zA-Z_][a-zA-Z0-9_]*)\)\s*$/);if(e)return e[1]?this.labelValuesQuery(e[2],e[1]):this.labelValuesQuery(e[2],null);var t=this.query.match(/^metrics\((.+)\)\s*$/);if(t)return this.metricNameQuery(t[1]);var r=this.query.match(/^query_result\((.+)\)\s*$/);return r?this.queryResultQuery(r[1]):this.metricNameAndLabelsQuery(this.query)},e.prototype.labelNamesQuery=function(){return this.datasource.metadataRequest("/api/v1/labels").then(function(e){return _.a.map(e.data.data,function(e){return{text:e}})})},e.prototype.labelValuesQuery=function(e,t){var r;if(t){var a=this.datasource.getPrometheusTime(this.range.from,!1),n=this.datasource.getPrometheusTime(this.range.to,!0);return r="/api/v1/series?match[]="+encodeURIComponent(t)+"&start="+a+"&end="+n,this.datasource.metadataRequest(r).then(function(t){var r=_.a.map(t.data.data,function(t){return t[e]||""}).filter(function(e){return""!==e});return _.a.uniq(r).map(function(e){return{text:e,expandable:!0}})})}return r="/api/v1/label/"+e+"/values",this.datasource.metadataRequest(r).then(function(e){return _.a.map(e.data.data,function(e){return{text:e}})})},e.prototype.metricNameQuery=function(e){return this.datasource.metadataRequest("/api/v1/label/__name__/values").then(function(t){return _.a.chain(t.data.data).filter(function(t){return new RegExp(e).test(t)}).map(function(e){return{text:e,expandable:!0}}).value()})},e.prototype.queryResultQuery=function(e){var t=this.datasource.getPrometheusTime(this.range.to,!0),r={expr:e};return this.datasource.performInstantQuery(r,t).then(function(e){return _.a.map(e.data.data.result,function(e){var t=e.metric.__name__||"";return delete e.metric.__name__,t+="{"+_.a.map(e.metric,function(e,t){return t+'="'+e+'"'}).join(",")+"}",{text:t+=" "+e.value[1]+" "+1e3*e.value[0],expandable:!0}})})},e.prototype.metricNameAndLabelsQuery=function(e){var t=this.datasource.getPrometheusTime(this.range.from,!1),r=this.datasource.getPrometheusTime(this.range.to,!0),a="/api/v1/series?match[]="+encodeURIComponent(e)+"&start="+t+"&end="+r,n=this;return this.datasource.metadataRequest(a).then(function(e){return _.a.map(e.data.data,function(e){return{text:n.datasource.getOriginalMetricName(e),expandable:!0}})})},e}(),T=r("iZOS"),O=function(){function e(e){this.templateSrv=e}return e.prototype.transform=function(e,t){var r,a,i,s,o=e.data.data.result;if("table"===t.format)return[this.transformMetricDataToTable(o,t.responseListLength,t.refId,t.valueWithRefId)];if(o&&"heatmap"===t.format){var l=[];try{for(var u=Object(n.__values)(o),c=u.next();!c.done;c=u.next()){var h=c.value;l.push(this.transformMetricData(h,t,t.start,t.end))}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}return l.sort(j),l=this.transformToHistogramOverTime(l)}if(o){l=[];try{for(var m=Object(n.__values)(o),d=m.next();!d.done;d=m.next()){h=d.value;"matrix"===e.data.data.resultType?l.push(this.transformMetricData(h,t,t.start,t.end)):"vector"===e.data.data.resultType&&l.push(this.transformInstantMetricData(h,t))}}catch(e){i={error:e}}finally{try{d&&!d.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}return l}return[]},e.prototype.transformMetricData=function(e,t,r,a){var i,s,o,l=[];o=this.createMetricLabel(e.metric,t);var u=1e3*parseInt(t.step,10),c=1e3*r;if(void 0===e.values)throw new Error("Prometheus heatmap error: data should be a time series");try{for(var h=Object(n.__values)(e.values),m=h.next();!m.done;m=h.next()){var d=m.value,p=parseFloat(d[1]);_.a.isNaN(p)&&(p=null);for(var v=1e3*parseFloat(d[0]),f=c;f<v;f+=u)l.push([null,f]);c=v+u,l.push([p,v])}}catch(e){i={error:e}}finally{try{m&&!m.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}var g=1e3*a;for(f=c;f<=g;f+=u)l.push([null,f]);return{datapoints:l,query:t.query,refId:t.refId,target:o,tags:e.metric}},e.prototype.transformMetricDataToTable=function(e,t,r,n){var i,s,o=new T.a;o.refId=r;var l={};if(!e||0===e.length)return o;_.a.each(e,function(e){for(var t in e.metric)l.hasOwnProperty(t)||(l[t]=1)});var u=_.a.keys(l).sort();o.columns.push({text:"Time",type:a.FieldType.time}),_.a.each(u,function(e,t){l[e]=t+1,o.columns.push({text:e,filterable:!0})});var c=t>1||n?"Value #"+r:"Value";return o.columns.push({text:c}),_.a.each(e,function(e){if(e.value&&(e.values=[e.value]),e.values)for(i=0;i<e.values.length;i++){var t=e.values[i],r=[1e3*t[0]];if(e.metric)for(s=0;s<u.length;s++){var a=u[s];e.metric.hasOwnProperty(a)?r.push(e.metric[a]):r.push("")}r.push(parseFloat(t[1])),o.rows.push(r)}}),o},e.prototype.transformInstantMetricData=function(e,t){var r,a=[];return r=this.createMetricLabel(e.metric,t),a.push([parseFloat(e.value[1]),1e3*e.value[0]]),{target:r,datapoints:a,tags:e.metric,refId:t.refId}},e.prototype.createMetricLabel=function(e,t){var r="";return(r=_.a.isUndefined(t)||_.a.isEmpty(t.legendFormat)?this.getOriginalMetricName(e):this.renderTemplate(this.templateSrv.replace(t.legendFormat),e))&&"{}"!==r||(r=t.query),r},e.prototype.renderTemplate=function(e,t){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,function(e,r){return t[r]?t[r]:r})},e.prototype.getOriginalMetricName=function(e){var t=e.__name__||"";return delete e.__name__,t+"{"+_.a.map(_.a.toPairs(e),function(e){return e[0]+'="'+e[1]+'"'}).join(",")+"}"},e.prototype.transformToHistogramOverTime=function(e){for(var t=e.length-1;t>0;t--){var r=e[t].datapoints,a=e[t-1].datapoints;if(!r||!a)throw new Error("Prometheus heatmap transform error: data should be a time series");for(var n=0;n<r.length;n++){var i=a[n]||[0];r[n][0]-=i[0]}}return e},e}();function j(e,t){var r,a;try{r=E(e.target),a=E(t.target)}catch(e){return console.log(e),0}return r>a?1:r<a?-1:0}function E(e){return"+Inf"===e?1/0:Number(e)}var q=r("HyWp"),C=r.n(q),k=r("ceQ3"),R=r("itod"),I=["job","instance"],P="{}",N=5,S=864e5,D=1e4,Q=function(e){return{label:e}},M=function(e){return e.kind="function",e};var A=/(="|!="|=~"|!~"|\{|\[|\(|\+|-|\/|\*|%|\^|\band\b|\bor\b|\bunless\b|==|>=|!=|<=|>|<|=|~|,)/,F=function(e){function t(t,r){var i=e.call(this)||this;return i.labelsCache=new C.a(10),i.request=function(e,t){return Object(n.__awaiter)(i,void 0,Promise,function(){var r,a;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.datasource.metadataRequest(e)];case 1:return[4,(r=n.sent()).data||r.json()];case 2:return[2,n.sent().data];case 3:return a=n.sent(),console.error(a),[3,4];case 4:return[2,t]}})})},i.start=function(){return Object(n.__awaiter)(i,void 0,Promise,function(){var e,t;return Object(n.__generator)(this,function(r){switch(r.label){case 0:return e=this,[4,this.request("/api/v1/label/__name__/values",[])];case 1:return e.metrics=r.sent(),this.lookupsDisabled=this.metrics.length>this.lookupMetricsThreshold,t=this,[4,this.request("/api/v1/metadata",{})];case 2:return t.metricsMetadata=r.sent(),this.processHistogramMetrics(this.metrics),[2,[]]}})})},i.processHistogramMetrics=function(e){var t=Object(k.d)(e).values;t&&t.__name__&&(i.histogramMetrics=t.__name__.slice().sort())},i.provideCompletionItems=function(e,t){var r=e.prefix,a=e.text,s=e.value,o=e.labelKey,l=e.wrapperClasses;return void 0===t&&(t={history:[]}),Object(n.__awaiter)(i,void 0,Promise,function(){var e,i,u,c,h,m,d,p,v,f;return Object(n.__generator)(this,function(n){return e=0===s.document.text.length,i=s.document.getTextsAtRange(s.selection),u=1===i.size?i.first().getText():null,c=u?u[s.selection.anchor.offset]:null,h=l.length>3,m=r&&!h,d=!c||")"===c,p=r&&!a.match(/^[\]})\s]+$/)&&d,v=/[+\-*/^%]/,f=a.match(v),l.includes("context-range")?[2,this.getRangeCompletionItems()]:l.includes("context-labels")?[2,this.getLabelCompletionItems({prefix:r,text:a,value:s,labelKey:o,wrapperClasses:l})]:l.includes("context-aggregation")?[2,this.getAggregationCompletionItems(s)]:e?[2,this.getEmptyCompletionItems(t)]:m&&d&&!f?[2,this.getBeginningCompletionItems(t)]:m&&p?[2,this.getTermCompletionItems()]:[2,{suggestions:[]}]})})},i.getBeginningCompletionItems=function(e){return{suggestions:Object(n.__spread)(i.getEmptyCompletionItems(e).suggestions,i.getTermCompletionItems().suggestions)}},i.getEmptyCompletionItems=function(e){var t=e.history,r=[];if(t&&t.length){var i=_.a.chain(t).map(function(e){return e.query.expr}).filter().uniq().take(N).map(Q).map(function(e){return function(e,t){var r=Date.now()-S,i=t.filter(function(t){return t.ts>r&&t.query===e.label}),s=i.length,o=i[0],l="Queried "+s+" times in the last 24h.";return o&&(l=l+" Last queried "+Object(a.dateTime)(o.ts).fromNow()+"."),Object(n.__assign)(Object(n.__assign)({},e),{documentation:l})}(e,t)}).value();r.push({prefixMatch:!0,skipSort:!0,label:"History",items:i})}return{suggestions:r}},i.getTermCompletionItems=function(){var e=i,t=e.metrics,r=e.metricsMetadata,a=[];return a.push({prefixMatch:!0,label:"Functions",items:R.a.map(M)}),t&&t.length&&a.push({label:"Metrics",items:t.map(function(e){return function(e,t){var r={label:e};if(t&&t[e]){var a=t[e][0],n=a.type,i=a.help;r.documentation=n.toUpperCase()+": "+i}return r}(e,r)})}),{suggestions:a}},i.getAggregationCompletionItems=function(e){return Object(n.__awaiter)(i,void 0,Promise,function(){var t,r,a,i,s,o,l,u,c,h,m;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return t=[],a=e.document.getBlocks().reduce(function(t,a){var n=a.getText();return e.anchorBlock.key===a.key&&(r=e.selection.anchor.offset+t.length),t+n},""),i=a.lastIndexOf("(",r),s=a.lastIndexOf("(",i-1),o=a.indexOf(")",s),-1===s&&(l=a.indexOf(")",r),o=a.indexOf(")",l+1),s=a.lastIndexOf("(",o)),u={suggestions:t,context:"context-aggregation"},-1===s?[2,u]:(c=a.slice(s+1,o).replace(/\[[^\]]+\]$/,""),h=Object(k.c)(c,c.length-2).selector,[4,this.getLabelValues(h)]);case 1:return(m=n.sent())&&t.push({label:"Labels",items:Object.keys(m).map(Q)}),[2,u]}})})},i.getLabelCompletionItems=function(e){var t=e.text,r=e.wrapperClasses,a=e.labelKey,s=e.value;return Object(n.__awaiter)(i,void 0,Promise,function(){var e,i,o,l,u,c,h,m,d,p,v,f,g,b,y,x,w,T,O;return Object(n.__generator)(this,function(n){switch(n.label){case 0:if(e=[],i=s.anchorBlock.getText(),o=s.selection.anchor.offset,l=i.substr(o),u=i.substr(0,o),c=t.match(/^(=|=~|!=|!~)/),h=l.match(/^"?[,}]/),m=u.match(/(=|=~|!=|!~)$/)&&l.match(/^"/),d=h&&!c,!(c&&h)&&!d||m)return[2,{suggestions:e}];try{v=Object(k.c)(i,o),p=v.selector}catch(e){p=P}return f=p.includes("__name__="),g=v?v.labelKeys:[],p?[4,this.getLabelValues(p,!f)]:[3,2];case 1:b=n.sent(),n.label=2;case 2:return b?(t&&c||r.includes("attr-value")?a&&b[a]&&(y="context-label-values",e.push({label:'Label values for "'+a+'"',items:b[a].map(Q)})):(x=b?Object.keys(b):f?null:I)&&(w=_.a.difference(x,g)).length&&(y="context-labels",T=w.map(function(e){return{label:e}}),O={label:"Labels",items:T},e.push(O)),[2,{context:y,suggestions:e}]):(console.warn("Server did not return any values for selector = "+p),[2,{suggestions:e}])}})})},i.fetchLabelValues=function(e){return Object(n.__awaiter)(i,void 0,Promise,function(){var t,r;return Object(n.__generator)(this,function(a){switch(a.label){case 0:return[4,this.request("/api/v1/label/"+e+"/values",[])];case 1:return t=a.sent(),[2,(r={},r[e]=t,r)]}})})},i.fetchSeriesLabels=function(e,t){return Object(n.__awaiter)(i,void 0,Promise,function(){var r,a,i,s,o,l;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return r=this.datasource.getTimeRange(),a="/api/v1/series?match[]="+e+"&start="+r.start+"&end="+r.end,i="/api/v1/series?match[]="+e+"&start="+this.roundToMinutes(r.start)+"&end="+this.roundToMinutes(r.end)+"&withName="+!!t,(s=this.labelsCache.get(i))?[3,2]:[4,this.request(a,[])];case 1:o=n.sent(),l=Object(k.e)(o,t).values,s=l,this.labelsCache.set(i,s),n.label=2;case 2:return[2,s]}})})},i.fetchDefaultLabels=_.a.once(function(){return Object(n.__awaiter)(i,void 0,void 0,function(){var e=this;return Object(n.__generator)(this,function(t){switch(t.label){case 0:return[4,Promise.all(I.map(function(t){return e.fetchLabelValues(t)}))];case 1:return[2,t.sent().reduce(function(e,t){return Object(n.__assign)(Object(n.__assign)({},e),t)},{})]}})})}),i.datasource=t,i.histogramMetrics=[],i.timeRange={start:0,end:0},i.metrics=[],i.lookupMetricsThreshold=D,i.lookupsDisabled=!0,Object.assign(i,r),i}return Object(n.__extends)(t,e),t.prototype.cleanText=function(e){return e.split(A).pop().trimLeft().replace(/"$/,"").replace(/^"/,"")},Object.defineProperty(t.prototype,"syntax",{get:function(){return R.c},enumerable:!0,configurable:!0}),t.prototype.getRangeCompletionItems=function(){return{context:"context-range",suggestions:[{label:"Range vector",items:Object(n.__spread)(R.b)}]}},t.prototype.getLabelValues=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,function(){var r;return Object(n.__generator)(this,function(a){switch(a.label){case 0:if(this.lookupsDisabled)return[2,void 0];a.label=1;case 1:return a.trys.push([1,6,,7]),e!==P?[3,3]:[4,this.fetchDefaultLabels()];case 2:return[2,a.sent()];case 3:return[4,this.fetchSeriesLabels(e,t)];case 4:return[2,a.sent()];case 5:return[3,7];case 6:return r=a.sent(),console.error(r),[2,void 0];case 7:return[2]}})})},t.prototype.roundToMinutes=function(e){return Math.floor(e/60)},t}(a.LanguageProvider),L=r("NXk7"),U=r("eqT+"),H=20;var V=r("m257"),$=r("5kRJ"),B="60s",G=function(e){function t(t){var r=e.call(this,t)||this;return r.init=function(){r.loadRules()},r.processResult=function(e,t,a,n){var i={format:a.format,step:t.step,legendFormat:a.legendFormat,start:t.start,end:t.end,query:t.expr,responseListLength:n,refId:a.refId,valueWithRefId:a.valueWithRefId};return r.resultTransformer.transform(e,i)},r.prepareTargets=function(e,t,i){var o,l,u=[],c=[];try{for(var h=Object(n.__values)(e.targets),m=h.next();!m.done;m=h.next()){var d=m.value;if(d.expr&&!d.hide)if(d.requestId=e.panelId+d.refId,e.app===a.CoreApp.Explore){if(d.showingTable){var p=s()(d);p.format="table",p.instant=!0,p.valueWithRefId=!0,delete p.maxDataPoints,p.requestId+="_instant",c.push(p),u.push(r.createQuery(p,e,t,i))}d.showingGraph&&(d.format="time_series",d.instant=!1,c.push(d),u.push(r.createQuery(d,e,t,i)))}else c.push(d),u.push(r.createQuery(d,e,t,i))}}catch(e){o={error:e}}finally{try{m&&!m.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}return{queries:u,activeTargets:c}},r.handleErrors=function(e,t){var r={message:e&&e.statusText||"Unknown error during query transaction. Please check JS console logs.",refId:t.refId};return e.data?"string"==typeof e.data?r.message=e.data:e.data.error&&(r.message=Object(V.u)(e.data.error)):e.message?r.message=e.message:"string"==typeof e&&(r.message=e),r.status=e.status,r.statusText=e.statusText,r},r.createAnnotationQueryOptions=function(e){var t=e.annotation,r=t&&t.step&&"string"==typeof t.step?t.step:B;return Object(n.__assign)(Object(n.__assign)({},e),{interval:r})},r.type="prometheus",r.editorSrc="app/features/prometheus/partials/query.editor.html",r.url=t.url,r.basicAuth=t.basicAuth,r.withCredentials=t.withCredentials,r.interval=t.jsonData.timeInterval||"15s",r.queryTimeout=t.jsonData.queryTimeout,r.httpMethod=t.jsonData.httpMethod||"GET",r.directUrl=t.jsonData.directUrl,r.resultTransformer=new O($.b),r.ruleMappings={},r.languageProvider=new F(r),r.customQueryParameters=new URLSearchParams(t.jsonData.customQueryParameters),r}return Object(n.__extends)(t,e),t.prototype.getQueryDisplayText=function(e){return e.expr},t.prototype._addTracingHeaders=function(e,t){e.headers={},!this.url.match(/^http/)&&(e.headers["X-Dashboard-Id"]=t.dashboardId,e.headers["X-Panel-Id"]=t.panelId)},t.prototype._request=function(e,t,r){return void 0===t&&(t={}),"GET"===(r=l()(r||{},{url:this.url+e,method:this.httpMethod,headers:{}})).method?t&&Object.keys(t).length&&(r.url=r.url+"?"+Object.entries(t).map(function(e){var t=Object(n.__read)(e,2),r=t[0],a=t[1];return encodeURIComponent(r)+"="+encodeURIComponent(a)}).join("&")):(r.headers["Content-Type"]="application/x-www-form-urlencoded",r.transformRequest=function(e){return c.a.param(e)},r.data=t),(this.basicAuth||this.withCredentials)&&(r.withCredentials=!0),this.basicAuth&&(r.headers.Authorization=this.basicAuth),Object(L.b)().datasourceRequest(r)},t.prototype.metadataRequest=function(e){return this._request(e,null,{method:"GET",silent:!0})},t.prototype.interpolateQueryExpr=function(e,t){return void 0===e&&(e=[]),t.multi||t.includeAll?"string"==typeof e?W(e):e.map(function(e){return W(e)}).join("|"):z(e)},t.prototype.targetContainsTemplate=function(e){return $.b.variableExists(e.expr)},t.prototype.query=function(e){var t=this.getPrometheusTime(e.range.from,!1),r=this.getPrometheusTime(e.range.to,!0),n=this.prepareTargets(e,t,r),i=n.queries,s=n.activeTargets;return i&&i.length?e.app===a.CoreApp.Explore?this.exploreQuery(i,s,r):this.panelsQuery(i,s,r,e.requestId):Object(m.a)({data:[],state:a.LoadingState.Done})},t.prototype.exploreQuery=function(e,t,r){var i=this,s=e.length,o=e.map(function(n,o){var l=t[o];return(n.instant?Object(d.a)(i.performInstantQuery(n,r)):Object(d.a)(i.performTimeSeriesQuery(n,n.start,n.end))).pipe(Object(f.a)(function(){return s--}),Object(g.a)(function(e){return!e.cancelled}),Object(b.a)(function(t){return{data:i.processResult(t,n,l,e.length),key:n.requestId,state:0===s?a.LoadingState.Done:a.LoadingState.Loading}}))});return p.a.apply(void 0,Object(n.__spread)(o))},t.prototype.panelsQuery=function(e,t,r,i){var s=this,o=e.map(function(a,n){var i=t[n];return(a.instant?Object(d.a)(s.performInstantQuery(a,r)):Object(d.a)(s.performTimeSeriesQuery(a,a.start,a.end))).pipe(Object(g.a)(function(e){return!e.cancelled}),Object(b.a)(function(t){return s.processResult(t,a,i,e.length)}))});return Object(v.a)(o).pipe(Object(b.a)(function(e){return{data:e.reduce(function(e,t){return Object(n.__spread)(e,t)},[]),key:i,state:a.LoadingState.Done}}))},t.prototype.createQuery=function(e,t,r,a){var i={hinting:e.hinting,instant:e.instant,step:0,expr:"",requestId:e.requestId,refId:e.refId,start:0,end:0},s=Math.ceil(a-r),o=h.a.interval_to_seconds(t.interval),l=h.a.interval_to_seconds($.b.replace(e.interval,t.scopedVars)||t.interval),u=e.intervalFactor||1,c=this.adjustInterval(o,l,s,u),m=Object(n.__assign)(Object(n.__assign)({},t.scopedVars),this.getRangeScopedVars(t.range));o!==c&&(o=c,m=Object.assign({},t.scopedVars,Object(n.__assign)({__interval:{text:o+"s",value:o+"s"},__interval_ms:{text:1e3*o,value:1e3*o}},this.getRangeScopedVars(t.range)))),i.step=o;var d=e.expr;d=$.b.getAdhocFilters(this.name).reduce(function(e,t){var r=t.key,a=t.operator,n=t.value;return"=~"!==a&&"!~"!==a||(n=z(n)),Object(U.b)(e,r,n,a)},d),i.expr=$.b.replace(d,m,this.interpolateQueryExpr);var p=function(e,t,r,a){var n=Math.floor((t+a)/r)*r-a,i=Math.floor((e+a)/r)*r-a;return{end:n,start:i}}(r,a,i.step,60*Object(x.a)().timeRange().to.utcOffset());return i.start=p.start,i.end=p.end,this._addTracingHeaders(i,t),i},t.prototype.adjustInterval=function(e,t,r,a){var n=Math.ceil(r/11e3);return Math.max(e*a,t,n,1)},t.prototype.performTimeSeriesQuery=function(e,t,r){var a,i,s=this;if(t>r)throw{message:"Invalid time range"};var o={query:e.expr,start:t,end:r,step:e.step};this.queryTimeout&&(o.timeout=this.queryTimeout);try{for(var l=Object(n.__values)(this.customQueryParameters),u=l.next();!u.done;u=l.next()){var c=Object(n.__read)(u.value,2),h=c[0],m=c[1];null==o[h]&&(o[h]=m)}}catch(e){a={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(a)throw a.error}}return this._request("/api/v1/query_range",o,{requestId:e.requestId,headers:e.headers}).catch(function(t){if(t.cancelled)return t;throw s.handleErrors(t,e)})},t.prototype.performInstantQuery=function(e,t){var r,a,i=this,s={query:e.expr,time:t};this.queryTimeout&&(s.timeout=this.queryTimeout);try{for(var o=Object(n.__values)(this.customQueryParameters),l=o.next();!l.done;l=o.next()){var u=Object(n.__read)(l.value,2),c=u[0],h=u[1];null==s[c]&&(s[c]=h)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return this._request("/api/v1/query",s,{requestId:e.requestId,headers:e.headers}).catch(function(t){if(t.cancelled)return t;throw i.handleErrors(t,e)})},t.prototype.performSuggestQuery=function(e,t){var r;return void 0===t&&(t=!1),Object(n.__awaiter)(this,void 0,void 0,function(){var a;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return t&&(null===(r=this.metricsNameCache)||void 0===r?void 0:r.expire)>Date.now()?[2,this.metricsNameCache.data.filter(function(t){return 1!==t.indexOf(e)})]:[4,this.metadataRequest("/api/v1/label/__name__/values")];case 1:return a=n.sent(),this.metricsNameCache={data:a.data.data,expire:Date.now()+6e4},[2,a.data.data.filter(function(t){return 1!==t.indexOf(e)})]}})})},t.prototype.metricFindQuery=function(e){if(!e)return Promise.resolve([]);var t=Object(n.__assign)({__interval:{text:this.interval,value:this.interval},__interval_ms:{text:h.a.interval_to_ms(this.interval),value:h.a.interval_to_ms(this.interval)}},this.getRangeScopedVars(Object(x.a)().timeRange())),r=$.b.replace(e,t,this.interpolateQueryExpr);return new w(this,r).process()},t.prototype.getRangeScopedVars=function(e){void 0===e&&(e=Object(x.a)().timeRange());var t=e.to.diff(e.from),r=Math.round(t/1e3),a=h.a.secondsToHms(t/1e3);return{__range_ms:{text:t,value:t},__range_s:{text:r,value:r},__range:{text:a,value:a}}},t.prototype.annotationQuery=function(e){var t,r,a,i;return Object(n.__awaiter)(this,void 0,void 0,function(){var s,o,l,u,c,h,m,d,p,v,f,g,b,y,_,x,w,T;return Object(n.__generator)(this,function(O){switch(O.label){case 0:return s=e.annotation,o=s.expr,l=void 0===o?"":o,u=s.tagKeys,c=void 0===u?"":u,h=s.titleFormat,m=void 0===h?"":h,d=s.textFormat,p=void 0===d?"":d,l?(v=this.getPrometheusTime(e.range.from,!1),f=this.getPrometheusTime(e.range.to,!0),g=this.createAnnotationQueryOptions(e),"1s",b={expr:l,interval:"1s",refId:"X",requestId:"prom-query-"+s.name},y=this.createQuery(b,g,v,f),_=this,[4,this.performTimeSeriesQuery(y,y.start,y.end)]):[2,Promise.resolve([])];case 1:return x=O.sent(),w=[],T=c.split(","),x.cancelled?[2,[]]:(null===(i=null===(a=null===(r=null===(t=x)||void 0===t?void 0:t.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.result)||void 0===i||i.forEach(function(e){var t,r,a=Object.entries(e.metric).filter(function(e){var t=Object(n.__read)(e,1)[0];return T.includes(t)}).map(function(e){var t=Object(n.__read)(e,2);t[0];return t[1]}),i={};try{for(var o=Object(n.__values)(e.values),l=o.next();!l.done;l=o.next()){var u=l.value;if("1"===u[1]||s.useValueForTime){var c={annotation:s,title:_.resultTransformer.renderTemplate(m,e.metric),tags:a,text:_.resultTransformer.renderTemplate(p,e.metric)};if(s.useValueForTime){var h=Math.floor(parseFloat(u[1]));if(i[h])continue;i[h]=!0,c.time=h}else c.time=1e3*Math.floor(parseFloat(u[0]));w.push(c)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}),[2,w])}})})},t.prototype.getTagKeys=function(){var e,t,r,a;return Object(n.__awaiter)(this,void 0,void 0,function(){var i;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return[4,this.metadataRequest("/api/v1/labels")];case 1:return i=n.sent(),[2,(a=null===(r=null===(t=null===(e=i)||void 0===e?void 0:e.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map(function(e){return{text:e}}),null!=a?a:[])]}})})},t.prototype.getTagValues=function(e){var t,r,a,i;return void 0===e&&(e={}),Object(n.__awaiter)(this,void 0,void 0,function(){var s;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return[4,this.metadataRequest("/api/v1/label/"+e.key+"/values")];case 1:return s=n.sent(),[2,(i=null===(a=null===(r=null===(t=s)||void 0===t?void 0:t.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.map(function(e){return{text:e}}),null!=i?i:[])]}})})},t.prototype.testDatasource=function(){return Object(n.__awaiter)(this,void 0,void 0,function(){var e,t,r;return Object(n.__generator)(this,function(a){switch(a.label){case 0:return e=(new Date).getTime(),t={expr:"1+1"},[4,this.performInstantQuery(t,e/1e3)];case 1:return[2,"success"===(r=a.sent()).data.status?{status:"success",message:"Data source is working"}:{status:"error",message:r.error}]}})})},t.prototype.interpolateVariablesInQueries=function(e,t){var r=this,a=e;return e&&e.length&&(a=e.map(function(e){return Object(n.__assign)(Object(n.__assign)({},e),{datasource:r.name,expr:$.b.replace(e.expr,t,r.interpolateQueryExpr)})})),a},t.prototype.getQueryHints=function(e,t){var r;return function(e,t,r){var a,i,s=[];if(e.trim().match(/^\w+_bucket$/)){var o="Time series has buckets, you probably wanted a histogram.";s.push({type:"HISTOGRAM_QUANTILE",label:o,fix:{label:"Fix by adding histogram_quantile().",action:{type:"ADD_HISTOGRAM_QUANTILE",query:e}}})}if(-1===e.indexOf("rate(")){var l=e.match(/\b(\w+_(total|sum|count))\b/),u=l?l[1]:"",c=null===(i=null===(a=r)||void 0===a?void 0:a.languageProvider)||void 0===i?void 0:i.metricsMetadata,h=!1;if(_.a.size(c)>0&&(u=Object.keys(c).find(function(t){if("counter"===c[t][0].type.toLowerCase()){var r=new RegExp("\\b"+t+"\\b");if(e.match(r))return h=!0,!0}return!1})),u){var m=e.trim().match(/^\w+$/),d=void(o="Metric "+u+" "+(h?"is":"looks like")+" a counter.");m?d={label:"Fix by adding rate().",action:{type:"ADD_RATE",query:e}}:o+=" Try applying a rate() function.",s.push({type:"APPLY_RATE",label:o,fix:d})}}if(r&&r.ruleMappings){var p=r.ruleMappings,v=Object.keys(p).reduce(function(t,r){var a;return e.search(r)>-1?Object(n.__assign)(Object(n.__assign)({},t),((a={})[r]=p[r],a)):t},{});_.a.size(v)>0&&(o="Query contains recording rules.",s.push({type:"EXPAND_RULES",label:o,fix:{label:"Expand rules",action:{type:"EXPAND_RULES",query:e,mapping:v}}}))}return t&&t.length>=H&&(m=e.trim().match(/^\w+$/))&&s.push({type:"ADD_SUM",label:"Many time series results returned.",fix:{label:"Consider aggregating with sum().",action:{type:"ADD_SUM",query:e,preventSubmit:!0}}}),s.length>0?s:null}(null!=(r=e.expr)?r:"",t,this)},t.prototype.loadRules=function(){var e,t;return Object(n.__awaiter)(this,void 0,void 0,function(){var r,a,i,s;return Object(n.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.metadataRequest("/api/v1/rules")];case 1:return r=o.sent(),a=r.data||r.json(),(i=null===(t=null===(e=a)||void 0===e?void 0:e.data)||void 0===t?void 0:t.groups)&&(this.ruleMappings=function(e){return e.reduce(function(e,t){return t.rules.filter(function(e){return"recording"===e.type}).reduce(function(e,t){var r;return Object(n.__assign)(Object(n.__assign)({},e),((r={})[t.name]=t.query,r))},e)},{})}(i)),[3,3];case 2:return s=o.sent(),console.log("Rules API is experimental. Ignore next error."),console.error(s),[3,3];case 3:return[2]}})})},t.prototype.modifyQuery=function(e,t){var r,a=null!=(r=e.expr)?r:"";switch(t.type){case"ADD_FILTER":a=Object(U.b)(a,t.key,t.value);break;case"ADD_HISTOGRAM_QUANTILE":a="histogram_quantile(0.95, sum(rate("+a+"[5m])) by (le))";break;case"ADD_RATE":a="rate("+a+"[5m])";break;case"ADD_SUM":a="sum("+a.trim()+") by ($1)";break;case"EXPAND_RULES":t.mapping&&(a=Object(k.a)(a,t.mapping))}return Object(n.__assign)(Object(n.__assign)({},e),{expr:a})},t.prototype.getPrometheusTime=function(e,t){return"string"==typeof e&&(e=a.dateMath.parse(e,t)),Math.ceil(e.valueOf()/1e3)},t.prototype.getTimeRange=function(){var e=Object(x.a)().timeRange();return{start:this.getPrometheusTime(e.from,!1),end:this.getPrometheusTime(e.to,!0)}},t.prototype.getOriginalMetricName=function(e){return this.resultTransformer.getOriginalMetricName(e)},t}(a.DataSourceApi);function z(e){return"string"==typeof e?e.replace(/'/g,"\\\\'"):e}function W(e){return"string"==typeof e?z(e.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]+?.()|]/g,"\\\\$&")):e}var K=r("q1tI"),X=r.n(K),Z=r("kDLi"),J=r("wZee"),Y=r.n(J),ee=r("sGFA"),te="__histograms__",re="__recording_rules__";function ae(e,t){var r=t.typeaheadContext,a=t.typeaheadText;switch(r){case"context-labels":var n=Z.DOMUtil.getNextCharacter();n&&"}"!==n&&","!==n||(e+="=");break;case"context-label-values":a.match(/^(!?=~?"|")/)||(e='"'+e),'"'!==Z.DOMUtil.getNextCharacter()&&(e+='"')}return e}var ne=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.refreshHint=function(){var e=i.props,t=e.datasource,r=e.query,n=e.data;if(n&&0!==n.series.length){var s=Object(a.isDataFrame)(n.series[0])?n.series.map(a.toLegacyResponseData):n.series,o=t.getQueryHints(r,s),l=o&&o.length>0?o[0]:null;i.setState({hint:l})}else i.setState({hint:null})},i.refreshMetrics=function(e){i.languageProviderInitializationPromise=e,i.languageProviderInitializationPromise.promise.then(function(e){e.map(function(e){return e.then(i.onUpdateLanguage).catch(function(){})})}).then(function(){return i.onUpdateLanguage()}).catch(function(e){e.isCanceled&&console.warn("PromQueryField has unmounted, language provider intialization was canceled")})},i.onChangeMetrics=function(e,t){var r;if(1===t.length){if(0!==t[0].children.length)return;r=t[0].value}else{var a=t[0].value,n=t[1].value;r=a===te?"histogram_quantile(0.95, sum(rate("+n+"[5m])) by (le))":n}i.onChangeQuery(r,!0)},i.onChangeQuery=function(e,t){var r=i.props,a=r.query,s=r.onChange,o=r.onRunQuery;s&&(s(Object(n.__assign)(Object(n.__assign)({},a),{expr:e})),t&&o&&o())},i.onClickHintFix=function(){var e=i.props,t=e.datasource,r=e.query,a=e.onChange,n=e.onRunQuery,s=i.state.hint;a(t.modifyQuery(r,s.fix.action)),n()},i.onUpdateLanguage=function(){var e=i.languageProvider,t=e.histogramMetrics,r=e.metrics,a=e.metricsMetadata,s=e.lookupsDisabled,o=e.lookupMetricsThreshold;if(r){var l,u=function(e,t){var r=/:\w+:/,a=e.filter(function(e){return r.test(e)}),i={label:"Recording rules",value:re,children:a.slice().sort().map(function(e){return{label:e,value:e}})},s=a.length>0?[i]:[],o=_.a.chain(e).filter(function(e){return!r.test(e)}).groupBy(function(e){return e.split("_")[0]}).map(function(e,r){return{children:1===e.length&&e[0]===r?[]:e.sort().map(function(e){return function(e,t){var r={label:e,value:e};if(t&&t[e]){var a=t[e][0],n=a.type,i=void 0===n?"":n,s=a.help;r.title=[e,i.toUpperCase(),s].join("\n")}return r}(e,t)}),label:r,value:r}}).sortBy("label").value();return Object(n.__spread)(s,o)}(r,a),c=t.map(function(e){return{label:e,value:e}}),h=t.length>0?Object(n.__spread)([{label:"Histograms",value:te,children:c,isLeaf:!1}],u):u;s&&(l={label:"Dynamic label lookup is disabled for datasources with more than "+o+" metrics.",type:"INFO"}),i.setState({hint:l,metricsOptions:h,syntaxLoaded:!0})}},i.onTypeahead=function(e){return Object(n.__awaiter)(i,void 0,Promise,function(){var t,r,a,i,s,o;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return this.languageProvider?(t=this.props.history,r=e.prefix,a=e.text,i=e.value,s=e.wrapperClasses,o=e.labelKey,[4,this.languageProvider.provideCompletionItems({text:a,value:i,prefix:r,wrapperClasses:s,labelKey:o},{history:t})]):[2,{suggestions:[]}];case 1:return[2,n.sent()]}})})},t.datasource.languageProvider&&(i.languageProvider=t.datasource.languageProvider),i.plugins=[Object(Z.BracesPlugin)(),Object(Z.SlatePrism)({onlyIn:function(e){return"code_block"===e.type},getSyntax:function(e){return"promql"}})],i.state={metricsOptions:[],syntaxLoaded:!1,hint:null},i}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){this.languageProvider&&(Y.a.languages.promql=this.languageProvider.syntax,this.refreshMetrics(Object(ee.a)(this.languageProvider.start()))),this.refreshHint()},t.prototype.componentWillUnmount=function(){this.languageProviderInitializationPromise&&this.languageProviderInitializationPromise.cancel()},t.prototype.componentDidUpdate=function(e){var t=this.props.data;t&&e.data&&e.data.series!==t.series&&this.refreshHint()},t.prototype.render=function(){var e,t=this.props,r=t.data,a=t.query,n=t.ExtraFieldElement,i=this.state,s=i.metricsOptions,o=i.syntaxLoaded,l=i.hint,u=this.languageProvider?this.languageProvider.cleanText:void 0,c=(e=s,o?e&&0===e.length?"(No metrics found)":"Metrics":"Loading metrics..."),h=!(o&&s&&s.length>0),m=r&&r.error&&r.error.refId===a.refId;return X.a.createElement(X.a.Fragment,null,X.a.createElement("div",{className:"gf-form-inline gf-form-inline--nowrap flex-grow-1"},X.a.createElement("div",{className:"gf-form flex-shrink-0"},X.a.createElement(Z.ButtonCascader,{options:s,disabled:h,onChange:this.onChangeMetrics},c)),X.a.createElement("div",{className:"gf-form gf-form--grow flex-shrink-1"},X.a.createElement(Z.QueryField,{additionalPlugins:this.plugins,cleanText:u,query:a.expr,onTypeahead:this.onTypeahead,onWillApplySuggestion:ae,onBlur:this.props.onBlur,onChange:this.onChangeQuery,onRunQuery:this.props.onRunQuery,placeholder:"Enter a PromQL query",portalOrigin:"prometheus",syntaxLoaded:o})),n),m?X.a.createElement("div",{className:"query-row-break"},X.a.createElement("div",{className:"prom-query-field-info text-error"},r.error.message)):null,l?X.a.createElement("div",{className:"query-row-break"},X.a.createElement("div",{className:"prom-query-field-info text-warning"},l.label," ",l.fix?X.a.createElement("a",{className:"text-link muted",onClick:this.onClickHintFix},l.fix.label):null)):null)},t}(X.a.PureComponent),ie=r("WnbS"),se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={href:null},t}return Object(n.__extends)(t,e),t.prototype.componentDidUpdate=function(e){return Object(n.__awaiter)(this,void 0,void 0,function(){var t;return Object(n.__generator)(this,function(r){switch(r.label){case 0:return e.panelData!==this.props.panelData&&this.props.panelData.request?[4,this.getExternalLink()]:[3,2];case 1:t=r.sent(),this.setState({href:t}),r.label=2;case 2:return[2]}})})},t.prototype.getExternalLink=function(){return Object(n.__awaiter)(this,void 0,Promise,function(){var e,t,r,a,i,s,o,l,u,c,h,m,d,p,v,f;return Object(n.__generator)(this,function(n){switch(n.label){case 0:return e=this.props,t=e.query,r=e.panelData,a=r.request.targets.length>0?r.request.targets[0]:{datasource:null},(i=a.datasource)?[4,Object(ie.a)().get(i)]:[3,2];case 1:return o=n.sent(),[3,3];case 2:o=this.props.datasource,n.label=3;case 3:return s=o,l=r.request.range,u=s.getPrometheusTime(l.from,!1),c=s.getPrometheusTime(l.to,!0),h=Math.ceil(c-u),m=l.to.utc().format("YYYY-MM-DD HH:mm"),d={interval:r.request.interval},p=s.createQuery(t,d,u,c),v={"g0.expr":p.expr,"g0.range_input":h+"s","g0.end_input":m,"g0.step_input":p.step,"g0.tab":0},f=_.a.map(v,function(e,t){return t+"="+encodeURIComponent(e)}).join("&"),[2,s.directUrl+"/graph?"+f]}})})},t.prototype.render=function(){var e=this.state.href;return X.a.createElement("a",{href:e,target:"_blank",rel:"noopener"},X.a.createElement("i",{className:"fa fa-share-square-o"})," Prometheus")},t}(K.Component),oe=[{label:"Time series",value:"time_series"},{label:"Table",value:"table"},{label:"Heatmap",value:"heatmap"}],le=_.a.map([1,2,3,4,5,10],function(e){return{value:e,label:"1/"+e}}),ue=function(e){function t(t){var r=e.call(this,t)||this;r.onFieldChange=function(e,t){r.query.expr=e.expr},r.onFormatChange=function(e){r.query.format=e.value,r.setState({formatOption:e},r.onRunQuery)},r.onInstantChange=function(e){var t=e.target.checked;r.query.instant=t,r.setState({instant:t},r.onRunQuery)},r.onIntervalChange=function(e){var t=e.currentTarget.value;r.query.interval=t,r.setState({interval:t})},r.onIntervalFactorChange=function(e){r.query.intervalFactor=e.value,r.setState({intervalFactorOption:e},r.onRunQuery)},r.onLegendChange=function(e){var t=e.currentTarget.value;r.query.legendFormat=t,r.setState({legendFormat:t})},r.onRunQuery=function(){var e=r.query;r.props.onChange(e),r.props.onRunQuery()};var a=t.query;return r.query=a,r.state={interval:a.interval,legendFormat:a.legendFormat,formatOption:oe.find(function(e){return e.value===a.format})||oe[0],intervalFactorOption:le.find(function(e){return e.value===a.intervalFactor})||le[0],instant:Boolean(a.instant)},r}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.datasource,r=e.query,a=e.data,n=this.state,i=n.formatOption,s=n.instant,o=n.interval,l=n.intervalFactorOption,u=n.legendFormat;return X.a.createElement("div",null,X.a.createElement(ne,{datasource:t,query:r,onRunQuery:this.onRunQuery,onChange:this.onFieldChange,history:[],data:a}),X.a.createElement("div",{className:"gf-form-inline"},X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormLabel,{width:7,tooltip:"Controls the name of the time series, using name or pattern. For example\n {{hostname}} will be replaced with label value for the label hostname."},"Legend"),X.a.createElement("input",{type:"text",className:"gf-form-input",placeholder:"legend format",value:u,onChange:this.onLegendChange,onBlur:this.onRunQuery})),X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormLabel,{width:7,tooltip:X.a.createElement(X.a.Fragment,null,"An additional lower limit for the step parameter of the Prometheus query and for the"," ",X.a.createElement("code",null,"$__interval"),' variable. The limit is absolute and not modified by the "Resolution" setting.')},"Min step"),X.a.createElement("input",{type:"text",className:"gf-form-input width-8",placeholder:o,onChange:this.onIntervalChange,onBlur:this.onRunQuery,value:o})),X.a.createElement("div",{className:"gf-form"},X.a.createElement("div",{className:"gf-form-label"},"Resolution"),X.a.createElement(Z.Select,{isSearchable:!1,options:le,onChange:this.onIntervalFactorChange,value:l})),X.a.createElement("div",{className:"gf-form"},X.a.createElement("div",{className:"gf-form-label"},"Format"),X.a.createElement(Z.Select,{isSearchable:!1,options:oe,onChange:this.onFormatChange,value:i}),X.a.createElement(Z.Switch,{label:"Instant",checked:s,onChange:this.onInstantChange}),X.a.createElement(Z.FormLabel,{width:10,tooltip:"Link to Graph in Prometheus"},X.a.createElement(se,{datasource:t,query:this.query,panelData:a})))))},t}(K.PureComponent),ce=[{title:"Request Rate",expression:"rate(http_request_total[5m])",label:"Given an HTTP request counter, this query calculates the per-second average request rate over the last 5 minutes."},{title:"95th Percentile of Request Latencies",expression:"histogram_quantile(0.95, sum(rate(prometheus_http_request_duration_seconds_bucket[5m])) by (le))",label:"Calculates the 95th percentile of HTTP request rate over 5 minute windows."},{title:"Alerts Firing",expression:'sort_desc(sum(sum_over_time(ALERTS{alertstate="firing"}[24h])) by (alertname))',label:"Sums up the alerts that have been firing over the last 24 hours."},{title:"Step",label:"Defines the graph resolution using a duration format (15s, 1m, 3h, ...). Small steps create high-resolution graphs but can be slow over larger time ranges. Using a longer step lowers the resolution and smooths the graph by producing fewer datapoints. If no step is given the resolution is calculated automatically."}];function he(e){var t=e.label,r=e.onChangeFunc,a=e.onKeyDownFunc,n=e.value,i=e.hasTooltip,s=e.tooltipContent;return X.a.createElement("div",{className:"gf-form-inline explore-input--ml"},X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormLabel,{width:5,tooltip:i?s:null},t),X.a.createElement("input",{type:"text",className:"gf-form-input width-4",placeholder:"auto",onChange:r,onKeyDown:a,value:n})))}Object(K.memo)(he);var me,de=Object(K.memo)(function(e){var t=e.query,r=e.data,a=e.datasource,i=e.history,s=e.onChange,o=e.onRunQuery;return X.a.createElement(ne,{datasource:a,query:t,onRunQuery:o,onChange:s,history:i,data:r,ExtraFieldElement:X.a.createElement(he,{label:"Step",onChangeFunc:function(r){r.currentTarget.value!==t.interval&&function(t){var r=e.query;(0,e.onChange)(Object(n.__assign)(Object(n.__assign)({},r),{interval:t}))}(r.currentTarget.value)},onKeyDownFunc:function(e){"Enter"===e.key&&o()},value:t.interval||"",hasTooltip:!0,tooltipContent:"Needs to be a valid time unit string, for example 5s, 1m, 3h, 1d, 1y"})})}),pe=[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],ve=function(e){var t=e.value,r=e.onChange;return X.a.createElement(X.a.Fragment,null,X.a.createElement("div",{className:"gf-form-group"},X.a.createElement("div",{className:"gf-form-inline"},X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormField,{label:"Scrape interval",labelWidth:13,placeholder:"15s",inputEl:X.a.createElement(Z.Input,{className:"width-6",value:t.jsonData.timeInterval,spellCheck:!1,onChange:be("timeInterval",t,r),validationEvents:fe}),tooltip:"Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s."}))),X.a.createElement("div",{className:"gf-form-inline"},X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormField,{label:"Query timeout",labelWidth:13,inputEl:X.a.createElement(Z.Input,{className:"width-6",value:t.jsonData.queryTimeout,onChange:be("queryTimeout",t,r),spellCheck:!1,placeholder:"60s",validationEvents:fe}),tooltip:"Set the Prometheus query timeout."}))),X.a.createElement("div",{className:"gf-form"},X.a.createElement(Z.FormLabel,{width:13,tooltip:"Specify the HTTP Method to query Prometheus. (POST is only available in Prometheus >= v2.1.0)"},"HTTP Method"),X.a.createElement(Z.Select,{options:pe,value:pe.find(function(e){return e.value===t.jsonData.httpMethod}),onChange:be("httpMethod",t,r),width:7}))),X.a.createElement("h3",{className:"page-heading"},"Misc"),X.a.createElement("div",{className:"gf-form-group"},X.a.createElement("div",{className:"gf-form-inline"},X.a.createElement("div",{className:"gf-form max-width-30"},X.a.createElement(Z.FormField,{label:"Custom query parameters",labelWidth:14,tooltip:"Add Custom parameters to Prometheus or Thanos queries.",inputEl:X.a.createElement(Z.Input,{className:"width-25",value:t.jsonData.customQueryParameters,onChange:be("customQueryParameters",t,r),spellCheck:!1,placeholder:"Example: max_source_resolution=5m&timeout=10"})})))))},fe=((me={})[Z.EventsWithValidation.onBlur]=[Object(Z.regexValidation)(/^$|^\d+(ms|[Mwdhmsy])$/,"Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s")],me),ge=function(e){return e?e.hasOwnProperty("currentTarget")?e.currentTarget.value:e.value:""},be=function(e,t,r){return function(a){var i;r(Object(n.__assign)(Object(n.__assign)({},t),{jsonData:Object(n.__assign)(Object(n.__assign)({},t.jsonData),(i={},i[e]=ge(a),i))}))}};r.d(t,"plugin",function(){return _e});var ye=function(){function e(){this.stepDefaultValuePlaceholder=B}return e.templateUrl="partials/annotations.editor.html",e}(),_e=new a.DataSourcePlugin(G).setQueryEditor(ue).setConfigEditor(function(e){var t=e.options,r=e.onOptionsChange;return X.a.createElement(X.a.Fragment,null,X.a.createElement(Z.DataSourceHttpSettings,{defaultUrl:"http://localhost:9090",dataSourceConfig:t,showAccessOptions:!0,onChange:r}),X.a.createElement(ve,{value:t,onChange:r}))}).setExploreMetricsQueryField(de).setAnnotationQueryCtrl(ye).setExploreStartPage(function(e){return X.a.createElement("div",null,X.a.createElement("h2",null,"PromQL Cheat Sheet"),ce.map(function(t,r){return X.a.createElement("div",{className:"cheat-sheet-item",key:r},X.a.createElement("div",{className:"cheat-sheet-item__title"},t.title),t.expression?X.a.createElement("div",{className:"cheat-sheet-item__example",onClick:function(r){return e.onClickExample({refId:"A",expr:t.expression})}},X.a.createElement("code",null,t.expression)):null,X.a.createElement("div",{className:"cheat-sheet-item__label"},t.label))}))})},HwNo:function(e,t,r){"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.head;case 1:if(!t){e.next=7;break}return e.next=4,t.value;case 4:t=t.next,e.next=1;break;case 7:case"end":return e.stop()}},e,this)})}},HyWp:function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var i=r("XPeR"),s=Symbol("max"),o=Symbol("length"),l=Symbol("lengthCalculator"),u=Symbol("allowStale"),c=Symbol("maxAge"),h=Symbol("dispose"),m=Symbol("noDisposeOnSet"),d=Symbol("lruList"),p=Symbol("cache"),v=Symbol("updateAgeOnGet"),f=function(){return 1},g=function(){function e(t){if(a(this,e),"number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[s]=t.max||1/0;var r=t.length||f;if(this[l]="function"!=typeof r?f:r,this[u]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[c]=t.maxAge||0,this[h]=t.dispose,this[m]=t.noDisposeOnSet||!1,this[v]=t.updateAgeOnGet||!1,this.reset()}var t,r,g;return t=e,(r=[{key:"rforEach",value:function(e,t){t=t||this;for(var r=this[d].tail;null!==r;){var a=r.prev;T(this,e,r,t),r=a}}},{key:"forEach",value:function(e,t){t=t||this;for(var r=this[d].head;null!==r;){var a=r.next;T(this,e,r,t),r=a}}},{key:"keys",value:function(){return this[d].toArray().map(function(e){return e.key})}},{key:"values",value:function(){return this[d].toArray().map(function(e){return e.value})}},{key:"reset",value:function(){var e=this;this[h]&&this[d]&&this[d].length&&this[d].forEach(function(t){return e[h](t.key,t.value)}),this[p]=new Map,this[d]=new i,this[o]=0}},{key:"dump",value:function(){var e=this;return this[d].map(function(t){return!y(e,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}}).toArray().filter(function(e){return e})}},{key:"dumpLru",value:function(){return this[d]}},{key:"set",value:function(e,t,r){if((r=r||this[c])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");var a=r?Date.now():0,n=this[l](t,e);if(this[p].has(e)){if(n>this[s])return x(this,this[p].get(e)),!1;var i=this[p].get(e).value;return this[h]&&(this[m]||this[h](e,i.value)),i.now=a,i.maxAge=r,i.value=t,this[o]+=n-i.length,i.length=n,this.get(e),_(this),!0}var u=new w(e,t,n,a,r);return u.length>this[s]?(this[h]&&this[h](e,t),!1):(this[o]+=u.length,this[d].unshift(u),this[p].set(e,this[d].head),_(this),!0)}},{key:"has",value:function(e){if(!this[p].has(e))return!1;var t=this[p].get(e).value;return!y(this,t)}},{key:"get",value:function(e){return b(this,e,!0)}},{key:"peek",value:function(e){return b(this,e,!1)}},{key:"pop",value:function(){var e=this[d].tail;return e?(x(this,e),e.value):null}},{key:"del",value:function(e){x(this,this[p].get(e))}},{key:"load",value:function(e){this.reset();for(var t=Date.now(),r=e.length-1;r>=0;r--){var a=e[r],n=a.e||0;if(0===n)this.set(a.k,a.v);else{var i=n-t;i>0&&this.set(a.k,a.v,i)}}}},{key:"prune",value:function(){var e=this;this[p].forEach(function(t,r){return b(e,r,!1)})}},{key:"max",set:function(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[s]=e||1/0,_(this)},get:function(){return this[s]}},{key:"allowStale",set:function(e){this[u]=!!e},get:function(){return this[u]}},{key:"maxAge",set:function(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[c]=e,_(this)},get:function(){return this[c]}},{key:"lengthCalculator",set:function(e){var t=this;"function"!=typeof e&&(e=f),e!==this[l]&&(this[l]=e,this[o]=0,this[d].forEach(function(e){e.length=t[l](e.value,e.key),t[o]+=e.length})),_(this)},get:function(){return this[l]}},{key:"length",get:function(){return this[o]}},{key:"itemCount",get:function(){return this[d].length}}])&&n(t.prototype,r),g&&n(t,g),e}(),b=function(e,t,r){var a=e[p].get(t);if(a){var n=a.value;if(y(e,n)){if(x(e,a),!e[u])return}else r&&(e[v]&&(a.value.now=Date.now()),e[d].unshiftNode(a));return n.value}},y=function(e,t){if(!t||!t.maxAge&&!e[c])return!1;var r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[c]&&r>e[c]},_=function(e){if(e[o]>e[s])for(var t=e[d].tail;e[o]>e[s]&&null!==t;){var r=t.prev;x(e,t),t=r}},x=function(e,t){if(t){var r=t.value;e[h]&&e[h](r.key,r.value),e[o]-=r.length,e[p].delete(r.key),e[d].removeNode(t)}},w=function e(t,r,n,i,s){a(this,e),this.key=t,this.value=r,this.length=n,this.now=i,this.maxAge=s||0},T=function(e,t,r,a){var n=r.value;y(e,n)&&(x(e,r),e[u]||(n=void 0)),n&&t.call(a,n.value,n.key,e)};e.exports=g},XPeR:function(e,t,r){"use strict";function a(e){var t=this;if(t instanceof a||(t=new a),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}function n(e,t,r){var a=t===e.head?new o(r,null,t,e):new o(r,t,t.next,e);return null===a.next&&(e.tail=a),null===a.prev&&(e.head=a),e.length++,a}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new o(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function o(e,t,r,a){if(!(this instanceof o))return new o(e,t,r,a);this.list=a,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=a,a.Node=o,a.create=a,a.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},a.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},a.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},a.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},a.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},a.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},a.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},a.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,a=0;null!==r;a++)e.call(t,r.value,a,this),r=r.next},a.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,a=this.length-1;null!==r;a--)e.call(t,r.value,a,this),r=r.prev},a.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},a.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},a.prototype.map=function(e,t){t=t||this;for(var r=new a,n=this.head;null!==n;)r.push(e.call(t,n.value,this)),n=n.next;return r},a.prototype.mapReverse=function(e,t){t=t||this;for(var r=new a,n=this.tail;null!==n;)r.push(e.call(t,n.value,this)),n=n.prev;return r},a.prototype.reduce=function(e,t){var r,a=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");a=this.head.next,r=this.head.value}for(var n=0;null!==a;n++)r=e(r,a.value,n),a=a.next;return r},a.prototype.reduceReverse=function(e,t){var r,a=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");a=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==a;n--)r=e(r,a.value,n),a=a.prev;return r},a.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},a.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},a.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new a;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,i=this.head;null!==i&&n<e;n++)i=i.next;for(;null!==i&&n<t;n++,i=i.next)r.push(i.value);return r},a.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new a;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,i=this.tail;null!==i&&n>t;n--)i=i.prev;for(;null!==i&&n>e;n--,i=i.prev)r.push(i.value);return r},a.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,a=this.head;null!==a&&r<e;r++)a=a.next;var i=[];for(r=0;a&&r<t;r++)i.push(a.value),a=this.removeNode(a);null===a&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(r=2;r<arguments.length;r++)a=n(this,a,arguments[r]);return i},a.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var a=r.prev;r.prev=r.next,r.next=a}return this.head=t,this.tail=e,this};try{r("HwNo")(a)}catch(e){}},ceQ3:function(e,t,r){"use strict";r.d(t,"d",function(){return n}),r.d(t,"e",function(){return i}),r.d(t,"f",function(){return s}),r.d(t,"b",function(){return o}),r.d(t,"c",function(){return l}),r.d(t,"a",function(){return u});var a=r("mrSG"),n=function(e){for(var t=[],r=new RegExp("_bucket($|:)"),a=0;a<e.length;a++){var n=e[a];r.test(n)&&-1===t.indexOf(n)&&t.push(n)}return{values:{__name__:t}}};function i(e,t){void 0===t&&(t=!1);var r={};return e.forEach(function(e){var n=e.__name__,i=Object(a.__rest)(e,["__name__"]);t&&(r.__name__=r.__name__||[],r.__name__.includes(n)||r.__name__.push(n)),Object.keys(i).forEach(function(e){r[e]||(r[e]=[]),r[e].includes(i[e])||r[e].push(i[e])})}),{values:r,keys:Object.keys(r)}}var s=/\{[^}]*?\}/,o=/\b(\w+)(!?=~?)("[^"\n]*?")/g;function l(e,t){if(void 0===t&&(t=1),!e.match(s)){if(e.match(/^[A-Za-z:][\w:]*$/))return{selector:'{__name__="'+e+'"}',labelKeys:["__name__"]};throw new Error("Query must contain a selector: "+e)}var r=e.slice(0,t),a=r.lastIndexOf("{"),n=r.lastIndexOf("}");if(-1===a)throw new Error("Not inside selector, missing open brace: "+r);if(n>-1&&n>a)throw new Error("Not inside selector, previous selector already closed: "+r);var i=e.slice(t),l=i.indexOf("}")+t,u=i.indexOf("{"),c=u+t;if(-1===l)throw new Error("Not inside selector, missing closing brace in suffix: "+i);if(u>-1&&c<l)throw new Error("Not inside selector, next selector opens before this one closed: "+i);var h=e.slice(a,l),m={};h.replace(o,function(r,a,n,i){var s=e.indexOf(r),o=s+a.length+n.length+1,l=s+a.length+n.length+i.length-1;return(t<o||t>l)&&(m[a]={value:i,operator:n}),""});var d=e.slice(0,a).match(/[A-Za-z:][\w:]*$/);d&&(m.__name__={value:'"'+d[0]+'"',operator:"="});var p=Object.keys(m).sort(),v=p.map(function(e){return""+e+m[e].operator+m[e].value}).join(",");return{labelKeys:p,selector:["{",v,"}"].join("")}}function u(e,t){var r=Object.keys(t),a=new RegExp("(\\s|^)("+r.join("|")+")(\\s|$|\\(|\\[|\\{)","ig");return e.replace(a,function(e,r,a,n){return""+r+t[a]+n})}},"eqT+":function(e,t,r){"use strict";r.d(t,"a",function(){return c}),r.d(t,"c",function(){return h});var a=r("LvDl"),n=r.n(a),i="by|without|on|ignoring|group_left|group_right|bool|or|and|unless",s=[i,"count|count_values|min|max|avg|sum|stddev|stdvar|bottomk|topk|quantile","true|false|null|__name__|job","abs|absent|ceil|changes|clamp_max|clamp_min|count_scalar|day_of_month|day_of_week|days_in_month|delta|deriv","drop_common_labels|exp|floor|histogram_quantile|holt_winters|hour|idelta|increase|irate|label_replace|ln|log2","log10|minute|month|predict_linear|rate|resets|round|scalar|sort|sort_desc|sqrt|time|vector|year|avg_over_time","min_over_time|max_over_time|sum_over_time|count_over_time|quantile_over_time|stddev_over_time|stdvar_over_time"].join("|").split("|"),o=/([A-Za-z:][\w:]*)\b(?![\(\]{=!",])/g,l=/{([^{]*)}/g;var u=/(\w+)\s*(=|!=|=~|!~)\s*("[^"]*")/g;function c(e,t,r,a){var i=[];if(e)for(var s=u.exec(e);s;)i.push({key:s[1],operator:s[2],value:s[3]}),s=u.exec(e);var o=a||"=";return i.push({key:t,operator:o,value:'"'+r+'"'}),"{"+n.a.chain(i).uniqWith(n.a.isEqual).compact().sortBy("key").map(function(e){return""+e.key+e.operator+e.value}).value().join(",")+"}"}function h(e){return e.replace(/\{(.*?)\}/g,"").replace(/^ /,"")}t.b=function(e,t,r,a){if(!t||!r)throw new Error("Need label to add to query.");var n;e=e.replace(o,function(t,r,a){var o,l,u,c,h,m,d=(l=a,u="{",c="}",h=(o=e).slice(l).indexOf(u),(m=o.slice(l).indexOf(c))>-1&&(-1===h||h>m)),p=n&&i.split("|").indexOf(n)>-1,v=r.endsWith(":");return n=r,d||v||p||-1!==s.indexOf(r)?r:r+"{}"});for(var u=l.exec(e),h=[],m=0,d="";u;){var p=e.slice(m,u.index),v=c(u[1],t,r,a);m=u.index+u[1].length+2,d=e.slice(u.index+u[0].length),h.push(p,v),u=l.exec(e)}return h.push(d),h.join("")}},itod:function(e,t,r){"use strict";r.d(t,"b",function(){return n}),r.d(t,"a",function(){return i});var a=r("mrSG"),n=[{label:"$__interval",sortText:"$__interval"},{label:"1m",sortText:"00:01:00"},{label:"5m",sortText:"00:05:00"},{label:"10m",sortText:"00:10:00"},{label:"30m",sortText:"00:30:00"},{label:"1h",sortText:"01:00:00"},{label:"1d",sortText:"24:00:00"}],i=Object(a.__spread)([{label:"sum",insertText:"sum",documentation:"Calculate sum over dimensions"},{label:"min",insertText:"min",documentation:"Select minimum over dimensions"},{label:"max",insertText:"max",documentation:"Select maximum over dimensions"},{label:"avg",insertText:"avg",documentation:"Calculate the average over dimensions"},{label:"stddev",insertText:"stddev",documentation:"Calculate population standard deviation over dimensions"},{label:"stdvar",insertText:"stdvar",documentation:"Calculate population standard variance over dimensions"},{label:"count",insertText:"count",documentation:"Count number of elements in the vector"},{label:"count_values",insertText:"count_values",documentation:"Count number of elements with the same value"},{label:"bottomk",insertText:"bottomk",documentation:"Smallest k elements by sample value"},{label:"topk",insertText:"topk",documentation:"Largest k elements by sample value"},{label:"quantile",insertText:"quantile",documentation:"Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions"}],[{insertText:"abs",label:"abs",detail:"abs(v instant-vector)",documentation:"Returns the input vector with all sample values converted to their absolute value."},{insertText:"absent",label:"absent",detail:"absent(v instant-vector)",documentation:"Returns an empty vector if the vector passed to it has any elements and a 1-element vector with the value 1 if the vector passed to it has no elements. This is useful for alerting on when no time series exist for a given metric name and label combination."},{insertText:"ceil",label:"ceil",detail:"ceil(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` up to the nearest integer."},{insertText:"changes",label:"changes",detail:"changes(v range-vector)",documentation:"For each input time series, `changes(v range-vector)` returns the number of times its value has changed within the provided time range as an instant vector."},{insertText:"clamp_max",label:"clamp_max",detail:"clamp_max(v instant-vector, max scalar)",documentation:"Clamps the sample values of all elements in `v` to have an upper limit of `max`."},{insertText:"clamp_min",label:"clamp_min",detail:"clamp_min(v instant-vector, min scalar)",documentation:"Clamps the sample values of all elements in `v` to have a lower limit of `min`."},{insertText:"count_scalar",label:"count_scalar",detail:"count_scalar(v instant-vector)",documentation:"Returns the number of elements in a time series vector as a scalar. This is in contrast to the `count()` aggregation operator, which always returns a vector (an empty one if the input vector is empty) and allows grouping by labels via a `by` clause."},{insertText:"day_of_month",label:"day_of_month",detail:"day_of_month(v=vector(time()) instant-vector)",documentation:"Returns the day of the month for each of the given times in UTC. Returned values are from 1 to 31."},{insertText:"day_of_week",label:"day_of_week",detail:"day_of_week(v=vector(time()) instant-vector)",documentation:"Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc."},{insertText:"days_in_month",label:"days_in_month",detail:"days_in_month(v=vector(time()) instant-vector)",documentation:"Returns number of days in the month for each of the given times in UTC. Returned values are from 28 to 31."},{insertText:"delta",label:"delta",detail:"delta(v range-vector)",documentation:"Calculates the difference between the first and last value of each time series element in a range vector `v`, returning an instant vector with the given deltas and equivalent labels. The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers."},{insertText:"deriv",label:"deriv",detail:"deriv(v range-vector)",documentation:"Calculates the per-second derivative of the time series in a range vector `v`, using simple linear regression."},{insertText:"drop_common_labels",label:"drop_common_labels",detail:"drop_common_labels(instant-vector)",documentation:"Drops all labels that have the same name and value across all series in the input vector."},{insertText:"exp",label:"exp",detail:"exp(v instant-vector)",documentation:"Calculates the exponential function for all elements in `v`.\nSpecial cases are:\n* `Exp(+Inf) = +Inf` \n* `Exp(NaN) = NaN`"},{insertText:"floor",label:"floor",detail:"floor(v instant-vector)",documentation:"Rounds the sample values of all elements in `v` down to the nearest integer."},{insertText:"histogram_quantile",label:"histogram_quantile",detail:"histogram_quantile(φ float, b instant-vector)",documentation:"Calculates the φ-quantile (0 ≤ φ ≤ 1) from the buckets `b` of a histogram. The samples in `b` are the counts of observations in each bucket. Each sample must have a label `le` where the label value denotes the inclusive upper bound of the bucket. (Samples without such a label are silently ignored.) The histogram metric type automatically provides time series with the `_bucket` suffix and the appropriate labels."},{insertText:"holt_winters",label:"holt_winters",detail:"holt_winters(v range-vector, sf scalar, tf scalar)",documentation:"Produces a smoothed value for time series based on the range in `v`. The lower the smoothing factor `sf`, the more importance is given to old data. The higher the trend factor `tf`, the more trends in the data is considered. Both `sf` and `tf` must be between 0 and 1."},{insertText:"hour",label:"hour",detail:"hour(v=vector(time()) instant-vector)",documentation:"Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23."},{insertText:"idelta",label:"idelta",detail:"idelta(v range-vector)",documentation:"Calculates the difference between the last two samples in the range vector `v`, returning an instant vector with the given deltas and equivalent labels."},{insertText:"increase",label:"increase",detail:"increase(v range-vector)",documentation:"Calculates the increase in the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. The increase is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if a counter increases only by integer increments."},{insertText:"irate",label:"irate",detail:"irate(v range-vector)",documentation:"Calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for."},{insertText:"label_replace",label:"label_replace",detail:"label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)",documentation:"For each timeseries in `v`, `label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)` matches the regular expression `regex` against the label `src_label`. If it matches, then the timeseries is returned with the label `dst_label` replaced by the expansion of `replacement`. `$1` is replaced with the first matching subgroup, `$2` with the second etc. If the regular expression doesn't match then the timeseries is returned unchanged."},{insertText:"ln",label:"ln",detail:"ln(v instant-vector)",documentation:"calculates the natural logarithm for all elements in `v`.\nSpecial cases are:\n * `ln(+Inf) = +Inf`\n * `ln(0) = -Inf`\n * `ln(x < 0) = NaN`\n * `ln(NaN) = NaN`"},{insertText:"log2",label:"log2",detail:"log2(v instant-vector)",documentation:"Calculates the binary logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"log10",label:"log10",detail:"log10(v instant-vector)",documentation:"Calculates the decimal logarithm for all elements in `v`. The special cases are equivalent to those in `ln`."},{insertText:"minute",label:"minute",detail:"minute(v=vector(time()) instant-vector)",documentation:"Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59."},{insertText:"month",label:"month",detail:"month(v=vector(time()) instant-vector)",documentation:"Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc."},{insertText:"predict_linear",label:"predict_linear",detail:"predict_linear(v range-vector, t scalar)",documentation:"Predicts the value of time series `t` seconds from now, based on the range vector `v`, using simple linear regression."},{insertText:"rate",label:"rate",detail:"rate(v range-vector)",documentation:"Calculates the per-second average rate of increase of the time series in the range vector. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for. Also, the calculation extrapolates to the ends of the time range, allowing for missed scrapes or imperfect alignment of scrape cycles with the range's time period."},{insertText:"resets",label:"resets",detail:"resets(v range-vector)",documentation:"For each input time series, `resets(v range-vector)` returns the number of counter resets within the provided time range as an instant vector. Any decrease in the value between two consecutive samples is interpreted as a counter reset."},{insertText:"round",label:"round",detail:"round(v instant-vector, to_nearest=1 scalar)",documentation:"Rounds the sample values of all elements in `v` to the nearest integer. Ties are resolved by rounding up. The optional `to_nearest` argument allows specifying the nearest multiple to which the sample values should be rounded. This multiple may also be a fraction."},{insertText:"scalar",label:"scalar",detail:"scalar(v instant-vector)",documentation:"Given a single-element input vector, `scalar(v instant-vector)` returns the sample value of that single element as a scalar. If the input vector does not have exactly one element, `scalar` will return `NaN`."},{insertText:"sort",label:"sort",detail:"sort(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in ascending order."},{insertText:"sort_desc",label:"sort_desc",detail:"sort_desc(v instant-vector)",documentation:"Returns vector elements sorted by their sample values, in descending order."},{insertText:"sqrt",label:"sqrt",detail:"sqrt(v instant-vector)",documentation:"Calculates the square root of all elements in `v`."},{insertText:"time",label:"time",detail:"time()",documentation:"Returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated."},{insertText:"vector",label:"vector",detail:"vector(s scalar)",documentation:"Returns the scalar `s` as a vector with no labels."},{insertText:"year",label:"year",detail:"year(v=vector(time()) instant-vector)",documentation:"Returns the year for each of the given times in UTC."},{insertText:"avg_over_time",label:"avg_over_time",detail:"avg_over_time(range-vector)",documentation:"The average value of all points in the specified interval."},{insertText:"min_over_time",label:"min_over_time",detail:"min_over_time(range-vector)",documentation:"The minimum value of all points in the specified interval."},{insertText:"max_over_time",label:"max_over_time",detail:"max_over_time(range-vector)",documentation:"The maximum value of all points in the specified interval."},{insertText:"sum_over_time",label:"sum_over_time",detail:"sum_over_time(range-vector)",documentation:"The sum of all values in the specified interval."},{insertText:"count_over_time",label:"count_over_time",detail:"count_over_time(range-vector)",documentation:"The count of all values in the specified interval."},{insertText:"quantile_over_time",label:"quantile_over_time",detail:"quantile_over_time(scalar, range-vector)",documentation:"The φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval."},{insertText:"stddev_over_time",label:"stddev_over_time",detail:"stddev_over_time(range-vector)",documentation:"The population standard deviation of the values in the specified interval."},{insertText:"stdvar_over_time",label:"stdvar_over_time",detail:"stdvar_over_time(range-vector)",documentation:"The population standard variance of the values in the specified interval."}]),s={comment:{pattern:/#.*/},"context-aggregation":{pattern:/((by|without)\s*)\([^)]*\)/,lookbehind:!0,inside:{"label-key":{pattern:/[^(),\s][^,)]*[^),\s]*/,alias:"attr-name"},punctuation:/[()]/}},"context-labels":{pattern:/\{[^}]*(?=})/,greedy:!0,inside:{comment:{pattern:/#.*/},"label-key":{pattern:/[a-z_]\w*(?=\s*(=|!=|=~|!~))/,alias:"attr-name",greedy:!0},"label-value":{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0,alias:"attr-value"},punctuation:/[{]/}},function:new RegExp("\\b(?:"+i.map(function(e){return e.label}).join("|")+")(?=\\s*\\()","i"),"context-range":[{pattern:/\[[^\]]*(?=])/,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}},{pattern:/(offset\s+)\w+/,lookbehind:!0,inside:{"range-duration":{pattern:/\b\d+[smhdwy]\b/i,alias:"number"}}}],number:/\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,operator:new RegExp("/[-+*/=%^~]|&&?|\\|?\\||!=?|<(?:=>?|<|>)?|>[>=]?|\\b(?:"+["by","group_left","group_right","ignoring","on","offset","without"].join("|")+")\\b","i"),punctuation:/[{};()`,.]/};t.c=s},sGFA:function(e,t,r){"use strict";r.d(t,"a",function(){return a});var a=function(e){var t=!1;return{promise:new Promise(function(r,a){e.then(function(e){return t?a({isCanceled:!0}):r(e)}),e.catch(function(e){return a(t?{isCanceled:!0}:e)})}),cancel:function(){t=!0}}}}}]); //# sourceMappingURL=prometheusPlugin.4d0490a94b199a11f40c.js.map