@perses-dev/greptimedb-plugin 0.2.0-beta.1 → 0.2.0-beta.2

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.
Files changed (60) hide show
  1. package/__mf/js/{GreptimeDB.9dbe6a08.js → GreptimeDB.f1e3a072.js} +7 -7
  2. package/__mf/js/async/{121.56bb37a5.js → 121.caec175a.js} +2 -2
  3. package/__mf/js/async/{181.0b23bdde.js → 181.d4d87a1f.js} +2 -2
  4. package/__mf/js/async/{186.d822e51e.js → 186.c1dea752.js} +4 -4
  5. package/__mf/js/async/{192.1c56a673.js → 192.b9279059.js} +1 -1
  6. package/__mf/js/async/{2.881f5426.js → 2.dbc0a9c4.js} +1 -1
  7. package/__mf/js/async/{235.2d160014.js → 235.7a774edc.js} +1 -1
  8. package/__mf/js/async/{274.12deba12.js → 274.d5a294d9.js} +2 -2
  9. package/__mf/js/async/{356.a0a4fb90.js → 356.21b667a3.js} +1 -1
  10. package/__mf/js/async/{392.0e81d95d.js → 392.201e515e.js} +2 -2
  11. package/__mf/js/async/43.ebbb8652.js +2 -0
  12. package/__mf/js/async/43.ebbb8652.js.LICENSE.txt +24 -0
  13. package/__mf/js/async/{440.6f26c824.js → 440.f6c55d74.js} +2 -2
  14. package/__mf/js/async/{45.24cdf2be.js → 45.04388bc3.js} +1 -1
  15. package/__mf/js/async/{470.cb0667bf.js → 470.f896cf06.js} +2 -2
  16. package/__mf/js/async/496.91780bef.js +1 -0
  17. package/__mf/js/async/529.6c76a9cd.js +43 -0
  18. package/__mf/js/async/{372.3eb7b91b.js.LICENSE.txt → 529.6c76a9cd.js.LICENSE.txt} +0 -25
  19. package/__mf/js/async/{562.35b9aa36.js → 562.15460f81.js} +2 -2
  20. package/__mf/js/async/{587.6faed243.js → 587.445bbdb5.js} +1 -1
  21. package/__mf/js/async/588.2c301420.js +1 -0
  22. package/__mf/js/async/{616.f724c0e3.js → 616.ef1089bf.js} +1 -1
  23. package/__mf/js/async/628.6ea4a812.js +3 -0
  24. package/__mf/js/async/71.9f52cdd7.js +1 -0
  25. package/__mf/js/async/77.51ac6fa8.js +1 -0
  26. package/__mf/js/async/{862.ed1d2219.js → 862.d29af04f.js} +2 -2
  27. package/__mf/js/async/873.d5028ea7.js +1 -0
  28. package/__mf/js/async/{941.2b0202f8.js → 941.6221d54d.js} +2 -2
  29. package/__mf/js/async/{944.cab11a95.js → 944.89173f4a.js} +4 -4
  30. package/__mf/js/async/{968.9c6b03ae.js → 968.6f0ebddf.js} +1 -1
  31. package/__mf/js/async/978.4589faec.js +1 -0
  32. package/__mf/js/async/{__federation_expose_GreptimeDBDatasource.6be8459e.js → __federation_expose_GreptimeDBDatasource.ec9b176f.js} +2 -2
  33. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.96bef921.js +21 -0
  34. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.f4171877.js +21 -0
  35. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.e0ffd686.js +21 -0
  36. package/__mf/js/{main.0b36b2c2.js → main.993845fa.js} +2 -2
  37. package/mf-manifest.json +106 -50
  38. package/mf-stats.json +114 -50
  39. package/package.json +5 -5
  40. package/__mf/js/async/325.5fbc70db.js +0 -3
  41. package/__mf/js/async/372.3eb7b91b.js +0 -43
  42. package/__mf/js/async/663.febe982d.js +0 -1
  43. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.f24d7d8a.js +0 -21
  44. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.29aad4a4.js +0 -21
  45. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.99448480.js +0 -21
  46. /package/__mf/css/async/{372.85c2cbf6.css → 529.85c2cbf6.css} +0 -0
  47. /package/__mf/js/async/{121.56bb37a5.js.LICENSE.txt → 121.caec175a.js.LICENSE.txt} +0 -0
  48. /package/__mf/js/async/{181.0b23bdde.js.LICENSE.txt → 181.d4d87a1f.js.LICENSE.txt} +0 -0
  49. /package/__mf/js/async/{274.12deba12.js.LICENSE.txt → 274.d5a294d9.js.LICENSE.txt} +0 -0
  50. /package/__mf/js/async/{392.0e81d95d.js.LICENSE.txt → 392.201e515e.js.LICENSE.txt} +0 -0
  51. /package/__mf/js/async/{440.6f26c824.js.LICENSE.txt → 440.f6c55d74.js.LICENSE.txt} +0 -0
  52. /package/__mf/js/async/{470.cb0667bf.js.LICENSE.txt → 470.f896cf06.js.LICENSE.txt} +0 -0
  53. /package/__mf/js/async/{562.35b9aa36.js.LICENSE.txt → 562.15460f81.js.LICENSE.txt} +0 -0
  54. /package/__mf/js/async/{862.ed1d2219.js.LICENSE.txt → 862.d29af04f.js.LICENSE.txt} +0 -0
  55. /package/__mf/js/async/{941.2b0202f8.js.LICENSE.txt → 941.6221d54d.js.LICENSE.txt} +0 -0
  56. /package/__mf/js/async/{944.cab11a95.js.LICENSE.txt → 944.89173f4a.js.LICENSE.txt} +0 -0
  57. /package/__mf/js/async/{__federation_expose_GreptimeDBDatasource.6be8459e.js.LICENSE.txt → __federation_expose_GreptimeDBDatasource.ec9b176f.js.LICENSE.txt} +0 -0
  58. /package/__mf/js/async/{__federation_expose_GreptimeDBLogQuery.f24d7d8a.js.LICENSE.txt → __federation_expose_GreptimeDBLogQuery.96bef921.js.LICENSE.txt} +0 -0
  59. /package/__mf/js/async/{__federation_expose_GreptimeDBTimeSeriesQuery.29aad4a4.js.LICENSE.txt → __federation_expose_GreptimeDBTimeSeriesQuery.f4171877.js.LICENSE.txt} +0 -0
  60. /package/__mf/js/async/{__federation_expose_GreptimeDBTraceQuery.99448480.js.LICENSE.txt → __federation_expose_GreptimeDBTraceQuery.e0ffd686.js.LICENSE.txt} +0 -0
