@perses-dev/plugin-system 0.51.0 → 0.52.0-beta.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.
Files changed (47) hide show
  1. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
  2. package/dist/cjs/components/PluginEditor/PluginEditor.js +41 -15
  3. package/dist/cjs/model/index.js +1 -0
  4. package/dist/cjs/model/profile-queries.js +16 -0
  5. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  6. package/dist/cjs/runtime/DataQueriesProvider/model.js +17 -4
  7. package/dist/cjs/runtime/index.js +1 -0
  8. package/dist/cjs/runtime/profile-queries.js +65 -0
  9. package/dist/cjs/test/mock-data.js +23 -0
  10. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
  11. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  12. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  13. package/dist/components/PluginEditor/PluginEditor.js +37 -16
  14. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  15. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
  16. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  17. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  18. package/dist/model/index.d.ts +1 -0
  19. package/dist/model/index.d.ts.map +1 -1
  20. package/dist/model/index.js +1 -0
  21. package/dist/model/index.js.map +1 -1
  22. package/dist/model/plugins.d.ts +2 -0
  23. package/dist/model/plugins.d.ts.map +1 -1
  24. package/dist/model/plugins.js.map +1 -1
  25. package/dist/model/profile-queries.d.ts +19 -0
  26. package/dist/model/profile-queries.d.ts.map +1 -0
  27. package/dist/model/profile-queries.js +15 -0
  28. package/dist/model/profile-queries.js.map +1 -0
  29. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  30. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  31. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  32. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  33. package/dist/runtime/DataQueriesProvider/model.js +17 -4
  34. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  35. package/dist/runtime/index.d.ts +1 -0
  36. package/dist/runtime/index.d.ts.map +1 -1
  37. package/dist/runtime/index.js +1 -0
  38. package/dist/runtime/index.js.map +1 -1
  39. package/dist/runtime/profile-queries.d.ts +10 -0
  40. package/dist/runtime/profile-queries.d.ts.map +1 -0
  41. package/dist/runtime/profile-queries.js +52 -0
  42. package/dist/runtime/profile-queries.js.map +1 -0
  43. package/dist/test/mock-data.d.ts +2 -1
  44. package/dist/test/mock-data.d.ts.map +1 -1
  45. package/dist/test/mock-data.js +20 -0
  46. package/dist/test/mock-data.js.map +1 -1
  47. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/profile-queries.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/core';\nimport { useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nexport type ProfileQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'ProfileQuery', PluginSpec>;\nexport const PROFILE_QUERY_KEY = 'ProfileQuery';\n\n/**\n * Run a profile query using a ProfileQuery plugin and return the results\n * @param definitions: dashboard defintion for a profile query\n */\nexport function useProfileQueries(definitions: ProfileQueryDefinition[]): Array<UseQueryResult<ProfileData>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n\n const context = {\n datasourceStore,\n absoluteTimeRange,\n };\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = [definition, datasourceStore, absoluteTimeRange] as const; // `queryKey` watches and reruns `queryFn` if keys in the array change\n const profileQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n queryFn: async (): Promise<ProfileData> => {\n const plugin = await getPlugin(PROFILE_QUERY_KEY, profileQueryKind);\n const data = await plugin.getProfileData(definition.spec.plugin.spec, context);\n return data;\n },\n\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","PROFILE_QUERY_KEY","useProfileQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","context","queries","map","definition","queryKey","profileQueryKind","spec","plugin","kind","queryFn","data","getProfileData","structuralSharing"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,QAAwB,wBAAwB;AACnE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,sBAAsB;AAEnD,OAAO,MAAMC,oBAAoB,eAAe;AAEhD;;;CAGC,GACD,OAAO,SAASC,kBAAkBC,WAAqC;IACrE,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,kBAAkBP;IACxB,MAAM,EAAEQ,iBAAiB,EAAE,GAAGN;IAE9B,MAAMO,UAAU;QACdF;QACAC;IACF;IAEA,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOT,WAAW;QAChBW,SAASL,YAAYM,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAACD;gBAAYL;gBAAiBC;aAAkB,EAAW,sEAAsE;YAClJ,MAAMM,mBAAmBF,YAAYG,MAAMC,QAAQC;YACnD,OAAO;gBACLJ,UAAUA;gBACVK,SAAS;oBACP,MAAMF,SAAS,MAAMV,UAAUH,mBAAmBW;oBAClD,MAAMK,OAAO,MAAMH,OAAOI,cAAc,CAACR,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN;oBACtE,OAAOU;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
