@perses-dev/victorialogs-plugin 0.4.0-beta.2 → 0.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{VictoriaLogs.afd64361.js → VictoriaLogs.be6f69d8.js} +2 -2
- package/__mf/js/async/1728.d384056e.js +1 -0
- package/__mf/js/async/{3998.40379cbb.js → 3998.80602e8a.js} +2 -2
- package/__mf/js/async/5405.004a286a.js +2 -0
- package/__mf/js/async/{7862.d8cae445.js → 5481.b7b48b8f.js} +2 -2
- package/__mf/js/async/6408.2bc7e8f4.js +7 -0
- package/__mf/js/async/{7984.61df0cff.js → 7984.25d27c06.js} +3 -3
- package/__mf/js/async/9741.495eeedc.js +3 -0
- package/__mf/js/async/{__federation_expose_VictoriaLogsDatasource.118c7328.js → __federation_expose_VictoriaLogsDatasource.41304660.js} +2 -2
- package/__mf/js/async/{__federation_expose_VictoriaLogsFieldNamesVariable.09d5f8aa.js → __federation_expose_VictoriaLogsFieldNamesVariable.53084c8d.js} +1 -1
- package/__mf/js/async/{__federation_expose_VictoriaLogsFieldValuesVariable.1ddcb7fd.js → __federation_expose_VictoriaLogsFieldValuesVariable.fe063a57.js} +1 -1
- package/__mf/js/async/{__federation_expose_VictoriaLogsLogQuery.ae28a094.js → __federation_expose_VictoriaLogsLogQuery.a4940c43.js} +1 -1
- package/__mf/js/async/{__federation_expose_VictoriaLogsTimeSeriesQuery.dcdc367f.js → __federation_expose_VictoriaLogsTimeSeriesQuery.23a388db.js} +1 -1
- package/__mf/js/{main.98168573.js → main.bdf7fd92.js} +2 -2
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js.map +1 -1
- package/mf-manifest.json +51 -51
- package/mf-stats.json +51 -51
- package/package.json +6 -6
- package/__mf/js/async/1728.7c9d0756.js +0 -1
- package/__mf/js/async/4830.5c58b453.js +0 -2
- package/__mf/js/async/6037.70be43c7.js +0 -7
- package/__mf/js/async/6593.209861aa.js +0 -3
- /package/__mf/css/async/{6037.85c2cbf6.css → 6408.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{3998.40379cbb.js.LICENSE.txt → 3998.80602e8a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4830.5c58b453.js.LICENSE.txt → 5405.004a286a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7862.d8cae445.js.LICENSE.txt → 5481.b7b48b8f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6037.70be43c7.js.LICENSE.txt → 6408.2bc7e8f4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7984.61df0cff.js.LICENSE.txt → 7984.25d27c06.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_VictoriaLogsDatasource.118c7328.js.LICENSE.txt → __federation_expose_VictoriaLogsDatasource.41304660.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! For license information please see __federation_expose_VictoriaLogsDatasource.
|
|
2
|
-
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["4090"],{2192(e,t,r){var n=r(70451),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var n,a={},d=null,c=null;for(n in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)s.call(t,n)&&!l.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:d,ref:c,props:a,_owner:i.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},62540(e,t,r){e.exports=r(2192)},29867(e,t,r){function n(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return new URL(e,t);return new URL(t.endsWith("/")&&e.startsWith("/")?t+e.slice(1):t.endsWith("/")||e.startsWith("/")?t+e:t+"/"+e,window.location.origin)}async function o(e,t){let r=n("/select/logsql/query",t.datasourceUrl),o={query:e.query,start:e.start,end:e.end};(null==e?void 0:e.limit)&&(o.limit=e.limit.toString()),(null==e?void 0:e.offset)&&(o.offset=e.offset.toString());let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/stream+json",...t.headers},body:a});if(200!==s.status)throw Error(await s.text());let i=[];if(!(null==s?void 0:s.body))return i;let l=s.body.getReader(),d=new TextDecoder("utf-8"),c="",u=await l.read();for(;!u.done;){let e=(c+=d.decode(u.value,{stream:!0})).indexOf("\n");for(;-1!==e;){let t=c.slice(0,e);c=c.slice(e+1),i.push(JSON.parse(t)),e=c.indexOf("\n")}u=await l.read()}return c.trim().length>0&&i.push(JSON.parse(c)),i}async function a(e,t){let r=n("/select/logsql/stats_query_range",t.datasourceUrl),o={query:e.query,start:e.start,end:e.end};(null==e?void 0:e.step)&&(o.step=e.step.toString());let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}async function s(e,t){let r=n("/select/logsql/field_names",t.datasourceUrl),o={query:e.query};e.start&&(o.start=e.start),e.end&&(o.end=e.end);let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}async function i(e,t){let r=n("/select/logsql/field_values",t.datasourceUrl),o={query:e.query,field:e.field};e.start&&(o.start=e.start),e.end&&(o.end=e.end);let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}r.r(t),r.d(t,{VictoriaLogsDatasource:()=>u,VictoriaLogsDatasourceEditor:()=>c});var l=r(62540),d=r(
|
|
1
|
+
/*! For license information please see __federation_expose_VictoriaLogsDatasource.41304660.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["4090"],{2192(e,t,r){var n=r(70451),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var n,a={},d=null,c=null;for(n in void 0!==r&&(d=""+r),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)s.call(t,n)&&!l.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:d,ref:c,props:a,_owner:i.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},62540(e,t,r){e.exports=r(2192)},29867(e,t,r){function n(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return new URL(e,t);return new URL(t.endsWith("/")&&e.startsWith("/")?t+e.slice(1):t.endsWith("/")||e.startsWith("/")?t+e:t+"/"+e,window.location.origin)}async function o(e,t){let r=n("/select/logsql/query",t.datasourceUrl),o={query:e.query,start:e.start,end:e.end};(null==e?void 0:e.limit)&&(o.limit=e.limit.toString()),(null==e?void 0:e.offset)&&(o.offset=e.offset.toString());let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/stream+json",...t.headers},body:a});if(200!==s.status)throw Error(await s.text());let i=[];if(!(null==s?void 0:s.body))return i;let l=s.body.getReader(),d=new TextDecoder("utf-8"),c="",u=await l.read();for(;!u.done;){let e=(c+=d.decode(u.value,{stream:!0})).indexOf("\n");for(;-1!==e;){let t=c.slice(0,e);c=c.slice(e+1),i.push(JSON.parse(t)),e=c.indexOf("\n")}u=await l.read()}return c.trim().length>0&&i.push(JSON.parse(c)),i}async function a(e,t){let r=n("/select/logsql/stats_query_range",t.datasourceUrl),o={query:e.query,start:e.start,end:e.end};(null==e?void 0:e.step)&&(o.step=e.step.toString());let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}async function s(e,t){let r=n("/select/logsql/field_names",t.datasourceUrl),o={query:e.query};e.start&&(o.start=e.start),e.end&&(o.end=e.end);let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}async function i(e,t){let r=n("/select/logsql/field_values",t.datasourceUrl),o={query:e.query,field:e.field};e.start&&(o.start=e.start),e.end&&(o.end=e.end);let a=new URLSearchParams(o).toString(),s=await fetch(r.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...t.headers},body:a});return await s.json()}r.r(t),r.d(t,{VictoriaLogsDatasource:()=>u,VictoriaLogsDatasourceEditor:()=>c});var l=r(62540),d=r(39420);function c(e){let{value:t,onChange:r,isReadonly:n}=e;return(0,l.jsx)(d.HTTPSettingsEditor,{value:t,onChange:r,isReadonly:n,initialSpecDirect:{directUrl:""},initialSpecProxy:{proxy:{kind:"HTTPProxy",spec:{allowedEndpoints:[{endpointPattern:"/select/logsql/stats_query",method:"POST"},{endpointPattern:"/select/logsql/stats_query_range",method:"POST"},{endpointPattern:"/select/logsql/field_names",method:"POST"},{endpointPattern:"/select/logsql/field_values",method:"POST"},{endpointPattern:"/select/logsql/tail",method:"POST"},{endpointPattern:"/select/logsql/query",method:"POST"},{endpointPattern:"/select/logsql/hits",method:"POST"},{endpointPattern:"/select/logsql/facets",method:"POST"},{endpointPattern:"/select/logsql/stream_ids",method:"POST"},{endpointPattern:"/select/logsql/streams",method:"POST"},{endpointPattern:"/select/logsql/stream_field_names",method:"POST"},{endpointPattern:"/select/logsql/stream_field_values",method:"POST"}],url:""}}}})}let u={createClient:(e,t)=>{let{directUrl:r,proxy:n}=e,{proxyUrl:l}=t,d=r??l;if(void 0===d)throw Error("No URL specified for VictoriaLogs client. You can use directUrl in the spec to configure it.");let c=null==n?void 0:n.spec.headers;return{options:{datasourceUrl:d},streamQueryRange:(e,t)=>o(e,{datasourceUrl:d,headers:t??c}),statsQueryRange:(e,t)=>a(e,{datasourceUrl:d,headers:t??c}),fieldNames:(e,t)=>s(e,{datasourceUrl:d,headers:t??c}),fieldValues:(e,t)=>i(e,{datasourceUrl:d,headers:t??c})}},OptionsEditorComponent:c,createInitialOptions:()=>({directUrl:""})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["3859"],{84704(a,e,r){r.r(e),r.d(e,{VictoriaLogsFieldNamesVariable:()=>b});var s=r(
|
|
1
|
+
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["3859"],{84704(a,e,r){r.r(e),r.d(e,{VictoriaLogsFieldNamesVariable:()=>b});var s=r(39420),t=r(50095),o=r(92229),i=r(62540),l=r(315),u=r(67987),c=r(93648),n=r(38662),d=r(70451);let b={getVariableOptions:async(a,e)=>{let r=(0,s.datasourceSelectValueToSelector)(a.datasource??t.jx,e.variables,await e.datasourceStore.listDatasourceSelectItems(t.m_))??t.jx,i=await e.datasourceStore.getDatasourceClient(r),l=(0,o.RG)(e.timeRange),u=(0,s.replaceVariables)(a.query,e.variables),{values:c}=u?await i.fieldNames({query:u,...l}):{values:[]};return{data:(0,o.Iq)(c)}},dependsOn:a=>({variables:[...(0,s.parseVariables)(a.query),...a.datasource&&(0,s.isVariableDatasource)(a.datasource)?(0,s.parseVariables)(a.datasource):[]]}),OptionsEditorComponent:function(a){let{onChange:e,value:r,value:{datasource:o,query:b}}=a,g=o??t.jx,V=(0,s.useDatasourceSelectValueToSelector)(g,t.m_),p=(0,d.useCallback)(a=>{if((0,s.isVariableDatasource)(a)||(0,t.H6)(a))return void e((0,n.jM)(r,e=>{e.datasource=!(0,s.isVariableDatasource)(a)&&(0,t.fZ)(a)?void 0:a}));throw Error("Got unexpected non-VictoriaLogs datasource selector")},[e,r]),v=(0,d.useCallback)(a=>{e((0,n.jM)(r,e=>{e.query=a.target.value}))},[e,r]);return(0,i.jsxs)(l.A,{spacing:2,children:[(0,i.jsx)(u.A,{margin:"dense",children:(0,i.jsx)(s.DatasourceSelect,{datasourcePluginKind:"VictoriaLogsDatasource",value:V,onChange:p,disabled:a.isReadonly,labelId:"victorialogs-datasource-field",label:"VictoriaLogs Datasource"})}),(0,i.jsx)(c.A,{label:"Query",InputLabelProps:{shrink:!!a.isReadonly||void 0},InputProps:{readOnly:a.isReadonly},value:b,onChange:v})]})},createInitialOptions:()=>({query:""})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["4209"],{85624(e,a,r){r.r(a),r.d(a,{VictoriaLogsFieldValuesVariable:()=>g});var l=r(
|
|
1
|
+
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["4209"],{85624(e,a,r){r.r(a),r.d(a,{VictoriaLogsFieldValuesVariable:()=>g});var l=r(39420),s=r(50095),i=r(92229),t=r(62540),o=r(315),u=r(67987),n=r(5611),c=r(93648),d=r(38662),b=r(70451);let g={getVariableOptions:async(e,a)=>{let r=(0,l.datasourceSelectValueToSelector)(e.datasource??s.jx,a.variables,await a.datasourceStore.listDatasourceSelectItems(s.m_))??s.jx,t=await a.datasourceStore.getDatasourceClient(r),o=(0,l.replaceVariables)(e.query,a.variables),u=(0,i.RG)(a.timeRange),{values:n}=o?await t.fieldValues({field:(0,l.replaceVariables)(e.field,a.variables),query:o,...u}):{values:[]};return{data:(0,i.Iq)(n)}},dependsOn:e=>({variables:[...(0,l.parseVariables)(e.query),...(0,l.parseVariables)(e.field),...e.datasource&&(0,l.isVariableDatasource)(e.datasource)?(0,l.parseVariables)(e.datasource):[]]}),OptionsEditorComponent:function(e){let{onChange:a,value:r,value:{datasource:g,query:p,field:v}}=e,V=g??s.jx,f=(0,l.useDatasourceSelectValueToSelector)(V,s.m_),{data:j,isLoading:y}=(0,i.gZ)(p,f),h=(0,b.useCallback)(e=>{if((0,l.isVariableDatasource)(e)||(0,s.H6)(e))return void a((0,d.jM)(r,a=>{a.datasource=!(0,l.isVariableDatasource)(e)&&(0,s.fZ)(e)?void 0:e}));throw Error("Got unexpected non-VictoriaLogs datasource selector")},[a,r]),x=(0,b.useCallback)(e=>{a((0,d.jM)(r,a=>{a.query=e.target.value}))},[a,r]),m=(0,b.useCallback)((e,l)=>{a((0,d.jM)(r,e=>{e.field=l||""}))},[a,r]),C=(0,b.useMemo)(()=>(null==j?void 0:j.values.map(e=>e.value))||[],[j]);return(0,t.jsxs)(o.A,{spacing:2,children:[(0,t.jsx)(u.A,{margin:"dense",children:(0,t.jsx)(l.DatasourceSelect,{datasourcePluginKind:"VictoriaLogsDatasource",value:V,onChange:h,readOnly:e.isReadonly,labelId:"victorialogs-datasource-field",label:"VictoriaLogs Datasource"})}),(0,t.jsx)(n.A,{freeSolo:!0,disableClearable:!0,value:v,loading:y,options:C,renderInput:e=>(0,t.jsx)(c.A,{...e,required:!0,label:"Field Name",variant:"outlined"}),onChange:m}),(0,t.jsx)(c.A,{required:!0,label:"Query",InputLabelProps:{shrink:!!e.isReadonly||void 0},InputProps:{readOnly:e.isReadonly},value:p,onChange:x})]})},createInitialOptions:()=>({field:"",query:""})}},68102(e,a,r){r.d(a,{A:()=>l});function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var l in r)({}).hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}).apply(null,arguments)}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["6545"],{6465(e,t,r){r.d(t,{m:()=>g});var a=r(62540),o=r(70451),i=r(56599),n=r(29068),s=r(63960),l=r(6365),u=r(31650);let c=(0,u.pn)({LineComment:u._A.comment,"Identifier StreamSelector":u._A.labelName,"LabelName LabelMatcher":u._A.labelName,String:u._A.string,"Number Float Duration":u._A.number,"LogRangeAggregation VectorAggregation":u._A.function(u._A.keyword),"And Or Unless":u._A.logicOperator,"Eq Neq Re Nre Gt Lt Gte Lte":u._A.compareOperator,"Add Sub Mul Div Mod Pow":u._A.arithmeticOperator,Pipe:u._A.operator,"By Without":u._A.keyword,"( )":u._A.paren,"[ ]":u._A.squareBracket,"{ }":u._A.brace,"⚠":u._A.invalid});function g(e){let t=(0,i.A)(),r="dark"===t.palette.mode,u=(0,o.useMemo)(()=>[s.bj.define({parser:l.K3.configure({props:[c]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}})],[]),g=(0,o.useMemo)(()=>{let e="light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return n.Lz.theme({"&":{backgroundColor:"transparent !important",border:`1px solid ${e}`,borderRadius:`${t.shape.borderRadius}px`},"&.cm-focused.cm-editor":{outline:"none"},".cm-content":{padding:"8px"}})},[t]);return(0,a.jsx)(n.Ay,{...e,theme:r?"dark":"light",basicSetup:{lineNumbers:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1,syntaxHighlighting:!0},extensions:[n.Lz.lineWrapping,u,g],placeholder:'Example: {job="my-service"} |= "error"'})}},50095(e,t,r){r.d(t,{H6:()=>s,m_:()=>o,fZ:()=>n,jx:()=>i});var a=r(
|
|
1
|
+
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["6545"],{6465(e,t,r){r.d(t,{m:()=>g});var a=r(62540),o=r(70451),i=r(56599),n=r(29068),s=r(63960),l=r(6365),u=r(31650);let c=(0,u.pn)({LineComment:u._A.comment,"Identifier StreamSelector":u._A.labelName,"LabelName LabelMatcher":u._A.labelName,String:u._A.string,"Number Float Duration":u._A.number,"LogRangeAggregation VectorAggregation":u._A.function(u._A.keyword),"And Or Unless":u._A.logicOperator,"Eq Neq Re Nre Gt Lt Gte Lte":u._A.compareOperator,"Add Sub Mul Div Mod Pow":u._A.arithmeticOperator,Pipe:u._A.operator,"By Without":u._A.keyword,"( )":u._A.paren,"[ ]":u._A.squareBracket,"{ }":u._A.brace,"⚠":u._A.invalid});function g(e){let t=(0,i.A)(),r="dark"===t.palette.mode,u=(0,o.useMemo)(()=>[s.bj.define({parser:l.K3.configure({props:[c]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}})],[]),g=(0,o.useMemo)(()=>{let e="light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return n.Lz.theme({"&":{backgroundColor:"transparent !important",border:`1px solid ${e}`,borderRadius:`${t.shape.borderRadius}px`},"&.cm-focused.cm-editor":{outline:"none"},".cm-content":{padding:"8px"}})},[t]);return(0,a.jsx)(n.Ay,{...e,theme:r?"dark":"light",basicSetup:{lineNumbers:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1,syntaxHighlighting:!0},extensions:[n.Lz.lineWrapping,u,g],placeholder:'Example: {job="my-service"} |= "error"'})}},50095(e,t,r){r.d(t,{H6:()=>s,m_:()=>o,fZ:()=>n,jx:()=>i});var a=r(39420);let o="VictoriaLogsDatasource",i={kind:o};function n(e){return!(0,a.isVariableDatasource)(e)&&void 0===e.name}function s(e){return(0,a.isVariableDatasource)(e)||e.kind===o}},7140(e,t,r){r.d(t,{N:()=>a,S:()=>o});let a="VictoriaLogsDatasource",o={kind:a}},49008(e,t,r){r.r(t),r.d(t,{VictoriaLogsLogQueryEditor:()=>m,getVictoriaLogsLogData:()=>i,VictoriaLogsLogQuery:()=>p});var a=r(39420),o=r(7140);let i=async(e,t)=>{var r,i;let n;if(!e.query)return{logs:{entries:[],totalCount:0},timeRange:{start:t.timeRange.start,end:t.timeRange.end}};let s=(0,a.replaceVariables)(e.query,t.variableState),l=await t.datasourceStore.getDatasourceClient(e.datasource??o.S),{start:u,end:c}=t.timeRange;return{logs:(r=await l.streamQueryRange({query:s,start:u.toISOString(),end:c.toISOString()}),i=c.getTime().toString(),n=[],r.forEach(e=>{let{_msg:t,_time:r,...a}=e,o=r||t?Date.parse(r):i;n.push({timestamp:Number(o)/1e3,line:t||"",labels:a})}),{entries:n,totalCount:n.length}),timeRange:{start:u,end:c},metadata:{executedQueryString:s}}};var n=r(62540),s=r(315),l=r(54227),u=r(70451),c=r(21860),g=r(6465),d=r(50095);function m(e){let{onChange:t,value:r}=e,{datasource:i}=r,m=i??o.S,p=(0,a.useDatasourceSelectValueToSelector)(m,d.m_),[b,h]=(0,u.useState)(r.query);(0,u.useEffect)(()=>{h(r.query)},[r.query]);let y=(0,u.useCallback)(e=>{h(e)},[]),L=(0,u.useCallback)(e=>{t({...r,query:e})},[t,r]);return(0,n.jsxs)(s.A,{spacing:1.5,paddingBottom:1,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(l.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"Datasource"}),(0,n.jsx)(a.DatasourceSelect,{datasourcePluginKind:o.N,value:p,onChange:e=>{if(!(0,a.isVariableDatasource)(e)&&e.kind===o.N)return void t({...r,datasource:e});throw Error("Got unexpected non VictoriaLogsQuery datasource selection")},label:"VictoriaLogs Datasource",notched:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(l.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"LogsQL Query"}),(0,n.jsx)(g.m,{value:b,onChange:y,onBlur:()=>L(b),onKeyDown:(0,c.createModEnterHandler)(()=>L(b)),placeholder:'Enter LogsQL query (e.g. {job="mysql"} |= "error")'})]})]})}let p={getLogData:i,OptionsEditorComponent:m,createInitialOptions:()=>({query:""}),dependsOn:e=>({variables:[...new Set([...(0,a.parseVariables)(e.query)])]}),createVolumeQuery:(e,t)=>{if(!e.query||!e.query.trim())return null;let r=(0,a.calculateVolumeInterval)(t.timeRange.end.getTime()-t.timeRange.start.getTime());return{kind:"TimeSeriesQuery",spec:{plugin:{kind:"VictoriaLogsTimeSeriesQuery",spec:{query:`${e.query} | stats by (_time:${r}, _stream) count() as volume`,datasource:e.datasource,step:r}}}}}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["7843"],{6465(e,t,r){r.d(t,{m:()=>d});var a=r(62540),i=r(70451),o=r(56599),n=r(29068),s=r(63960),l=r(6365),u=r(31650);let c=(0,u.pn)({LineComment:u._A.comment,"Identifier StreamSelector":u._A.labelName,"LabelName LabelMatcher":u._A.labelName,String:u._A.string,"Number Float Duration":u._A.number,"LogRangeAggregation VectorAggregation":u._A.function(u._A.keyword),"And Or Unless":u._A.logicOperator,"Eq Neq Re Nre Gt Lt Gte Lte":u._A.compareOperator,"Add Sub Mul Div Mod Pow":u._A.arithmeticOperator,Pipe:u._A.operator,"By Without":u._A.keyword,"( )":u._A.paren,"[ ]":u._A.squareBracket,"{ }":u._A.brace,"⚠":u._A.invalid});function d(e){let t=(0,o.A)(),r="dark"===t.palette.mode,u=(0,i.useMemo)(()=>[s.bj.define({parser:l.K3.configure({props:[c]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}})],[]),d=(0,i.useMemo)(()=>{let e="light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return n.Lz.theme({"&":{backgroundColor:"transparent !important",border:`1px solid ${e}`,borderRadius:`${t.shape.borderRadius}px`},"&.cm-focused.cm-editor":{outline:"none"},".cm-content":{padding:"8px"}})},[t]);return(0,a.jsx)(n.Ay,{...e,theme:r?"dark":"light",basicSetup:{lineNumbers:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1,syntaxHighlighting:!0},extensions:[n.Lz.lineWrapping,u,d],placeholder:'Example: {job="my-service"} |= "error"'})}},50095(e,t,r){r.d(t,{H6:()=>s,m_:()=>i,fZ:()=>n,jx:()=>o});var a=r(
|
|
1
|
+
"use strict";(self.chunk_VictoriaLogs=self.chunk_VictoriaLogs||[]).push([["7843"],{6465(e,t,r){r.d(t,{m:()=>d});var a=r(62540),i=r(70451),o=r(56599),n=r(29068),s=r(63960),l=r(6365),u=r(31650);let c=(0,u.pn)({LineComment:u._A.comment,"Identifier StreamSelector":u._A.labelName,"LabelName LabelMatcher":u._A.labelName,String:u._A.string,"Number Float Duration":u._A.number,"LogRangeAggregation VectorAggregation":u._A.function(u._A.keyword),"And Or Unless":u._A.logicOperator,"Eq Neq Re Nre Gt Lt Gte Lte":u._A.compareOperator,"Add Sub Mul Div Mod Pow":u._A.arithmeticOperator,Pipe:u._A.operator,"By Without":u._A.keyword,"( )":u._A.paren,"[ ]":u._A.squareBracket,"{ }":u._A.brace,"⚠":u._A.invalid});function d(e){let t=(0,o.A)(),r="dark"===t.palette.mode,u=(0,i.useMemo)(()=>[s.bj.define({parser:l.K3.configure({props:[c]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}})],[]),d=(0,i.useMemo)(()=>{let e="light"===t.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return n.Lz.theme({"&":{backgroundColor:"transparent !important",border:`1px solid ${e}`,borderRadius:`${t.shape.borderRadius}px`},"&.cm-focused.cm-editor":{outline:"none"},".cm-content":{padding:"8px"}})},[t]);return(0,a.jsx)(n.Ay,{...e,theme:r?"dark":"light",basicSetup:{lineNumbers:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1,syntaxHighlighting:!0},extensions:[n.Lz.lineWrapping,u,d],placeholder:'Example: {job="my-service"} |= "error"'})}},50095(e,t,r){r.d(t,{H6:()=>s,m_:()=>i,fZ:()=>n,jx:()=>o});var a=r(39420);let i="VictoriaLogsDatasource",o={kind:i};function n(e){return!(0,a.isVariableDatasource)(e)&&void 0===e.name}function s(e){return(0,a.isVariableDatasource)(e)||e.kind===i}},7140(e,t,r){r.d(t,{N:()=>a,S:()=>i});let a="VictoriaLogsDatasource",i={kind:a}},43198(e,t,r){r.r(t),r.d(t,{VictoriaLogsQueryEditor:()=>h,VictoriaLogsTimeSeriesQuery:()=>b,getVictoriaLogsTimeSeriesData:()=>s});var a=r(39420),i=r(94461),o=r(40625),n=r(7140);let s=async(e,t)=>{if(!e.query)return{series:[],timeRange:{start:t.timeRange.start,end:t.timeRange.end},stepMs:15e3};let r=(0,a.replaceVariables)(e.query,t.variableState),s=await t.datasourceStore.getDatasourceClient(e.datasource??n.S),{start:l,end:u}=t.timeRange,c=e.step?function(e){if(!e)return;let t=(0,o.parseDurationString)(e);return Math.floor((0,i.milliseconds)(t)/1e3)}(e.step)??15:15,d=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:15,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=(t-e)/1e3/1e4;return i>1&&(i=Math.ceil(i)),Math.max(a/1e3,r,i)}(l.getTime(),u.getTime(),c,t.suggestedStepMs),g=d<60?`${Math.round(d)}s`:d<3600?`${Math.round(d/60)}m`:`${Math.round(d/3600)}h`,m=await s.statsQueryRange({query:r,step:g,start:l.toISOString(),end:u.toISOString()});if("error"===m.status)throw Error(m.error);return{series:m.data.result.map(e=>{let t={...e.metric};if(delete t._stream,delete t.__name__,e.metric._stream){let r=e.metric._stream.match(/{([^}]+)}/);r&&r[1]&&r[1].split(",").forEach(e=>{let[r,a]=e.split("=").map(e=>e.trim().replace(/^"|"$/g,""));r&&a&&(t[r]=a)})}return{name:Object.entries(t).map(e=>{let[t,r]=e;return`${t}=${r}`}).join(", "),values:e.values.map(e=>{let[t,r]=e;return[1e3*Number(t),Number(r)]}),labels:t}}),timeRange:{start:l,end:u},stepMs:1e3*d,metadata:{executedQueryString:r}}};var l=r(62540),u=r(315),c=r(54227),d=r(70451),g=r(21860),m=r(6465),p=r(50095);function h(e){let{onChange:t,value:r}=e,{datasource:i}=r,o=i??n.S,s=(0,a.useDatasourceSelectValueToSelector)(o,p.m_),[h,b]=(0,d.useState)(r.query);(0,d.useEffect)(()=>{b(r.query)},[r.query]);let A=(0,d.useCallback)(e=>{b(e)},[]),_=(0,d.useCallback)(e=>{t({...r,query:e})},[t,r]);return(0,l.jsxs)(u.A,{spacing:1.5,paddingBottom:1,children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"Datasource"}),(0,l.jsx)(a.DatasourceSelect,{datasourcePluginKind:n.N,value:s,onChange:e=>{if(!(0,a.isVariableDatasource)(e)&&e.kind===n.N)return void t({...r,datasource:e});throw Error("Got unexpected non VictoriaLogsQuery datasource selection")},label:"VictoriaLogs Datasource",notched:!0})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(c.A,{sx:{display:"block",marginBottom:"4px",fontWeight:500},children:"LogsQL Query"}),(0,l.jsx)(m.m,{value:h,onChange:A,onBlur:()=>_(h),onKeyDown:(0,g.createModEnterHandler)(()=>_(h)),placeholder:'Enter LogsQL query (e.g. {job="mysql"} |= "error")'})]})]})}let b={getTimeSeriesData:s,OptionsEditorComponent:h,createInitialOptions:()=>({query:""}),dependsOn:e=>({variables:[...new Set([...(0,a.parseVariables)(e.query)])]})}}}]);
|