@@ -0,0 +1,21 @@
1
+ /*! For license information please see __federation_expose_GreptimeDBTraceQuery.e0ffd686.js.LICENSE.txt */
2
+ "use strict";(self.chunk_GreptimeDB_0_2_0_beta_2=self.chunk_GreptimeDB_0_2_0_beta_2||[]).push([["361"],{2192(e,t,r){var n=r(70451),i=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,a={},l=null,m=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(m=t.ref),t)s.call(t,n)&&!u.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:i,type:e,key:l,ref:m,props:a,_owner:o.current}}t.Fragment=a,t.jsx=l,t.jsxs=l},62540(e,t,r){e.exports=r(2192)},15062(e,t,r){r.d(t,{t:()=>n});let n=`-- Time Series Query
3
+ SELECT
4
+ date_bin(INTERVAL '1 minute', ts) as ts,
5
+ avg(cpu_usage) as avg_cpu,
6
+ max(memory_usage) as max_memory
7
+ FROM system_metrics
8
+ WHERE ts BETWEEN to_timestamp_millis($__from) AND to_timestamp_millis($__to)
9
+ GROUP BY ts
10
+ ORDER BY ts
11
+
12
+ -- Logs Query
13
+ SELECT
14
+ ts,
15
+ service,
16
+ level,
17
+ message
18
+ FROM application_logs
19
+ WHERE ts BETWEEN to_timestamp_millis($__from) AND to_timestamp_millis($__to)
20
+ ORDER BY ts DESC
21
+ LIMIT 1000`},71122(e,t,r){r.d(t,{M:()=>l});var n=r(62540),i=r(41865),a=r(56599),s=r(315),o=r(54227),u=r(29068);function l(e){let t=(0,a.A)(),r="dark"===t.palette.mode;return(0,n.jsxs)(s.A,{position:"relative",children:[(0,n.jsx)(o.A,{sx:{fontWeight:500,marginBottom:"4px",color:t.palette.text.primary},children:"GreptimeDB SQL Query"}),(0,n.jsx)(u.Ay,{...e,style:{border:`1px solid ${t.palette.divider}`},theme:r?"dark":"light",basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1,foldGutter:!1,syntaxHighlighting:!0},extensions:[i.Lz.lineWrapping,i.Lz.theme({".cm-content":{paddingTop:"8px",paddingBottom:"8px",paddingRight:"40px"}})],placeholder:"Write GreptimeDB SQL Query Here..."})]})}r(15062)},7140(e,t,r){r.d(t,{N:()=>n,S:()=>i});let n="GreptimeDBDatasource",i={kind:n}},57748(e,t,r){r.d(t,{EY:()=>i,W0:()=>function e(t,r){if(null==t)return null;let n=a(r);if("number"==typeof t){if(n){if(n.includes("nanosecond"))return Math.floor(t/1e6);if(n.includes("microsecond"))return Math.floor(t/1e3);if(n.includes("millisecond"))return t;if(n.includes("second"))return 1e3*t}return t>1e15?Math.floor(t/1e6):t>1e12?t:t>1e9?1e3*t:t}if("string"==typeof t){let n=Number(t);if(!Number.isNaN(n))return e(n,r)}let i=new Date(t).getTime();return Number.isNaN(i)?null:i},nu:()=>o,qV:()=>s});var n=r(26659);function i(e,t,r){let i,a,s,o,u,{start:l,end:m}=r,c=m.valueOf()-l.valueOf(),d={__from:{value:l.valueOf().toString(),loading:!1},__to:{value:m.valueOf().toString(),loading:!1},__range_ms:{value:c.toString(),loading:!1},__range_s:{value:Math.floor(c/1e3).toString(),loading:!1},__range:{value:(a=Math.floor((i=Math.floor(c/1e3))/3600),s=Math.floor(i%3600/60),o=i%60,u="",a>0&&(u+=`${a}h`),s>0&&(u+=`${s}m`),(o>0||""===u)&&(u+=`${o}s`),u),loading:!1}};return(0,n.replaceVariables)(e,{...d,...t})}function a(e){return e?e.toLowerCase():null}function s(e){var t,r;if(e&&"object"==typeof e)return null==(r=e.output)||null==(t=r[0])?void 0:t.records}function o(e){let t=-1,r=e.filter(e=>{let t=a(e.data_type);return null!==t&&t.startsWith("timestamp")});if(r.length>0){let n=r.find(e=>{var t;return(null==(t=e.semantic_type)?void 0:t.toLowerCase())==="timestamp"})??r[0];t=e.findIndex(e=>e.name===n.name)}if(-1===t){let r=new Set(["greptime_timestamp","timestamp","ts","time"]);t=e.findIndex(e=>r.has(e.name.toLowerCase()))}return t}},24388(e,t,r){r.r(t),r.d(t,{GreptimeDBTraceQuery:()=>T,toNanoString:()=>_,GreptimeDBTraceQueryEditor:()=>E,getGreptimeDBTraceData:()=>s});var n=r(26659),i=r(7140),a=r(57748);let s=async(e,t)=>{var r,s;let g=(0,n.replaceVariables)(e.query??"",t.variableState).trim();if(0===g.length)return{searchResult:[]};let v=function(e){if(e){if("string"==typeof e.name&&""===e.name.trim()){let{kind:t}=e;return t?{kind:t}:void 0}return e}}(e.datasource),S=await t.datasourceStore.getDatasourceClient(v??i.S),h=(null==(r=t.absoluteTimeRange)?void 0:r.start.getTime().toString())??"0",y=(null==(s=t.absoluteTimeRange)?void 0:s.end.getTime().toString())??"0",x=await S.query({query:g,start:h,end:y});if("error"===x.status)throw Error(x.error??"GreptimeDB trace query failed");let E=(0,a.qV)(x.data);return/where[\s\S]*trace_id\s*=/i.test(g)&&function(e){var t;let r=(null==e||null==(t=e.schema)?void 0:t.column_schemas)??[];if(0===r.length)return!1;let n=o(r);return void 0!==n.trace_id&&void 0!==n.span_id}(E)?{trace:function(e){var t;let r=(null==e||null==(t=e.schema)?void 0:t.column_schemas)??[],n=(null==e?void 0:e.rows)??[];if(!r.length||!n.length)return{resourceSpans:[]};let i=o(r),a=r.filter(e=>e.name.startsWith("span_attributes.")),s=r.filter(e=>e.name.startsWith("resource_attributes.")),d=new Map;return n.forEach(e=>{let t=m(l(e,i,["trace_id","traceid","traceId"])),n=m(l(e,i,["span_id","spanid","spanId"]));if(!t||!n)return;let o=m(l(e,i,["parent_span_id","parentspanid","parentSpanId"])),g=m(l(e,i,["span_name","name","operation_name"]))??"(unknown span)",v=m(l(e,i,["span_kind","kind"]))??"SPAN_KIND_UNSPECIFIED",S=m(l(e,i,["service_name"]))??"unknown",h=m(l(e,i,["scope_name"]))??"",y=m(l(e,i,["scope_version"]))??"",x=i.timestamp??i.start_time??i.start_time_unix_nano,E=i.timestamp_end??i.end_time??i.end_time_unix_nano,T=i.duration_nano??i.duration_ns,N=void 0!==x?_(e[x],u(r,x))??"0":"0",b=(void 0!==E?_(e[E],u(r,E))??"0":void 0)??(void 0!==T?String(BigInt(N)+BigInt(_(e[T],u(r,T))??"0")):N),D=a.map(t=>{let r=i[t.name.toLowerCase()];if(void 0===r)return;let n=e[r];if(null!=n&&""!==n)return f(t.name.replace(/^span_attributes\./,""),n)}).filter(e=>void 0!==e),M=p(l(e,i,["span_events"])).map(e=>{let t=function(e){if(null==e)return;let t=c(e);if(void 0!==t)return String(BigInt(Math.trunc(t)));let r=new Date(String(e)).getTime();if(!Number.isNaN(r))return String(1000000n*BigInt(Math.trunc(r)))}(e.timeUnixNano??e.time_unix_nano)??N,r=m(e.name)??"event",n=e.attributes;return{timeUnixNano:t,name:r,attributes:n?Object.entries(n).map(e=>{let[t,r]=e;return f(t,r)}):[]}}),O=p(l(e,i,["span_links"])).map(e=>{let t=e.attributes,r=t?Object.entries(t).map(e=>{let[t,r]=e;return f(t,r)}):[];return{traceId:m(e.traceId??e.trace_id)??"",spanId:m(e.spanId??e.span_id)??"",attributes:r}}),w=m(l(e,i,["span_status_message"]))??"",C=function(e){let t=String(e??"").trim().toUpperCase();if(t)return"STATUS_CODE_OK"===t||"OK"===t||"1"===t?"STATUS_CODE_OK":"STATUS_CODE_ERROR"===t||"ERROR"===t||"2"===t?"STATUS_CODE_ERROR":"STATUS_CODE_UNSET"}(l(e,i,["span_status_code","status_code"]));if(!d.has(S)){let t=[f("service.name",S)];s.forEach(r=>{let n=i[r.name.toLowerCase()];if(void 0===n)return;let a=e[n];null!=a&&""!==a&&t.push(f(r.name.replace(/^resource_attributes\./,""),a))}),d.set(S,{resourceAttrs:t,scopeSpans:new Map})}let R=d.get(S),B=`${h}|${y}`;R.scopeSpans.has(B)||R.scopeSpans.set(B,{scope:{name:h,version:y},spans:[]}),R.scopeSpans.get(B).spans.push({traceId:t,spanId:n,parentSpanId:o,name:g,kind:v,startTimeUnixNano:N,endTimeUnixNano:b,attributes:D,events:M,links:O,status:{message:w,code:C}})}),{resourceSpans:Array.from(d.entries()).map(e=>{let[t,r]=e;return{resource:{attributes:r.resourceAttrs},scopeSpans:Array.from(r.scopeSpans.values())}})}}(E),metadata:{executedQueryString:g}}:{searchResult:function(e){var t;let r=(null==e||null==(t=e.schema)?void 0:t.column_schemas)??[],n=(null==e?void 0:e.rows)??[];if(!r.length||!n.length)return[];let i=o(r),s=new Map;return n.forEach(e=>{let t=m(l(e,i,["trace_id","traceid","traceId"]));if(!t)return;let n=function(e,t,r){for(let n of["timestamp","start_time","start_time_unix_nano","start_time_unix_ns","start_time_unix_ms","start_time_unix"]){let i=r[n];if(void 0===i||!t)continue;let s=(0,a.W0)(e[i],u(t,i));if(null!==s)return s}}(e,r,i),o=function(e,t,r){let n=c(l(e,r,["duration_ms"]));if(void 0!==n)return n;let i=c(l(e,r,["duration_nano","duration_ns"]));if(void 0!==i)return i/1e6;let s=r.timestamp??r.start_time??r.start_time_unix_nano,o=r.timestamp_end??r.end_time??r.end_time_unix_nano;if(t&&void 0!==s&&void 0!==o){let r=(0,a.W0)(e[s],u(t,s)),n=(0,a.W0)(e[o],u(t,o));if(null!==r&&null!==n)return Math.max(0,n-r)}return 0}(e,r,i),_=function(e,t,r){for(let n of["timestamp_end","end_time","end_time_unix_nano","end_time_unix_ns","end_time_unix_ms"]){let i=r[n];if(void 0===i||!t)continue;let s=(0,a.W0)(e[i],u(t,i));if(null!==s)return s}}(e,r,i)??(void 0!==n?n+o:void 0),p=m(l(e,i,["service_name","root_service_name"]))??"unknown",f=m(l(e,i,["span_name","root_trace_name","operation_name","name"]))??"(unknown span)",g=m(l(e,i,["parent_span_id","parentspanid","parentSpanId"])),v=s.get(t);v?(void 0!==n&&(v.startTimeUnixMs=0===v.startTimeUnixMs?n:Math.min(v.startTimeUnixMs,n)),void 0!==_&&(v.endTimeUnixMs=Math.max(v.endTimeUnixMs,_)),g||(v.rootTraceName=f,v.rootServiceName=p),v.serviceStats[p]||(v.serviceStats[p]={spanCount:0,errorCount:0}),v.serviceStats[p].spanCount+=1,d(l(e,i,["span_status_code","status_code"]))&&(v.serviceStats[p].errorCount+=1)):s.set(t,{traceId:t,startTimeUnixMs:n??0,endTimeUnixMs:_??n??0,rootServiceName:p,rootTraceName:f,serviceStats:{[p]:{spanCount:1,errorCount:+!!d(l(e,i,["span_status_code","status_code"]))}}})}),Array.from(s.values()).map(e=>({traceId:e.traceId,startTimeUnixMs:e.startTimeUnixMs,durationMs:Math.max(0,e.endTimeUnixMs-e.startTimeUnixMs),rootServiceName:e.rootServiceName,rootTraceName:e.rootTraceName,serviceStats:e.serviceStats})).toSorted((e,t)=>t.startTimeUnixMs-e.startTimeUnixMs)}(E),metadata:{executedQueryString:g}}};function o(e){let t={};return(e??[]).forEach((e,r)=>{t[e.name.toLowerCase()]=r}),t}function u(e,t){let r=e[t];if(!r)throw Error(`GreptimeDB SQL response missing column at index ${t}`);let n=r.data_type;if(!n)throw Error(`GreptimeDB SQL response missing data_type for column "${r.name}"`);return n}function l(e,t,r){for(let n of r){let r=t[n.toLowerCase()];if(void 0!==r)return e[r]}}function m(e){if(null!=e)return String(e)}function c(e){if(null==e)return;if("number"==typeof e)return Number.isFinite(e)?e:void 0;let t=Number(e);return Number.isFinite(t)?t:void 0}function d(e){let t=String(e??"").trim().toUpperCase();return"STATUS_CODE_ERROR"===t||"ERROR"===t||"2"===t}function _(e,t){let r;if(null==e)return;let n=c(e);if(void 0===n)return;let i=t.toLowerCase();if(i.includes("nanosecond"))return String(BigInt(Math.trunc(n)));if(i.includes("microsecond"))return String(1000n*BigInt(Math.trunc(n)));if(i.includes("millisecond"))return String(1000000n*BigInt(Math.trunc(n)));if(i.includes("second"))return String(1000000000n*BigInt(Math.trunc(n)));if((r=t.toLowerCase()).includes("int")||r.includes("uint")||"bigint"===r)return String(BigInt(Math.trunc(n)));throw Error(`Unsupported GreptimeDB data_type: ${t}`)}function p(e){if(Array.isArray(e))return e;if("string"==typeof e)try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{}return[]}function f(e,t){return{key:e,value:{stringValue:"string"==typeof t?t:JSON.stringify(t)}}}var g=r(62540),v=r(315),S=r(38662),h=r(70451),y=r(71122),x=r(64383);function E(e){let{onChange:t,value:r}=e,{datasource:a}=r,s=a??i.S,{query:o,handleQueryChange:u,handleQueryBlur:l}=(0,x.Z)(e),m=(0,h.useCallback)(e=>{u(e)},[u]);return(0,g.jsxs)(v.A,{spacing:1.5,children:[(0,g.jsx)(n.DatasourceSelect,{datasourcePluginKind:i.N,value:s,onChange:e=>{if(!(0,n.isVariableDatasource)(e)&&e.kind===i.N)return void t((0,S.produce)(r,t=>{t.datasource=e}));throw Error("Got unexpected non GreptimeDB datasource selection")},label:"GreptimeDB Datasource",notched:!0}),(0,g.jsx)(y.M,{value:o,onChange:m,onBlur:l,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),t((0,S.produce)(r,e=>{e.query=o})))},placeholder:"Enter SQL for trace search or trace details"})]})}let T={getTraceData:s,OptionsEditorComponent:E,createInitialOptions:()=>({query:""}),dependsOn:e=>({variables:[...new Set((0,n.parseVariables)(e.query))]})}},64383(e,t,r){r.d(t,{Z:()=>a});var n=r(38662),i=r(70451);function a(e){let{onChange:t,value:r}=e,[a,s]=(0,i.useState)(r.query||""),[o,u]=(0,i.useState)(r.query);return r.query!==o&&(s(r.query||""),u(r.query)),{query:a,handleQueryChange:e=>{s(e)},handleQueryBlur:()=>{u(a),t((0,n.produce)(r,e=>{e.query=a}))}}}}}]);