D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
8695.c23c9961ab344f38b174.js
back
Copy
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8695],{63250:(G,A,t)=>{t.d(A,{K:()=>T});var e=t(42844),D=t(27702),d=t(66310);const T=({children:o})=>{const p=(0,d.wW)(i);return D.createElement("div",{className:p.root},o)},i=o=>({root:(0,e.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:o.spacing(3),minHeight:o.spacing(4)})})},29473:(G,A,t)=>{t.d(A,{B:()=>D});var e=t(27702);const D=({grow:d,shrink:T})=>e.createElement("div",{style:{display:"block",flexGrow:d,flexShrink:T}})},29036:(G,A,t)=>{t.d(A,{X:()=>P});var e=t(42844),D=t(27702),d=t(66310),T=t(28580),i=t(50285),o=Object.defineProperty,p=Object.defineProperties,u=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,O=(n,s,r)=>s in n?o(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r,_=(n,s)=>{for(var r in s||(s={}))a.call(s,r)&&O(n,r,s[r]);if(E)for(var r of E(s))I.call(s,r)&&O(n,r,s[r]);return n},h=(n,s)=>p(n,u(s)),g=(n,s)=>{var r={};for(var m in n)a.call(n,m)&&s.indexOf(m)<0&&(r[m]=n[m]);if(n!=null&&E)for(var m of E(n))s.indexOf(m)<0&&I.call(n,m)&&(r[m]=n[m]);return r};function P(n){var s=n,{label:r}=s,m=g(s,["label"]);const L=(0,d.wW)(l),[N]=(0,D.useState)(()=>Math.random().toString(16).slice(2)),M={SelectContainer:U,ValueContainer:v,SingleValue:v};return D.createElement("div",{className:L.root},r&&D.createElement("label",{className:L.label,htmlFor:N},r,":","\xA0"),D.createElement(T.Ph,h(_({openMenuOnFocus:!0,inputId:N},m),{components:M})))}const U=n=>{const{children:s}=n,r=(0,d.wW)(l);return D.createElement(i.e,h(_({},n),{className:(0,e.cx)(n.className,r.container)}),s)},v=n=>{const{className:s,children:r}=n,m=(0,d.wW)(l);return D.createElement("div",{className:(0,e.cx)(s,m.valueContainer)},r)},l=n=>({root:(0,e.css)({display:"flex",fontSize:12,alignItems:"center"}),label:(0,e.css)({color:n.colors.text.secondary,whiteSpace:"nowrap"}),container:(0,e.css)({background:"none",borderColor:"transparent"}),valueContainer:(0,e.css)({display:"flex",alignItems:"center",flex:"initial",color:n.colors.text.secondary,fontSize:12})})},29927:(G,A,t)=>{t.d(A,{P:()=>i});var e=t(27702),D=t(81924),d=t(28580),T=t(91064);const i=u=>{const E=o(u),a=p(E,u);return e.createElement(D.S,{label:"Group by function","data-testid":"cloud-monitoring-aggregation"},e.createElement(d.Ph,{width:"auto",onChange:({value:I})=>u.onChange(I),value:a,options:[{label:"Template Variables",options:u.templateVariableOptions},{label:"Aggregations",expanded:!0,options:E}],placeholder:"Select Reducer",inputId:`${u.refId}-group-by-function`,menuPlacement:"top"}))},o=({metricDescriptor:u})=>{const E=u?.valueType,a=u?.metricKind;return(0,e.useMemo)(()=>!E||!a?[]:(0,T.A_)(E,a).map(I=>({...I,label:I.text})),[E,a])},p=(u,E)=>(0,e.useMemo)(()=>[...u,...E.templateVariableOptions].find(I=>I.value===E.crossSeriesReducer),[u,E.crossSeriesReducer,E.templateVariableOptions])},38582:(G,A,t)=>{t.d(A,{B:()=>o});var e=t(89949),D=t.n(e),d=t(27702),T=t(81924),i=t(1128);const o=({refId:p,value:u="",onChange:E})=>{const[a,I]=(0,d.useState)(u??""),O=(0,e.debounce)(E,1e3);return E=_=>{I(_.target.value),O(_.target.value)},d.createElement(T.S,{label:"Alias by"},d.createElement(i.I,{id:`${p}-alias-by`,value:a,onChange:E}))}},82863:(G,A,t)=>{t.d(A,{v:()=>u});var e=t(27702),D=t(2906),d=t(81924),T=t(6774),i=t(91064),o=t(48826),p=t(25998);const u=({refId:E,templateVariableOptions:a,onChange:I,query:O,customMetaData:_,datasource:h,metricDescriptor:g,preprocessor:P})=>{const U=(0,e.useMemo)(()=>(0,i.kU)(_,h),[_,h]);return e.createElement(D.s,null,e.createElement(d.S,{label:"Alignment function",tooltip:"The process of alignment consists of collecting all data points received in a fixed length of time, applying a function to combine those data points, and assigning a timestamp to the result."},e.createElement(o.X,{inputId:`${E}-alignment-function`,templateVariableOptions:a,query:O,onChange:v=>I({...O,...v}),metricDescriptor:g,preprocessor:P})),e.createElement(d.S,{label:"Alignment period",tooltip:U},e.createElement(p.$,{inputId:`${E}-alignment-period`,templateVariableOptions:a,current:O.alignmentPeriod,onChange:v=>I({...O,alignmentPeriod:v}),aligmentPeriods:T.dD})))}},48826:(G,A,t)=>{t.d(A,{X:()=>T});var e=t(27702),D=t(28580),d=t(91064);const T=({inputId:i,query:o,templateVariableOptions:p,onChange:u,metricDescriptor:E,preprocessor:a})=>{const{perSeriesAligner:I}=o;let{valueType:O,metricKind:_}=E||{};const{perSeriesAligner:h,alignOptions:g}=(0,e.useMemo)(()=>(0,d.ID)(O,_,I,a),[O,_,I,a]);return e.createElement(D.Ph,{onChange:({value:P})=>u({...o,perSeriesAligner:P}),value:[...g,...p].find(P=>P.value===h),options:[{label:"Template Variables",options:p},{label:"Alignment options",expanded:!0,options:g}],placeholder:"Select Alignment",inputId:i,menuPlacement:"top"})}},34584:(G,A,t)=>{t.d(A,{X:()=>u});var e=t(27702),D=t(2906),d=t(81924),T=t(28580),i=t(6774),o=t(91064),p=t(29927);const u=({refId:E,labels:a=[],query:I,onChange:O,variableOptionGroup:_,metricDescriptor:h})=>{const g=(0,e.useMemo)(()=>[_,...(0,o.gY)([...a,...i.$e])],[a,_]);return e.createElement(D.s,null,e.createElement(d.S,{label:"Group by",tooltip:"You can reduce the amount of data returned for a metric by combining different time series. To combine multiple time series, you can specify a grouping and a function. Grouping is done on the basis of labels. The grouping function is used to combine the time series in the group into a single time series."},e.createElement(T.NU,{inputId:`${E}-group-by`,width:"auto",placeholder:"Choose label",options:g,value:I.groupBys??[],onChange:P=>{O({...I,groupBys:P.map(U=>U.value)})},menuPlacement:"top"})),e.createElement(p.P,{metricDescriptor:h,templateVariableOptions:_.options,crossSeriesReducer:I.crossSeriesReducer,groupBys:I.groupBys??[],onChange:P=>O({...I,crossSeriesReducer:P}),refId:E}))}},89452:(G,A,t)=>{t.d(A,{p:()=>g});var e=t(27702),D=t(81078),d=t(76715),T=t(57942),i=t(81924),o=t(38162),p=t(64022),u=t(28580),E=t(91064);const a="=",I="AND",O=P=>P.flatMap(({key:U,operator:v,value:l,condition:n})=>[U,v,l,n]).slice(0,-1),_=["=","!=","=~","!=~"].map(D.E),h=["metric.type"],g=({labels:P={},filters:U,onChange:v,variableOptionGroup:l})=>{const n=(0,E.mi)(U),s=n.filter(({key:c})=>!h.includes(c)),r=n.filter(({key:c})=>h.includes(c)),m=(0,e.useMemo)(()=>[l,...(0,E.gY)(Object.keys(P))],[P,l]),L=({key:c="",value:C=""})=>{m.some($=>$.options?m.some(V=>V.label===c):$.label===c)||m.push({label:c,value:c});const y=P.hasOwnProperty(c)?[l,...P[c].map(D.E)]:[l];return y.some($=>$.label===C)||y.push({label:C,value:C}),{options:m,valueOptions:y}},N=c=>{const C=c.concat(r).map(({key:B,operator:y,value:W,condition:$})=>({key:B||"",operator:y||a,value:W||"",condition:$||I}));v(O(C))},M=(c,C,B)=>{const{key:y="",operator:W=a,value:$="",condition:V=I}=c,{options:Q,valueOptions:q}=L(c);return e.createElement(p.Lh,{spacing:"xs",width:"auto"},e.createElement(u.Ph,{"aria-label":"Filter label key",formatCreateLabel:x=>`Use label key: ${x}`,allowCustomValue:!0,value:y,options:Q,onChange:({value:x=""})=>C({key:x,operator:W,value:$,condition:V})}),e.createElement(u.Ph,{value:W,options:_,onChange:({value:x=a})=>C({key:y,operator:x,value:$,condition:V})}),e.createElement(u.Ph,{"aria-label":"Filter label value",placeholder:"add filter value",formatCreateLabel:x=>`Use label value: ${x}`,allowCustomValue:!0,value:$,options:q,onChange:({value:x=""})=>C({key:y,operator:W,value:x,condition:V})}),e.createElement(d._,{"aria-label":"Remove",icon:"times",variant:"secondary",onClick:B,type:"button"}))};return e.createElement(T.p,null,e.createElement(i.S,{label:"Filter",tooltip:"To reduce the amount of data charted, apply a filter. A filter has three components: a label, a comparison, and a value. The comparison can be an equality, inequality, or regular expression."},e.createElement(o.k,{items:s,renderItem:M,onChange:N})))}},7699:(G,A,t)=>{t.d(A,{a:()=>d});var e=t(27702),D=t(60105);function d({query:T,onChange:i,onRunQuery:o}){const p=u=>{u.key==="Enter"&&(u.shiftKey||u.ctrlKey)&&(u.preventDefault(),o())};return e.createElement(e.Fragment,null,e.createElement(D.K,{name:"Query",className:"slate-query-field",value:T,rows:10,placeholder:"Enter a Cloud Monitoring MQL query (Run with Shift+Enter)",onBlur:o,onChange:u=>i(u.currentTarget.value),onKeyDown:p}))}},26956:(G,A,t)=>{t.d(A,{a1:()=>U,mO:()=>h});var e=t(27702),D=t(83788),d=t(64746),T=t(57942),i=t(81924),o=t(64022),p=t(42074),u=t(6774),E=t(16313);const a=({refId:v,onChange:l,graphPeriod:n,variableOptionGroup:s})=>e.createElement(T.p,null,e.createElement(i.S,{label:"Graph period",htmlFor:`${v}-graph-period`,tooltip:e.createElement(e.Fragment,null,"Set ",e.createElement("code",null,"graph_period")," which forces a preferred period between points. Automatically set to the current interval if left blank.")},e.createElement(o.Lh,null,e.createElement(p.r,{"data-testid":`${v}-switch-graph-period`,value:n!=="disabled",onChange:r=>l(r.currentTarget.checked?"":"disabled")}),e.createElement(E.$d,{inputId:`${v}-graph-period`,templateVariableOptions:s.options,current:n,onChange:l,disabled:n==="disabled",aligmentPeriods:u.Ry}))));var I=t(7699),O=t(56525),_=t(49040);const h=v=>({projectName:v.getDefaultProject(),crossSeriesReducer:"REDUCE_NONE",alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:d.CS.ALIGN_MEAN,groupBys:[],filters:[]}),g=v=>({projectName:v.getDefaultProject(),query:""});function P({refId:v,query:l,datasource:n,onChange:s,onRunQuery:r,customMetaData:m,variableOptionGroup:L}){const N=(0,e.useCallback)(c=>{s({...l,timeSeriesList:c}),r()},[s,r,l]),M=(0,e.useCallback)(c=>{s({...l,timeSeriesQuery:c}),r()},[s,r,l]);return(0,e.useEffect)(()=>{l.queryType===d.xL.TIME_SERIES_LIST&&!l.timeSeriesList&&s({refId:l.refId,datasource:l.datasource,queryType:d.xL.TIME_SERIES_LIST,timeSeriesList:h(n)}),l.queryType===d.xL.TIME_SERIES_QUERY&&!l.timeSeriesQuery&&s({refId:l.refId,datasource:l.datasource,queryType:d.xL.TIME_SERIES_QUERY,timeSeriesQuery:g(n)})},[s,l,n]),e.createElement(D._,null,(l.queryType===d.xL.ANNOTATION||l.queryType===d.xL.TIME_SERIES_LIST)&&l.timeSeriesList&&e.createElement(_.s,{refId:v,variableOptionGroup:L,customMetaData:m,onChange:N,datasource:n,query:l.timeSeriesList,aliasBy:l.aliasBy,onChangeAliasBy:c=>s({...l,aliasBy:c})}),l.queryType===d.xL.TIME_SERIES_QUERY&&l.timeSeriesQuery&&e.createElement(e.Fragment,null,e.createElement(O.I,{refId:v,datasource:n,onChange:c=>M({...l.timeSeriesQuery,projectName:c}),templateVariableOptions:L.options,projectName:l.timeSeriesQuery.projectName}),e.createElement(I.a,{onChange:c=>M({...l.timeSeriesQuery,query:c}),onRunQuery:r,query:l.timeSeriesQuery.query}),e.createElement(a,{onChange:c=>M({...l.timeSeriesQuery,graphPeriod:c}),graphPeriod:l.timeSeriesQuery.graphPeriod,refId:v,variableOptionGroup:L})))}const U=e.memo(P)},25998:(G,A,t)=>{t.d(A,{$:()=>d});var e=t(27702),D=t(28580);function d({inputId:T,templateVariableOptions:i,onChange:o,current:p,disabled:u,aligmentPeriods:E}){const a=(0,e.useMemo)(()=>E.map(O=>({...O,label:O.text})),[E]),I=(0,e.useMemo)(()=>a.filter(O=>!O.hidden),[a]);return e.createElement(D.Ph,{width:"auto",onChange:({value:O})=>o(O),value:[...a,...i].find(O=>O.value===p),options:[{label:"Template Variables",options:i},{label:"Aggregations",expanded:!0,options:I}],placeholder:"Select Period",inputId:T,disabled:u,allowCustomValue:!0,menuPlacement:"top"})}},56560:(G,A,t)=>{t.d(A,{A:()=>p});var e=t(27702),D=t(81924),d=t(40705),T=t(91064),i=t(64746);const o={label:"None",value:i.mG.None},p=({query:E,metricDescriptor:a,onChange:I})=>{const O=u(a);return e.createElement(D.S,{label:"Pre-processing",tooltip:"Preprocessing options are displayed when the selected metric has a metric kind of delta or cumulative. The specific options available are determined by the metric's value type. If you select 'Rate', data points are aligned and converted to a rate per time series. If you select 'Delta', data points are aligned by their delta (difference) per time series"},e.createElement(d.S,{onChange:_=>{const{perSeriesAligner:h}=E,{valueType:g,metricKind:P}=a??{},{perSeriesAligner:U}=(0,T.ID)(g,P,h,_);I({...E,preprocessor:_,perSeriesAligner:U})},value:E.preprocessor??i.mG.None,options:O}))},u=E=>{const a=E?.metricKind,I=E?.valueType;return(0,e.useMemo)(()=>{if(!a||a===i.lH.GAUGE||I===i.$h.DISTRIBUTION)return[o];const O=[o,{label:"Rate",value:i.mG.Rate,description:"Data points are aligned and converted to a rate per time series"}];return a===i.lH.CUMULATIVE?[...O,{label:"Delta",value:i.mG.Delta,description:"Data points are aligned by their delta (difference) per time series"}]:O},[a,I])}},56525:(G,A,t)=>{t.d(A,{I:()=>T});var e=t(27702),D=t(81924),d=t(28580);function T({refId:i,projectName:o,datasource:p,onChange:u,templateVariableOptions:E}){const[a,I]=(0,e.useState)([]);(0,e.useEffect)(()=>{p.getProjects().then(_=>I(_))},[p]);const O=(0,e.useMemo)(()=>[{label:"Template Variables",options:E},...a],[a,E]);return e.createElement(D.S,{label:"Project"},e.createElement(d.Ph,{width:"auto",allowCustomValue:!0,formatCreateLabel:_=>`Use project: ${_}`,onChange:({value:_})=>u(_),options:O,value:{value:o,label:o},placeholder:"Select Project",inputId:`${i}-project`}))}},78695:(G,A,t)=>{t.d(A,{W:()=>O});var e=t(27702),D=t(81078),d=t(83788),T=t(64746),i=t(63250),o=t(29036),p=t(29473),u=t(6774);const E=_=>{const{query:h,onChange:g,onRunQuery:P}=_,{queryType:U}=h;return e.createElement(i.K,null,e.createElement(o.X,{label:"Query type",options:u.XI,value:U,onChange:({value:v})=>{g({...h,queryType:v}),P()}}),e.createElement(p.B,{grow:1}))};var a=t(34880),I=t(16313);const O=_=>{const{datasource:h,query:g,onRunQuery:P,onChange:U}=_,[v,l]=(0,e.useState)(!1),n=(0,e.useMemo)(()=>{if(!v){l(!0);const c=h.migrateQuery(g);return U({...c}),c}return g},[g,h,U,v]),s={...(0,a.w)(h),...n.sloQuery},r=c=>{U({...n,sloQuery:c}),P()},L=(_.data?.series.length?_.data?.series[0].meta:{})?.custom??{},N={label:"Template Variables",expanded:!1,options:h.getVariables().map(D.E)};(0,e.useEffect)(()=>{(!n.queryType||!Object.values(T.xL).includes(n.queryType))&&U({...n,queryType:T.xL.TIME_SERIES_LIST})});const M=n.queryType;return e.createElement(d._,null,e.createElement(E,{query:n,onChange:U,onRunQuery:P}),M!==T.xL.SLO&&e.createElement(I.a1,{refId:n.refId,variableOptionGroup:N,customMetaData:L,onChange:U,onRunQuery:P,datasource:h,query:n}),M===T.xL.SLO&&e.createElement(I.D6,{refId:n.refId,variableOptionGroup:N,customMetaData:L,onChange:r,onRunQuery:P,datasource:h,query:s,aliasBy:n.aliasBy,onChangeAliasBy:c=>U({...n,aliasBy:c})}))}},34880:(G,A,t)=>{t.d(A,{D:()=>U,w:()=>P});var e=t(27702),D=t(57942),d=t(2906),T=t(81924),i=t(6774),o=t(91064),p=t(64746),u=t(38582),E=t(28580);const a=({refId:v,current:l,templateVariableOptions:n,onChange:s})=>{const r=i.yy.map(L=>({...L,label:L.text}));l&&!r.find(L=>L.value===l)&&r.push({label:l,text:l,value:l,hidden:!1});const m=r.filter(L=>!L.hidden);return e.createElement(T.S,{label:"Lookback period",htmlFor:`${v}-lookback-period`},e.createElement(E.Ph,{inputId:`${v}-lookback-period`,width:"auto",allowCustomValue:!0,value:[...r,...n].find(L=>L.value===l),options:[{label:"Template Variables",options:n},{label:"Predefined periods",expanded:!0,options:m}],onChange:({value:L})=>s(L)}))};var I=t(25998),O=t(56525);const _=({refId:v,query:l,templateVariableOptions:n,onChange:s,datasource:r})=>{const[m,L]=(0,e.useState)([]),{projectName:N,serviceId:M}=l;return(0,e.useEffect)(()=>{!N||!M||r.getServiceLevelObjectives(N,M).then(c=>{L([{label:"Template Variables",options:n},...c])})},[r,N,M,n]),e.createElement(T.S,{label:"SLO"},e.createElement(E.Ph,{inputId:`${v}-slo`,width:"auto",allowCustomValue:!0,value:l?.sloId&&{value:l?.sloId,label:l?.sloName||l?.sloId},placeholder:"Select SLO",options:m,onChange:async({value:c="",label:C=""})=>{const y=(await r.getServiceLevelObjectives(N,M)).find(({value:W})=>W===r.templateSrv.replace(c));s({...l,sloId:c,sloName:C,goal:y?.goal})}}))},h=({refId:v,query:l,templateVariableOptions:n,onChange:s,datasource:r})=>e.createElement(T.S,{label:"Selector",htmlFor:`${v}-slo-selector`},e.createElement(E.Ph,{inputId:`${v}-slo-selector`,width:"auto",allowCustomValue:!0,value:[...i.IR,...n].find(m=>m.value===l?.selectorName),options:[{label:"Template Variables",options:n},...i.IR],onChange:({value:m})=>s({...l,selectorName:m??""})})),g=({refId:v,query:l,templateVariableOptions:n,onChange:s,datasource:r})=>{const[m,L]=(0,e.useState)([]),{projectName:N}=l;return(0,e.useEffect)(()=>{N&&r.getSLOServices(N).then(M=>{L([{label:"Template Variables",options:n},...M])})},[r,N,n]),e.createElement(T.S,{label:"Service"},e.createElement(E.Ph,{inputId:`${v}-slo-service`,width:"auto",allowCustomValue:!0,value:l?.serviceId&&{value:l?.serviceId,label:l?.serviceName||l?.serviceId},placeholder:"Select service",options:m,onChange:({value:M="",label:c=""})=>s({...l,serviceId:M,serviceName:c,sloId:""})}))},P=v=>({projectName:v.getDefaultProject(),alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:p.CS.ALIGN_MEAN,aliasBy:"",selectorName:"select_slo_health",serviceId:"",serviceName:"",sloId:"",sloName:"",lookbackPeriod:""});function U({refId:v,query:l,datasource:n,onChange:s,variableOptionGroup:r,customMetaData:m,aliasBy:L,onChangeAliasBy:N}){const M=(0,e.useMemo)(()=>(0,o.kU)(m,n),[m,n]);return e.createElement(e.Fragment,null,e.createElement(D.p,null,e.createElement(O.I,{refId:v,templateVariableOptions:r.options,projectName:l.projectName,datasource:n,onChange:c=>s({...l,projectName:c})}),e.createElement(g,{refId:v,datasource:n,templateVariableOptions:r.options,query:l,onChange:s}),e.createElement(_,{refId:v,datasource:n,templateVariableOptions:r.options,query:l,onChange:s}),e.createElement(h,{refId:v,datasource:n,templateVariableOptions:r.options,query:l,onChange:s}),l.selectorName===i.Fh&&e.createElement(a,{refId:v,onChange:c=>s({...l,lookbackPeriod:c}),current:l.lookbackPeriod,templateVariableOptions:r.options}),e.createElement(d.s,null,e.createElement(T.S,{label:"Alignment period",tooltip:M},e.createElement(I.$,{inputId:`${v}-alignment-period`,templateVariableOptions:r.options,current:l.alignmentPeriod,onChange:c=>s({...l,alignmentPeriod:c}),aligmentPeriods:i.dD}))),e.createElement(u.B,{refId:v,value:L,onChange:N})))}},49040:(G,A,t)=>{t.d(A,{s:()=>N});var e=t(42844),D=t(56027),d=t.n(D),T=t(89949),i=t.n(T),o=t(27702),p=t(57942),u=t(2906),E=t(81924),a=t(86312),I=t(66310),O=t(73578),_=t(28580),h=t(91064),g=t(64746),P=t(38582),U=t(82863),v=t(34584),l=t(89452),n=t(26956),s=t(56560),r=t(56525);function m({refId:M,onChange:c,datasource:C,query:B,variableOptionGroup:y,customMetaData:W,aliasBy:$,onChangeAliasBy:V}){const[Q,q]=(0,o.useState)({}),[x,Ee]=(0,o.useState)([]),[ee,ne]=(0,o.useState)(),[se,te]=(0,o.useState)([]),[ae,ce]=(0,o.useState)([]),[X,le]=(0,o.useState)(""),[Y,me]=(0,o.useState)({...C.timeSrv.timeRange()});(f=>{Y!==null&&(Y.raw.from.toString()!==f.raw.from.toString()||Y.raw.to.toString()!==f.raw.to.toString())&&me({...f})})(C.timeSrv.timeRange());const ue=(0,I.l4)(),z=(0,O.D)(ue),J=(0,I.wW)(L),{projectName:H,groupBys:oe,crossSeriesReducer:re}=B,b=(0,h.WH)(B),{templateSrv:Z}=C,w=(0,o.useCallback)((f,R)=>f.find(S=>S.type===Z.replace(R)),[Z]);(0,o.useEffect)(()=>{H&&b&&C.getLabels(b,M,H,{groupBys:oe,crossSeriesReducer:re},Y).then(f=>q(f))},[C,oe,b,H,M,re,Y]),(0,o.useEffect)(()=>{(async()=>{if(H){const R=await C.getMetricTypes(H);(0,a.ff)("cloud-monitoring-metric-descriptors-loaded",{count:R.length});const S=ve(R);Ee(R),ce(S)}})()},[C,H,J,z.optionDescription]),(0,o.useEffect)(()=>{const R=(j=>{const k=w(j,b);return k?j.filter(F=>F.service===k.service).map(F=>({service:F.service,value:F.type,label:F.displayName,component:function(){return o.createElement("div",null,o.createElement("div",{className:J},F.type),o.createElement("div",{className:z.optionDescription},F.description))}})):[]})(x),S=R.length>0?R[0].service:"",K=w(x,b);ne(K),te(R),le(S)},[x,w,b,J,z.optionDescription]);const de=({value:f})=>{const R=x.filter(S=>S.service===Z.replace(f)).map(S=>({service:S.service,value:S.type,label:S.displayName,description:S.description}));B.filters=[],R.length>0&&!R.some(S=>S.value===Z.replace(b))?(ie(R[0]),le(f),te(R)):(le(f),te(R))},ve=f=>{const R=f.map(S=>({value:S.service,label:(0,T.startCase)(S.serviceShortName)}));return R.length>0?(0,T.uniqBy)(R,S=>S.value):[]},Ie=async f=>{const S=(await C.filterMetricsByType(H,X)).filter(K=>K.type.includes(f.toLowerCase())).map(K=>({value:K.type,label:K.displayName,component:function(){return o.createElement("div",null,o.createElement("div",{className:J},K.type),o.createElement("div",{className:z.optionDescription},K.description))}}));return[{label:"Template Variables",options:y.options},...S]},Te=d()(Ie,400),ie=({value:f})=>{const R=w(x,f);ne(R);const{metricKind:S,valueType:K}=R,j=S===g.lH.GAUGE||K===g.$h.DISTRIBUTION?g.mG.None:g.mG.Rate,{perSeriesAligner:k}=(0,h.ID)(K,S,B.perSeriesAligner,j);Object.assign(B,{...(0,n.mO)(C),projectName:B.projectName,filters:B.filters}),c({...(0,h.Av)({...B,perSeriesAligner:k},f),preprocessor:j})};return o.createElement(o.Fragment,null,o.createElement(p.p,null,o.createElement(u.s,null,o.createElement(r.I,{refId:M,templateVariableOptions:y.options,projectName:H,datasource:C,onChange:f=>{c({...B,projectName:f})}}),o.createElement(E.S,{label:"Service",width:"auto"},o.createElement(_.Ph,{width:"auto",onChange:de,isLoading:ae.length===0,value:[...ae,...y.options].find(f=>f.value===X),options:[{label:"Template Variables",options:y.options},...ae],placeholder:"Select Services",inputId:`${M}-service`})),o.createElement(E.S,{label:"Metric name",width:"auto",htmlFor:`${M}-select-metric`},o.createElement("span",{title:X===""?"Select a service first":"Type to search metrics"},o.createElement(_.qb,{width:"auto",onChange:ie,value:[...se,...y.options].find(f=>f.value===b),loadOptions:Te,defaultOptions:[{label:"Template Variables",options:y.options},...se.slice(0,100)],placeholder:"Select Metric",inputId:`${M}-select-metric`,disabled:X===""}))))),o.createElement(o.Fragment,null,o.createElement(l.p,{labels:Q,filters:B.filters,onChange:f=>c({...B,filters:f}),variableOptionGroup:y}),o.createElement(p.p,null,o.createElement(s.A,{metricDescriptor:ee,query:B,onChange:c}),o.createElement(v.X,{refId:M,labels:Object.keys(Q),query:B,onChange:c,variableOptionGroup:y,metricDescriptor:ee}),o.createElement(U.v,{refId:M,datasource:C,templateVariableOptions:y.options,query:B,customMetaData:W,onChange:c,metricDescriptor:ee,preprocessor:B.preprocessor}),o.createElement(P.B,{refId:M,value:$,onChange:V}))))}const L=M=>(0,e.css)` label: grafana-select-option-description; font-weight: normal; font-style: italic; color: ${M.colors.text.secondary}; `,N=o.memo(m)},16313:(G,A,t)=>{t.d(A,{zI:()=>o,a1:()=>a.a1,$d:()=>U.$,D6:()=>I.D,Th:()=>g});var e=t(56525),D=t(34584),d=t(82863),T=t(89452),i=t(27702);const o=()=>i.createElement("div",{className:"gf-form grafana-info-box alert-info"},i.createElement("div",null,i.createElement("h5",null,"Annotation Query Format"),i.createElement("p",null,"An annotation is an event that is overlaid on top of graphs. Annotation rendering is expensive so it is important to limit the number of rows returned."," "),i.createElement("p",null,"The Title and Text fields support templating and can use data returned from the query. For example, the Title field could have the following text:"),i.createElement("code",null,"{{metric.type}}"," has value: ","{{metric.value}}"),i.createElement("p",null,"Example Result: ",i.createElement("code",null,"monitoring.googleapis.com/uptime_check/http_status has this value: 502")),i.createElement("span",null,"Patterns:"),i.createElement("p",null,i.createElement("code",null,"{{metric.value}}")," = value of the metric/point"),i.createElement("p",null,i.createElement("code",null,"{{metric.type}}")," = metric type e.g. compute.googleapis.com/instance/cpu/usage_time"),i.createElement("p",null,i.createElement("code",null,"{{metric.name}}")," = name part of metric e.g. instance/cpu/usage_time"),i.createElement("p",null,i.createElement("code",null,"{{metric.service}}")," = service part of metric e.g. compute"),i.createElement("p",null,i.createElement("code",null,"{{metric.label.label_name}}")," = Metric label metadata e.g. metric.label.instance_name"),i.createElement("p",null,i.createElement("code",null,"{{resource.label.label_name}}")," = Resource label metadata e.g. resource.label.zone")));var p=t(48826),u=t(38582),E=t(29927),a=t(26956),I=t(34880),O=t(7699),_=t(48024),h=t(28580);const g=({label:l,onChange:n,value:s,options:r,allowCustomValue:m=!1})=>i.createElement(_._,{label:l,labelWidth:20},i.createElement(h.Ph,{width:25,allowCustomValue:m,value:s,onChange:({value:L})=>n(L),options:r}));var P=t(49040),U=t(25998),v=t(56560)},6774:(G,A,t)=>{t.d(A,{$e:()=>I,Eu:()=>o,Fh:()=>O,IR:()=>_,Ry:()=>E,XI:()=>h,dD:()=>u,lx:()=>p,yy:()=>a});var e=t(64746);const D=71,d=19,T=14,i=28,o=[{text:"none",value:"ALIGN_NONE",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION,e.$h.STRING,e.$h.VALUE_TYPE_UNSPECIFIED,e.$h.BOOL],metricKinds:[e.lH.GAUGE]},{text:"delta",value:"ALIGN_DELTA",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.CUMULATIVE,e.lH.DELTA]},{text:"rate",value:"ALIGN_RATE",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.CUMULATIVE,e.lH.DELTA]},{text:"interpolate",value:"ALIGN_INTERPOLATE",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE]},{text:"next older",value:"ALIGN_NEXT_OLDER",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION,e.$h.STRING,e.$h.VALUE_TYPE_UNSPECIFIED,e.$h.BOOL],metricKinds:[e.lH.GAUGE]},{text:"min",value:"ALIGN_MIN",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"max",value:"ALIGN_MAX",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"mean",value:"ALIGN_MEAN",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"count",value:"ALIGN_COUNT",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.BOOL],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"sum",value:"ALIGN_SUM",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"stddev",value:"ALIGN_STDDEV",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"count true",value:"ALIGN_COUNT_TRUE",valueTypes:[e.$h.BOOL],metricKinds:[e.lH.GAUGE]},{text:"count false",value:"ALIGN_COUNT_FALSE",valueTypes:[e.$h.BOOL],metricKinds:[e.lH.GAUGE]},{text:"fraction true",value:"ALIGN_FRACTION_TRUE",valueTypes:[e.$h.BOOL],metricKinds:[e.lH.GAUGE]},{text:"percentile 99",value:"ALIGN_PERCENTILE_99",valueTypes:[e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"percentile 95",value:"ALIGN_PERCENTILE_95",valueTypes:[e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"percentile 50",value:"ALIGN_PERCENTILE_50",valueTypes:[e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"percentile 05",value:"ALIGN_PERCENTILE_05",valueTypes:[e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"percent change",value:"ALIGN_PERCENT_CHANGE",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA]}],p=[{text:"none",value:"REDUCE_NONE",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION,e.$h.BOOL,e.$h.STRING],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE,e.lH.METRIC_KIND_UNSPECIFIED]},{text:"mean",value:"REDUCE_MEAN",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]},{text:"min",value:"REDUCE_MIN",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE,e.lH.METRIC_KIND_UNSPECIFIED]},{text:"max",value:"REDUCE_MAX",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE,e.lH.METRIC_KIND_UNSPECIFIED]},{text:"sum",value:"REDUCE_SUM",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE,e.lH.METRIC_KIND_UNSPECIFIED]},{text:"std. dev.",value:"REDUCE_STDDEV",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE,e.lH.METRIC_KIND_UNSPECIFIED]},{text:"count",value:"REDUCE_COUNT",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION,e.$h.BOOL,e.$h.STRING],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]},{text:"count true",value:"REDUCE_COUNT_TRUE",valueTypes:[e.$h.BOOL],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"count false",value:"REDUCE_COUNT_FALSE",valueTypes:[e.$h.BOOL],metricKinds:[e.lH.GAUGE,e.lH.DELTA]},{text:"99th percentile",value:"REDUCE_PERCENTILE_99",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]},{text:"95th percentile",value:"REDUCE_PERCENTILE_95",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]},{text:"50th percentile",value:"REDUCE_PERCENTILE_50",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]},{text:"5th percentile",value:"REDUCE_PERCENTILE_05",valueTypes:[e.$h.INT64,e.$h.DOUBLE,e.$h.MONEY,e.$h.DISTRIBUTION],metricKinds:[e.lH.GAUGE,e.lH.DELTA,e.lH.CUMULATIVE]}],u=[{text:"grafana auto",value:"grafana-auto"},{text:"stackdriver auto",value:"stackdriver-auto",hidden:!0},{text:"cloud monitoring auto",value:"cloud-monitoring-auto"},{text:"1m",value:"+60s"},{text:"2m",value:"+120s"},{text:"5m",value:"+300s"},{text:"10m",value:"+600s"},{text:"30m",value:"+1800s"},{text:"1h",value:"+3600s"},{text:"3h",value:"+7200s"},{text:"6h",value:"+21600s"},{text:"1d",value:"+86400s"},{text:"3d",value:"+259200s"},{text:"1w",value:"+604800s"}],E=[{text:"auto",value:"auto"},{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"1d",value:"1d"},{text:"3d",value:"3d"},{text:"1w",value:"1w"}],a=[{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"24h",value:"24h"},{text:"72h",value:"72h"}],I=["metadata.system_labels.cloud_account","metadata.system_labels.name","metadata.system_labels.region","metadata.system_labels.state","metadata.system_labels.instance_group","metadata.system_labels.node_name","metadata.system_labels.service_name","metadata.system_labels.top_level_controller_type","metadata.system_labels.top_level_controller_name","metadata.system_labels.container_image"],O="select_slo_burn_rate",_=[{label:"SLI Value",value:"select_slo_health"},{label:"SLO Compliance",value:"select_slo_compliance"},{label:"SLO Error Budget Remaining",value:"select_slo_budget_fraction"},{label:"SLO Burn Rate",value:O}],h=[{label:"Builder",value:e.xL.TIME_SERIES_LIST},{label:"MQL",value:e.xL.TIME_SERIES_QUERY},{label:"Service Level Objectives (SLO)",value:e.xL.SLO}]},91064:(G,A,t)=>{t.d(A,{A_:()=>I,Av:()=>v,FL:()=>E,ID:()=>_,Qd:()=>O,Qf:()=>u,WH:()=>U,gY:()=>h,kU:()=>P,mi:()=>g,oU:()=>a,qA:()=>p});var e=t(89949),D=t.n(e),d=t(76305),T=t(39317),i=t(6774),o=t(64746);const p=l=>(0,e.uniqBy)(l,"service"),u=(l,n)=>l.filter(s=>s.service===n),E=(l,n,s,r)=>{const m=u(l,r).map(c=>({value:c.type,name:c.displayName})),L=m.some(c=>c.value===s),N=m.length?m[0].value:"";return{metricTypes:m,selectedMetricType:L?n:N}},a=(l,n,s)=>(s&&s===o.mG.Rate&&(n=o.lH.GAUGE),l?i.Eu.filter(r=>r.valueTypes.indexOf(l)!==-1&&r.metricKinds.indexOf(n)!==-1):[]),I=(l,n)=>n?i.lx.filter(s=>s.valueTypes.indexOf(l)!==-1&&s.metricKinds.indexOf(n)!==-1):[],O=async(l,n,s)=>{const r="handleLabelKeysQuery",m=await l.getLabels(n,r,s);return[...Object.keys(m),...i.$e]},_=(l=o.$h.DOUBLE,n=o.lH.GAUGE,s=o.CS.ALIGN_MEAN,r)=>{const m=(0,T.J)(),L=a(l,n,r).map(N=>({...N,label:N.text}));return L.some(N=>N.value===m.replace(s))||(s=L.length>0?L[0].value:o.CS.ALIGN_MEAN),{alignOptions:L,perSeriesAligner:s}},h=l=>{const n=l.reduce((s,r)=>{const m=r.split(".").map(e.startCase),L=(m.length===2?m:(0,e.initial)(m)).join(" "),N={value:r,label:r};return s[L]?s[L]=[...s[L],N]:s[L]=[N],s},{});return Object.entries(n).map(([s,r])=>({label:s,options:r,expanded:!0}),[])},g=l=>(0,e.chunk)(l,4).map(([n,s,r,m="AND"])=>({key:n,operator:s,value:r,condition:m})),P=(l,n)=>{const{perSeriesAligner:s,alignmentPeriod:r}=l;if(!r||!s)return"";const m=i.Eu.find(M=>M.value===n.templateSrv.replace(s)),L=parseInt(r,10);return`${d.secondsToHms(L)} interval (${m?.text??""})`},U=l=>{const n=l?.filters?.findIndex(r=>r==="metric.type");return l?.filters?.[n+2]||""},v=(l,n)=>{if(!l.filters)return l.filters=["metric.type","=",n],l;const s=l?.filters?.findIndex(r=>r==="metric.type");return s===-1?l.filters.push("metric.type","=",n):l.filters[s+2]=n,l}},64746:(G,A,t)=>{t.d(A,{CS:()=>p,Bp:()=>E,lH:()=>i,mG:()=>d,xL:()=>e,$h:()=>o});var e=(a=>(a.ANNOTATION="annotation",a.SLO="slo",a.TIME_SERIES_LIST="timeSeriesList",a.TIME_SERIES_QUERY="timeSeriesQuery",a))(e||{});const D={filters:[],groupBys:[],secondaryGroupBys:[]};var d=(a=>(a.Delta="delta",a.None="none",a.Rate="rate",a))(d||{});const T={filters:[],groupBys:[]};var i=(a=>(a.CUMULATIVE="CUMULATIVE",a.DELTA="DELTA",a.GAUGE="GAUGE",a.METRIC_KIND_UNSPECIFIED="METRIC_KIND_UNSPECIFIED",a))(i||{}),o=(a=>(a.BOOL="BOOL",a.DISTRIBUTION="DISTRIBUTION",a.DOUBLE="DOUBLE",a.INT64="INT64",a.MONEY="MONEY",a.STRING="STRING",a.VALUE_TYPE_UNSPECIFIED="VALUE_TYPE_UNSPECIFIED",a))(o||{}),p=(a=>(a.ALIGN_COUNT="ALIGN_COUNT",a.ALIGN_COUNT_FALSE="ALIGN_COUNT_FALSE",a.ALIGN_COUNT_TRUE="ALIGN_COUNT_TRUE",a.ALIGN_DELTA="ALIGN_DELTA",a.ALIGN_FRACTION_TRUE="ALIGN_FRACTION_TRUE",a.ALIGN_INTERPOLATE="ALIGN_INTERPOLATE",a.ALIGN_MAX="ALIGN_MAX",a.ALIGN_MEAN="ALIGN_MEAN",a.ALIGN_MIN="ALIGN_MIN",a.ALIGN_NEXT_OLDER="ALIGN_NEXT_OLDER",a.ALIGN_NONE="ALIGN_NONE",a.ALIGN_PERCENTILE_05="ALIGN_PERCENTILE_05",a.ALIGN_PERCENTILE_50="ALIGN_PERCENTILE_50",a.ALIGN_PERCENTILE_95="ALIGN_PERCENTILE_95",a.ALIGN_PERCENTILE_99="ALIGN_PERCENTILE_99",a.ALIGN_PERCENT_CHANGE="ALIGN_PERCENT_CHANGE",a.ALIGN_RATE="ALIGN_RATE",a.ALIGN_STDDEV="ALIGN_STDDEV",a.ALIGN_SUM="ALIGN_SUM",a))(p||{});const u={filters:[]};var E=(a=>(a.Aggregations="aggregations",a.Aligners="aligners",a.AlignmentPeriods="alignmentPeriods",a.DefaultProject="defaultProject",a.LabelKeys="labelKeys",a.LabelValues="labelValues",a.MetricTypes="metricTypes",a.Projects="projects",a.ResourceTypes="resourceTypes",a.SLO="slo",a.SLOServices="sloServices",a.Selectors="selectors",a.Services="services",a))(E||{})}}]); //# sourceMappingURL=8695.c23c9961ab344f38b174.js.map