@@ -1,4 +1,5 @@
1
- import { TimeSeriesData, TraceData } from '@perses-dev/core';
1
+ import { ProfileData, TimeSeriesData, TraceData } from '@perses-dev/core';
2
2
  export declare const MOCK_TIME_SERIES_DATA: TimeSeriesData;
3
3
  export declare const MOCK_TRACE_DATA: TraceData;
4
+ export declare const MOCK_PROFILE_DATA: ProfileData;
4
5
  //# sourceMappingURL=mock-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,EAAE,cAsBnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAmC7B,CAAC"}
1
+ {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1E,eAAO,MAAM,qBAAqB,EAAE,cAsBnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAmC7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAmB/B,CAAC"}
@@ -81,5 +81,25 @@ export const MOCK_TRACE_DATA = {
81
81
  executedQueryString: '{ duration > 1000ms }'
82
82
  }
83
83
  };
84
+ export const MOCK_PROFILE_DATA = {
85
+ profile: {
86
+ stackTrace: {
87
+ id: 0,
88
+ name: 'root',
89
+ level: 0,
90
+ start: 1699916103945861,
91
+ end: 1699916105065861,
92
+ total: 1000,
93
+ self: 500,
94
+ children: []
95
+ }
96
+ },
97
+ metadata: {
98
+ spyName: '',
99
+ sampleRate: 1000000000,
100
+ units: 'samples',
101
+ name: 'cpu'
102
+ }
103
+ };
84
104
 
85
105
  //# sourceMappingURL=mock-data.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesData, TraceData } from '@perses-dev/core';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;QACA;YACED,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;KACD;AACH,EAAE;AAEF,OAAO,MAAMC,kBAA6B;IACxCC,cAAc;QACZ;YACEC,YAAY;YACZC,cAAc;gBACZ,gBAAgB;oBACdC,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACA,mBAAmB;oBACjBD,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACAC,UAAU;oBACRF,WAAW;oBACXC,YAAY;gBACd;YACF;YACAE,iBAAiB;YACjBC,SAAS;YACTC,iBAAiB;YACjBC,eAAe;QACjB;KACD;IACDC,UAAU;QACRC,qBAAqB;IACvB;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ProfileData, TimeSeriesData, TraceData } from '@perses-dev/core';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n\nexport const MOCK_PROFILE_DATA: ProfileData = {\n profile: {\n stackTrace: {\n id: 0,\n name: 'root',\n level: 0,\n start: 1699916103945861,\n end: 1699916105065861,\n total: 1000,\n self: 500,\n children: [],\n },\n },\n metadata: {\n spyName: '',\n sampleRate: 1000000000,\n units: 'samples',\n name: 'cpu',\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString","MOCK_PROFILE_DATA","profile","stackTrace","id","level","total","self","children","spyName","sampleRate","units"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;QACA;YACED,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;KACD;AACH,EAAE;AAEF,OAAO,MAAMC,kBAA6B;IACxCC,cAAc;QACZ;YACEC,YAAY;YACZC,cAAc;gBACZ,gBAAgB;oBACdC,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACA,mBAAmB;oBACjBD,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACAC,UAAU;oBACRF,WAAW;oBACXC,YAAY;gBACd;YACF;YACAE,iBAAiB;YACjBC,SAAS;YACTC,iBAAiB;YACjBC,eAAe;QACjB;KACD;IACDC,UAAU;QACRC,qBAAqB;IACvB;AACF,EAAE;AAEF,OAAO,MAAMC,oBAAiC;IAC5CC,SAAS;QACPC,YAAY;YACVC,IAAI;YACJlB,MAAM;YACNmB,OAAO;YACPxB,OAAO;YACPE,KAAK;YACLuB,OAAO;YACPC,MAAM;YACNC,UAAU,EAAE;QACd;IACF;IACAT,UAAU;QACRU,SAAS;QACTC,YAAY;QACZC,OAAO;QACPzB,MAAM;IACR;AACF,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.51.0",
3
+ "version": "0.52.0-beta.0",
4
4
  "description": "The plugin feature in Pereses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^0.14.3",
32
- "@perses-dev/components": "0.51.0",
33
- "@perses-dev/core": "0.51.0",
32
+ "@perses-dev/components": "0.52.0-beta.0",
33
+ "@perses-dev/core": "0.52.0-beta.0",
34
34
  "date-fns": "^4.1.0",
35
35
  "date-fns-tz": "^3.2.0",
36
36
  "immer": "^10.1.1",