@perses-dev/plugin-system 0.51.1 → 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 (44) hide show
  1. package/dist/cjs/components/PluginEditor/PluginEditor.js +41 -15
  2. package/dist/cjs/model/index.js +1 -0
  3. package/dist/cjs/model/profile-queries.js +16 -0
  4. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  5. package/dist/cjs/runtime/DataQueriesProvider/model.js +17 -4
  6. package/dist/cjs/runtime/index.js +1 -0
  7. package/dist/cjs/runtime/profile-queries.js +65 -0
  8. package/dist/cjs/test/mock-data.js +23 -0
  9. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  10. package/dist/components/PluginEditor/PluginEditor.js +37 -16
  11. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  12. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
  13. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  14. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  15. package/dist/model/index.d.ts +1 -0
  16. package/dist/model/index.d.ts.map +1 -1
  17. package/dist/model/index.js +1 -0
  18. package/dist/model/index.js.map +1 -1
  19. package/dist/model/plugins.d.ts +2 -0
  20. package/dist/model/plugins.d.ts.map +1 -1
  21. package/dist/model/plugins.js.map +1 -1
  22. package/dist/model/profile-queries.d.ts +19 -0
  23. package/dist/model/profile-queries.d.ts.map +1 -0
  24. package/dist/model/profile-queries.js +15 -0
  25. package/dist/model/profile-queries.js.map +1 -0
  26. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  27. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  28. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  29. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  30. package/dist/runtime/DataQueriesProvider/model.js +17 -4
  31. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  32. package/dist/runtime/index.d.ts +1 -0
  33. package/dist/runtime/index.d.ts.map +1 -1
  34. package/dist/runtime/index.js +1 -0
  35. package/dist/runtime/index.js.map +1 -1
  36. package/dist/runtime/profile-queries.d.ts +10 -0
  37. package/dist/runtime/profile-queries.d.ts.map +1 -0
  38. package/dist/runtime/profile-queries.js +52 -0
  39. package/dist/runtime/profile-queries.js.map +1 -0
  40. package/dist/test/mock-data.d.ts +2 -1
  41. package/dist/test/mock-data.d.ts.map +1 -1
  42. package/dist/test/mock-data.js +20 -0
  43. package/dist/test/mock-data.js.map +1 -1
  44. package/package.json +3 -3
@@ -22,10 +22,16 @@ Object.defineProperty(exports, "PluginEditor", {
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
+ const _Reload = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Reload"));
25
26
  const _components = require("@perses-dev/components");
26
27
  const _PluginKindSelect = require("../PluginKindSelect");
27
28
  const _PluginSpecEditor = require("../PluginSpecEditor");
28
29
  const _plugineditorapi = require("./plugin-editor-api");
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
29
35
  function PluginEditor(props) {
30
36
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
37
  const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
@@ -33,23 +39,43 @@ function PluginEditor(props) {
33
39
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
34
40
  ...others,
35
41
  children: [
36
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
37
- fullWidth: false,
42
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
38
43
  sx: {
39
- mb: 2,
40
- minWidth: 120
41
- },
42
- margin: "dense",
43
- label: pluginKindLabel,
44
- pluginTypes: pluginTypes,
45
- disabled: isLoading,
46
- value: pendingSelection ? pendingSelection : value.selection,
47
- InputProps: {
48
- readOnly: isReadonly
44
+ display: 'flex',
45
+ flexDirection: 'row'
49
46
  },
50
- error: !!error,
51
- helperText: error?.message,
52
- onChange: onSelectionChange
47
+ children: [
48
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
49
+ fullWidth: false,
50
+ sx: {
51
+ mb: 2,
52
+ minWidth: 120
53
+ },
54
+ margin: "dense",
55
+ label: pluginKindLabel,
56
+ pluginTypes: pluginTypes,
57
+ disabled: isLoading,
58
+ value: pendingSelection ? pendingSelection : value.selection,
59
+ InputProps: {
60
+ readOnly: isReadonly
61
+ },
62
+ error: !!error,
63
+ helperText: error?.message,
64
+ onChange: onSelectionChange
65
+ }),
66
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
67
+ variant: "contained",
68
+ sx: {
69
+ marginTop: 1.5,
70
+ marginBottom: 1.5,
71
+ paddingTop: 0.5,
72
+ marginLeft: 'auto'
73
+ },
74
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Reload.default, {}),
75
+ onClick: ()=>onSpecChange(value.spec),
76
+ children: "Run Query"
77
+ })
78
+ ]
53
79
  }),
54
80
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
55
81
  FallbackComponent: _components.ErrorAlert,
@@ -22,6 +22,7 @@ _export_star(require("./plugin-base"), exports);
22
22
  _export_star(require("./plugin-loading"), exports);
23
23
  _export_star(require("./time-series-queries"), exports);
24
24
  _export_star(require("./trace-queries"), exports);
25
+ _export_star(require("./profile-queries"), exports);
25
26
  _export_star(require("./variables"), exports);
26
27
  function _export_star(from, to) {
27
28
  Object.keys(from).forEach(function(k) {
@@ -0,0 +1,16 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -38,6 +38,7 @@ const _jsxruntime = require("react/jsx-runtime");
38
38
  const _react = require("react");
39
39
  const _timeseriesqueries = require("../time-series-queries");
40
40
  const _tracequeries = require("../trace-queries");
41
+ const _profilequeries = require("../profile-queries");
41
42
  const _UsageMetricsProvider = require("../UsageMetricsProvider");
42
43
  const _model = require("./model");
43
44
  const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
@@ -83,17 +84,22 @@ function DataQueriesProvider(props) {
83
84
  const timeSeriesResults = (0, _timeseriesqueries.useTimeSeriesQueries)(timeSeriesQueries, options, queryOptions);
84
85
  const traceQueries = queryDefinitions.filter((definition)=>definition.kind === 'TraceQuery');
85
86
  const traceResults = (0, _tracequeries.useTraceQueries)(traceQueries);
87
+ const profileQueries = queryDefinitions.filter((definition)=>definition.kind === 'ProfileQuery');
88
+ const profileResults = (0, _profilequeries.useProfileQueries)(profileQueries);
86
89
  const refetchAll = (0, _react.useCallback)(()=>{
87
90
  timeSeriesResults.forEach((result)=>result.refetch());
88
91
  traceResults.forEach((result)=>result.refetch());
92
+ profileResults.forEach((result)=>result.refetch());
89
93
  }, [
90
94
  timeSeriesResults,
91
- traceResults
95
+ traceResults,
96
+ profileResults
92
97
  ]);
93
98
  const ctx = (0, _react.useMemo)(()=>{
94
99
  const mergedQueryResults = [
95
100
  ...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries),
96
- ...(0, _model.transformQueryResults)(traceResults, traceQueries)
101
+ ...(0, _model.transformQueryResults)(traceResults, traceQueries),
102
+ ...(0, _model.transformQueryResults)(profileResults, profileQueries)
97
103
  ];
98
104
  if (queryOptions?.enabled) {
99
105
  for (const result of mergedQueryResults){
@@ -118,6 +124,8 @@ function DataQueriesProvider(props) {
118
124
  timeSeriesResults,
119
125
  traceQueries,
120
126
  traceResults,
127
+ profileQueries,
128
+ profileResults,
121
129
  refetchAll,
122
130
  queryOptions?.enabled,
123
131
  usageMetrics
@@ -49,11 +49,15 @@ function useQueryType() {
49
49
  const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
50
50
  'TraceQuery'
51
51
  ]);
52
+ const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
53
+ 'ProfileQuery'
54
+ ]);
52
55
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
53
56
  const queryTypeMap = (0, _react.useMemo)(()=>{
54
57
  const map = {
55
58
  TimeSeriesQuery: [],
56
- TraceQuery: []
59
+ TraceQuery: [],
60
+ ProfileQuery: []
57
61
  };
58
62
  if (timeSeriesQueryPlugins) {
59
63
  timeSeriesQueryPlugins.forEach((plugin)=>{
@@ -65,10 +69,16 @@ function useQueryType() {
65
69
  map[plugin.kind]?.push(plugin.spec.name);
66
70
  });
67
71
  }
72
+ if (profileQueryPlugins) {
73
+ profileQueryPlugins.forEach((plugin)=>{
74
+ map[plugin.kind]?.push(plugin.spec.name);
75
+ });
76
+ }
68
77
  return map;
69
78
  }, [
70
79
  timeSeriesQueryPlugins,
71
- traceQueryPlugins
80
+ traceQueryPlugins,
81
+ profileQueryPlugins
72
82
  ]);
73
83
  const getQueryType = (0, _react.useCallback)((pluginKind)=>{
74
84
  const isLoading = (pluginKind)=>{
@@ -77,8 +87,10 @@ function useQueryType() {
77
87
  return isTimeSeriesQueryLoading;
78
88
  case 'TempoTraceQuery':
79
89
  return isTraceQueryPluginLoading;
90
+ case 'PyroscopeProfileQuery':
91
+ return isProfileQueryPluginLoading;
80
92
  }
81
- return isTraceQueryPluginLoading || isTimeSeriesQueryLoading;
93
+ return isTraceQueryPluginLoading || isTimeSeriesQueryLoading || isProfileQueryPluginLoading;
82
94
  };
83
95
  if (isLoading(pluginKind)) {
84
96
  return undefined;
@@ -92,7 +104,8 @@ function useQueryType() {
92
104
  }, [
93
105
  queryTypeMap,
94
106
  isTimeSeriesQueryLoading,
95
- isTraceQueryPluginLoading
107
+ isTraceQueryPluginLoading,
108
+ isProfileQueryPluginLoading
96
109
  ]);
97
110
  return getQueryType;
98
111
  }
@@ -21,6 +21,7 @@ _export_star(require("./variables"), exports);
21
21
  _export_star(require("./TimeRangeProvider"), exports);
22
22
  _export_star(require("./time-series-queries"), exports);
23
23
  _export_star(require("./trace-queries"), exports);
24
+ _export_star(require("./profile-queries"), exports);
24
25
  _export_star(require("./DataQueriesProvider"), exports);
25
26
  _export_star(require("./QueryCountProvider"), exports);
26
27
  _export_star(require("./UsageMetricsProvider"), exports);
@@ -0,0 +1,65 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ PROFILE_QUERY_KEY: function() {
25
+ return PROFILE_QUERY_KEY;
26
+ },
27
+ useProfileQueries: function() {
28
+ return useProfileQueries;
29
+ }
30
+ });
31
+ const _reactquery = require("@tanstack/react-query");
32
+ const _datasources = require("./datasources");
33
+ const _pluginregistry = require("./plugin-registry");
34
+ const _TimeRangeProvider = require("./TimeRangeProvider");
35
+ const PROFILE_QUERY_KEY = 'ProfileQuery';
36
+ function useProfileQueries(definitions) {
37
+ const { getPlugin } = (0, _pluginregistry.usePluginRegistry)();
38
+ const datasourceStore = (0, _datasources.useDatasourceStore)();
39
+ const { absoluteTimeRange } = (0, _TimeRangeProvider.useTimeRange)();
40
+ const context = {
41
+ datasourceStore,
42
+ absoluteTimeRange
43
+ };
44
+ // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)
45
+ // https://tanstack.com/query/v4/docs/react/reference/useQuery
46
+ return (0, _reactquery.useQueries)({
47
+ queries: definitions.map((definition)=>{
48
+ const queryKey = [
49
+ definition,
50
+ datasourceStore,
51
+ absoluteTimeRange
52
+ ]; // `queryKey` watches and reruns `queryFn` if keys in the array change
53
+ const profileQueryKind = definition?.spec?.plugin?.kind;
54
+ return {
55
+ queryKey: queryKey,
56
+ queryFn: async ()=>{
57
+ const plugin = await getPlugin(PROFILE_QUERY_KEY, profileQueryKind);
58
+ const data = await plugin.getProfileData(definition.spec.plugin.spec, context);
59
+ return data;
60
+ },
61
+ structuralSharing: false
62
+ };
63
+ })
64
+ });
65
+ }
@@ -21,6 +21,9 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
+ MOCK_PROFILE_DATA: function() {
25
+ return MOCK_PROFILE_DATA;
26
+ },
24
27
  MOCK_TIME_SERIES_DATA: function() {
25
28
  return MOCK_TIME_SERIES_DATA;
26
29
  },
@@ -99,3 +102,23 @@ const MOCK_TRACE_DATA = {
99
102
  executedQueryString: '{ duration > 1000ms }'
100
103
  }
101
104
  };
105
+ const MOCK_PROFILE_DATA = {
106
+ profile: {
107
+ stackTrace: {
108
+ id: 0,
109
+ name: 'root',
110
+ level: 0,
111
+ start: 1699916103945861,
112
+ end: 1699916105065861,
113
+ total: 1000,
114
+ self: 500,
115
+ children: []
116
+ }
117
+ },
118
+ metadata: {
119
+ spyName: '',
120
+ sampleRate: 1000000000,
121
+ units: 'samples',
122
+ name: 'cpu'
123
+ }
124
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA6BnE"}
1
+ {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAyCnE"}
@@ -11,7 +11,8 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { Box } from '@mui/material';
14
+ import { Box, Button } from '@mui/material';
15
+ import Reload from 'mdi-material-ui/Reload';
15
16
  import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
16
17
  import { PluginKindSelect } from '../PluginKindSelect';
17
18
  import { PluginSpecEditor } from '../PluginSpecEditor';
@@ -30,23 +31,43 @@ import { usePluginEditor } from './plugin-editor-api';
30
31
  return /*#__PURE__*/ _jsxs(Box, {
31
32
  ...others,
32
33
  children: [
33
- /*#__PURE__*/ _jsx(PluginKindSelect, {
34
- fullWidth: false,
34
+ /*#__PURE__*/ _jsxs(Box, {
35
35
  sx: {
36
- mb: 2,
37
- minWidth: 120
36
+ display: 'flex',
37
+ flexDirection: 'row'
38
38
  },
39
- margin: "dense",
40
- label: pluginKindLabel,
41
- pluginTypes: pluginTypes,
42
- disabled: isLoading,
43
- value: pendingSelection ? pendingSelection : value.selection,
44
- InputProps: {
45
- readOnly: isReadonly
46
- },
47
- error: !!error,
48
- helperText: error?.message,
49
- onChange: onSelectionChange
39
+ children: [
40
+ /*#__PURE__*/ _jsx(PluginKindSelect, {
41
+ fullWidth: false,
42
+ sx: {
43
+ mb: 2,
44
+ minWidth: 120
45
+ },
46
+ margin: "dense",
47
+ label: pluginKindLabel,
48
+ pluginTypes: pluginTypes,
49
+ disabled: isLoading,
50
+ value: pendingSelection ? pendingSelection : value.selection,
51
+ InputProps: {
52
+ readOnly: isReadonly
53
+ },
54
+ error: !!error,
55
+ helperText: error?.message,
56
+ onChange: onSelectionChange
57
+ }),
58
+ /*#__PURE__*/ _jsx(Button, {
59
+ variant: "contained",
60
+ sx: {
61
+ marginTop: 1.5,
62
+ marginBottom: 1.5,
63
+ paddingTop: 0.5,
64
+ marginLeft: 'auto'
65
+ },
66
+ startIcon: /*#__PURE__*/ _jsx(Reload, {}),
67
+ onClick: ()=>onSpecChange(value.spec),
68
+ children: "Run Query"
69
+ })
70
+ ]
50
71
  }),
51
72
  /*#__PURE__*/ _jsx(ErrorBoundary, {
52
73
  FallbackComponent: ErrorAlert,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"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 { Box } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { PluginKindSelect } from '../PluginKindSelect';\nimport { PluginSpecEditor } from '../PluginSpecEditor';\nimport { PluginEditorProps, usePluginEditor } from './plugin-editor-api';\n\n/**\n * A combination `PluginKindSelect` and `PluginSpecEditor` component. This is meant for editing the `plugin` property\n * that's common in our JSON specs where a user selects a plugin `kind` and then edits the `spec` via that plugin's\n * editor component. It takes care of transitioning from one plugin kind to another \"all at once\" so that when the\n * plugin's kind changes, the spec is also changed at the same time so those options editor components don't see a\n * previous plugin's spec state. If you just want this behavior, but in a different UI layout from this, try the\n * `usePluginEditor` hook that powers this component.\n */\nexport function PluginEditor(props: PluginEditorProps): ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;\n const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);\n return (\n <Box {...others}>\n <PluginKindSelect\n fullWidth={false}\n sx={{ mb: 2, minWidth: 120 }}\n margin=\"dense\"\n label={pluginKindLabel}\n pluginTypes={pluginTypes}\n disabled={isLoading}\n value={pendingSelection ? pendingSelection : value.selection}\n InputProps={{ readOnly: isReadonly }}\n error={!!error}\n helperText={error?.message}\n onChange={onSelectionChange}\n />\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PluginSpecEditor\n pluginSelection={value.selection}\n value={value.spec}\n onChange={onSpecChange}\n isReadonly={isReadonly}\n />\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorAlert","ErrorBoundary","PluginKindSelect","PluginSpecEditor","usePluginEditor","PluginEditor","props","value","pluginTypes","pluginKindLabel","onChange","_","isReadonly","others","pendingSelection","isLoading","error","onSelectionChange","onSpecChange","fullWidth","sx","mb","minWidth","margin","label","disabled","selection","InputProps","readOnly","helperText","message","FallbackComponent","pluginSelection","spec"],"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;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAA4BC,eAAe,QAAQ,sBAAsB;AAEzE;;;;;;;CAOC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,6DAA6D;IAC7D,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAUC,CAAC,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGP;IACpF,MAAM,EAAEQ,gBAAgB,EAAEC,SAAS,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGd,gBAAgBE;IAChG,qBACE,MAACP;QAAK,GAAGc,MAAM;;0BACb,KAACX;gBACCiB,WAAW;gBACXC,IAAI;oBAAEC,IAAI;oBAAGC,UAAU;gBAAI;gBAC3BC,QAAO;gBACPC,OAAOf;gBACPD,aAAaA;gBACbiB,UAAUV;gBACVR,OAAOO,mBAAmBA,mBAAmBP,MAAMmB,SAAS;gBAC5DC,YAAY;oBAAEC,UAAUhB;gBAAW;gBACnCI,OAAO,CAAC,CAACA;gBACTa,YAAYb,OAAOc;gBACnBpB,UAAUO;;0BAEZ,KAAChB;gBAAc8B,mBAAmB/B;0BAChC,cAAA,KAACG;oBACC6B,iBAAiBzB,MAAMmB,SAAS;oBAChCnB,OAAOA,MAAM0B,IAAI;oBACjBvB,UAAUQ;oBACVN,YAAYA;;;;;AAKtB"}
1
+ {"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"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 { Box, Button } from '@mui/material';\nimport Reload from 'mdi-material-ui/Reload';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { PluginKindSelect } from '../PluginKindSelect';\nimport { PluginSpecEditor } from '../PluginSpecEditor';\nimport { PluginEditorProps, usePluginEditor } from './plugin-editor-api';\n\n/**\n * A combination `PluginKindSelect` and `PluginSpecEditor` component. This is meant for editing the `plugin` property\n * that's common in our JSON specs where a user selects a plugin `kind` and then edits the `spec` via that plugin's\n * editor component. It takes care of transitioning from one plugin kind to another \"all at once\" so that when the\n * plugin's kind changes, the spec is also changed at the same time so those options editor components don't see a\n * previous plugin's spec state. If you just want this behavior, but in a different UI layout from this, try the\n * `usePluginEditor` hook that powers this component.\n */\nexport function PluginEditor(props: PluginEditorProps): ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;\n const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);\n return (\n <Box {...others}>\n <Box sx={{ display: 'flex', flexDirection: 'row' }}>\n <PluginKindSelect\n fullWidth={false}\n sx={{ mb: 2, minWidth: 120 }}\n margin=\"dense\"\n label={pluginKindLabel}\n pluginTypes={pluginTypes}\n disabled={isLoading}\n value={pendingSelection ? pendingSelection : value.selection}\n InputProps={{ readOnly: isReadonly }}\n error={!!error}\n helperText={error?.message}\n onChange={onSelectionChange}\n />\n\n <Button\n variant=\"contained\"\n sx={{ marginTop: 1.5, marginBottom: 1.5, paddingTop: 0.5, marginLeft: 'auto' }}\n startIcon={<Reload />}\n onClick={() => onSpecChange(value.spec)}\n >\n Run Query\n </Button>\n </Box>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PluginSpecEditor\n pluginSelection={value.selection}\n value={value.spec}\n onChange={onSpecChange}\n isReadonly={isReadonly}\n />\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","Button","Reload","ErrorAlert","ErrorBoundary","PluginKindSelect","PluginSpecEditor","usePluginEditor","PluginEditor","props","value","pluginTypes","pluginKindLabel","onChange","_","isReadonly","others","pendingSelection","isLoading","error","onSelectionChange","onSpecChange","sx","display","flexDirection","fullWidth","mb","minWidth","margin","label","disabled","selection","InputProps","readOnly","helperText","message","variant","marginTop","marginBottom","paddingTop","marginLeft","startIcon","onClick","spec","FallbackComponent","pluginSelection"],"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;;AAEjC,SAASA,GAAG,EAAEC,MAAM,QAAQ,gBAAgB;AAC5C,OAAOC,YAAY,yBAAyB;AAC5C,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAA4BC,eAAe,QAAQ,sBAAsB;AAEzE;;;;;;;CAOC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,6DAA6D;IAC7D,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAUC,CAAC,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGP;IACpF,MAAM,EAAEQ,gBAAgB,EAAEC,SAAS,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGd,gBAAgBE;IAChG,qBACE,MAACT;QAAK,GAAGgB,MAAM;;0BACb,MAAChB;gBAAIsB,IAAI;oBAAEC,SAAS;oBAAQC,eAAe;gBAAM;;kCAC/C,KAACnB;wBACCoB,WAAW;wBACXH,IAAI;4BAAEI,IAAI;4BAAGC,UAAU;wBAAI;wBAC3BC,QAAO;wBACPC,OAAOjB;wBACPD,aAAaA;wBACbmB,UAAUZ;wBACVR,OAAOO,mBAAmBA,mBAAmBP,MAAMqB,SAAS;wBAC5DC,YAAY;4BAAEC,UAAUlB;wBAAW;wBACnCI,OAAO,CAAC,CAACA;wBACTe,YAAYf,OAAOgB;wBACnBtB,UAAUO;;kCAGZ,KAACnB;wBACCmC,SAAQ;wBACRd,IAAI;4BAAEe,WAAW;4BAAKC,cAAc;4BAAKC,YAAY;4BAAKC,YAAY;wBAAO;wBAC7EC,yBAAW,KAACvC;wBACZwC,SAAS,IAAMrB,aAAaX,MAAMiC,IAAI;kCACvC;;;;0BAKH,KAACvC;gBAAcwC,mBAAmBzC;0BAChC,cAAA,KAACG;oBACCuC,iBAAiBnC,MAAMqB,SAAS;oBAChCrB,OAAOA,MAAMiC,IAAI;oBACjB9B,UAAUQ;oBACVN,YAAYA;;;;;AAKtB"}
@@ -10,7 +10,7 @@ export interface PluginKindSelectProps extends Omit<TextFieldProps, 'value' | 'o
10
10
  /**
11
11
  * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific
12
12
  * plugin types. (e.g. "Show a list of all the Panel plugins", or "Show a list of all the Variable plugins", or "Show
13
- * a list of all the TimeSeriesQuery, TraceQuery, and LogQuery plugins").
13
+ * a list of all the TimeSeriesQuery, TraceQuery, ProfileQuery, and LogQuery plugins").
14
14
  * The value of the select is the kind of the plugin, but you can also listen to the `onPluginTypeChange` event to know
15
15
  * when the user changes the plugin type (it fires at start for the default value.)
16
16
  */
@@ -17,7 +17,7 @@ import { useListPluginMetadata } from '../../runtime';
17
17
  /**
18
18
  * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific
19
19
  * plugin types. (e.g. "Show a list of all the Panel plugins", or "Show a list of all the Variable plugins", or "Show
20
- * a list of all the TimeSeriesQuery, TraceQuery, and LogQuery plugins").
20
+ * a list of all the TimeSeriesQuery, TraceQuery, ProfileQuery, and LogQuery plugins").
21
21
  * The value of the select is the kind of the plugin, but you can also listen to the `onPluginTypeChange` event to know
22
22
  * when the user changes the plugin type (it fires at start for the default value.)
23
23
  */ export const PluginKindSelect = /*#__PURE__*/ forwardRef((props, ref)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PluginKindSelect/PluginKindSelect.tsx"],"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 { MenuItem, TextField, TextFieldProps } from '@mui/material';\nimport { forwardRef, ReactElement, useCallback } from 'react';\nimport { PluginType } from '../../model';\nimport { useListPluginMetadata } from '../../runtime';\nimport { PluginEditorSelection } from '../PluginEditor';\n\nexport interface PluginKindSelectProps extends Omit<TextFieldProps, 'value' | 'onChange' | 'children'> {\n pluginTypes: PluginType[];\n value?: PluginEditorSelection;\n onChange?: (s: PluginEditorSelection) => void;\n}\n\n/**\n * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific\n * plugin types. (e.g. \"Show a list of all the Panel plugins\", or \"Show a list of all the Variable plugins\", or \"Show\n * a list of all the TimeSeriesQuery, TraceQuery, and LogQuery plugins\").\n * The value of the select is the kind of the plugin, but you can also listen to the `onPluginTypeChange` event to know\n * when the user changes the plugin type (it fires at start for the default value.)\n */\nexport const PluginKindSelect = forwardRef((props: PluginKindSelectProps, ref): ReactElement => {\n const { pluginTypes, value: propValue, onChange, ...others } = props;\n const { data, isLoading } = useListPluginMetadata(pluginTypes);\n\n // Pass an empty value while options are still loading so MUI doesn't complain about us using an \"out of range\" value\n const value = !propValue || isLoading ? '' : selectionToOptionValue(propValue);\n\n const handleChange = (event: { target: { value: string } }): void => {\n onChange?.(optionValueToSelection(event.target.value));\n };\n\n const renderValue = useCallback(\n (selected: unknown) => {\n if (selected === '') {\n return '';\n }\n const selectedValue = optionValueToSelection(selected as string);\n return data?.find((v) => v.kind === selectedValue.type && v.spec.name === selectedValue.kind)?.spec.display.name;\n },\n [data]\n );\n\n // TODO: Does this need a loading indicator of some kind?\n return (\n <TextField\n select\n inputRef={ref}\n {...others}\n value={value}\n aria-label={value}\n onChange={handleChange}\n SelectProps={{ renderValue }}\n data-testid=\"plugin-kind-select\"\n >\n {isLoading && <MenuItem value=\"\">Loading...</MenuItem>}\n {data?.map((metadata) => (\n <MenuItem\n data-testid=\"option\"\n key={metadata.kind + metadata.spec.name}\n value={selectionToOptionValue({ type: metadata.kind, kind: metadata.spec.name })}\n >\n {metadata.spec.display.name}\n </MenuItem>\n ))}\n </TextField>\n );\n});\nPluginKindSelect.displayName = 'PluginKindSelect';\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a PluginEditorSelection,\n * returns a string value like `{type}_____{kind}` that can be used as a Select input value.\n * @param selector\n */\nfunction selectionToOptionValue(selector: PluginEditorSelection): string {\n return [selector.type, selector.kind].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{type}_____{kind}`,\n * returns a PluginEditorSelection to be used by the query data model.\n * @param optionValue\n */\nfunction optionValueToSelection(optionValue: string): PluginEditorSelection {\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const type = words[0] as PluginType | undefined;\n const kind = words[1];\n if (type === undefined || kind === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n type,\n kind,\n };\n}\n"],"names":["MenuItem","TextField","forwardRef","useCallback","useListPluginMetadata","PluginKindSelect","props","ref","pluginTypes","value","propValue","onChange","others","data","isLoading","selectionToOptionValue","handleChange","event","optionValueToSelection","target","renderValue","selected","selectedValue","find","v","kind","type","spec","name","display","select","inputRef","aria-label","SelectProps","data-testid","map","metadata","displayName","OPTION_VALUE_DELIMITER","selector","join","optionValue","words","split","undefined","Error"],"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;;AAEjC,SAASA,QAAQ,EAAEC,SAAS,QAAwB,gBAAgB;AACpE,SAASC,UAAU,EAAgBC,WAAW,QAAQ,QAAQ;AAE9D,SAASC,qBAAqB,QAAQ,gBAAgB;AAStD;;;;;;CAMC,GACD,OAAO,MAAMC,iCAAmBH,WAAW,CAACI,OAA8BC;IACxE,MAAM,EAAEC,WAAW,EAAEC,OAAOC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,QAAQ,GAAGN;IAC/D,MAAM,EAAEO,IAAI,EAAEC,SAAS,EAAE,GAAGV,sBAAsBI;IAElD,qHAAqH;IACrH,MAAMC,QAAQ,CAACC,aAAaI,YAAY,KAAKC,uBAAuBL;IAEpE,MAAMM,eAAe,CAACC;QACpBN,WAAWO,uBAAuBD,MAAME,MAAM,CAACV,KAAK;IACtD;IAEA,MAAMW,cAAcjB,YAClB,CAACkB;QACC,IAAIA,aAAa,IAAI;YACnB,OAAO;QACT;QACA,MAAMC,gBAAgBJ,uBAAuBG;QAC7C,OAAOR,MAAMU,KAAK,CAACC,IAAMA,EAAEC,IAAI,KAAKH,cAAcI,IAAI,IAAIF,EAAEG,IAAI,CAACC,IAAI,KAAKN,cAAcG,IAAI,GAAGE,KAAKE,QAAQD;IAC9G,GACA;QAACf;KAAK;IAGR,yDAAyD;IACzD,qBACE,MAACZ;QACC6B,MAAM;QACNC,UAAUxB;QACT,GAAGK,MAAM;QACVH,OAAOA;QACPuB,cAAYvB;QACZE,UAAUK;QACViB,aAAa;YAAEb;QAAY;QAC3Bc,eAAY;;YAEXpB,2BAAa,KAACd;gBAASS,OAAM;0BAAG;;YAChCI,MAAMsB,IAAI,CAACC,yBACV,KAACpC;oBACCkC,eAAY;oBAEZzB,OAAOM,uBAAuB;wBAAEW,MAAMU,SAASX,IAAI;wBAAEA,MAAMW,SAAST,IAAI,CAACC,IAAI;oBAAC;8BAE7EQ,SAAST,IAAI,CAACE,OAAO,CAACD,IAAI;mBAHtBQ,SAASX,IAAI,GAAGW,SAAST,IAAI,CAACC,IAAI;;;AAQjD,GAAG;AACHvB,iBAAiBgC,WAAW,GAAG;AAE/B,kDAAkD;AAClD,MAAMC,yBAAyB;AAE/B;;;;CAIC,GACD,SAASvB,uBAAuBwB,QAA+B;IAC7D,OAAO;QAACA,SAASb,IAAI;QAAEa,SAASd,IAAI;KAAC,CAACe,IAAI,CAACF;AAC7C;AAEA;;;;CAIC,GACD,SAASpB,uBAAuBuB,WAAmB;IACjD,MAAMC,QAAQD,YAAYE,KAAK,CAACL;IAChC,MAAMZ,OAAOgB,KAAK,CAAC,EAAE;IACrB,MAAMjB,OAAOiB,KAAK,CAAC,EAAE;IACrB,IAAIhB,SAASkB,aAAanB,SAASmB,WAAW;QAC5C,MAAM,IAAIC,MAAM;IAClB;IACA,OAAO;QACLnB;QACAD;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/components/PluginKindSelect/PluginKindSelect.tsx"],"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 { MenuItem, TextField, TextFieldProps } from '@mui/material';\nimport { forwardRef, ReactElement, useCallback } from 'react';\nimport { PluginType } from '../../model';\nimport { useListPluginMetadata } from '../../runtime';\nimport { PluginEditorSelection } from '../PluginEditor';\n\nexport interface PluginKindSelectProps extends Omit<TextFieldProps, 'value' | 'onChange' | 'children'> {\n pluginTypes: PluginType[];\n value?: PluginEditorSelection;\n onChange?: (s: PluginEditorSelection) => void;\n}\n\n/**\n * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific\n * plugin types. (e.g. \"Show a list of all the Panel plugins\", or \"Show a list of all the Variable plugins\", or \"Show\n * a list of all the TimeSeriesQuery, TraceQuery, ProfileQuery, and LogQuery plugins\").\n * The value of the select is the kind of the plugin, but you can also listen to the `onPluginTypeChange` event to know\n * when the user changes the plugin type (it fires at start for the default value.)\n */\nexport const PluginKindSelect = forwardRef((props: PluginKindSelectProps, ref): ReactElement => {\n const { pluginTypes, value: propValue, onChange, ...others } = props;\n const { data, isLoading } = useListPluginMetadata(pluginTypes);\n\n // Pass an empty value while options are still loading so MUI doesn't complain about us using an \"out of range\" value\n const value = !propValue || isLoading ? '' : selectionToOptionValue(propValue);\n\n const handleChange = (event: { target: { value: string } }): void => {\n onChange?.(optionValueToSelection(event.target.value));\n };\n\n const renderValue = useCallback(\n (selected: unknown) => {\n if (selected === '') {\n return '';\n }\n const selectedValue = optionValueToSelection(selected as string);\n return data?.find((v) => v.kind === selectedValue.type && v.spec.name === selectedValue.kind)?.spec.display.name;\n },\n [data]\n );\n\n // TODO: Does this need a loading indicator of some kind?\n return (\n <TextField\n select\n inputRef={ref}\n {...others}\n value={value}\n aria-label={value}\n onChange={handleChange}\n SelectProps={{ renderValue }}\n data-testid=\"plugin-kind-select\"\n >\n {isLoading && <MenuItem value=\"\">Loading...</MenuItem>}\n {data?.map((metadata) => (\n <MenuItem\n data-testid=\"option\"\n key={metadata.kind + metadata.spec.name}\n value={selectionToOptionValue({ type: metadata.kind, kind: metadata.spec.name })}\n >\n {metadata.spec.display.name}\n </MenuItem>\n ))}\n </TextField>\n );\n});\nPluginKindSelect.displayName = 'PluginKindSelect';\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a PluginEditorSelection,\n * returns a string value like `{type}_____{kind}` that can be used as a Select input value.\n * @param selector\n */\nfunction selectionToOptionValue(selector: PluginEditorSelection): string {\n return [selector.type, selector.kind].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{type}_____{kind}`,\n * returns a PluginEditorSelection to be used by the query data model.\n * @param optionValue\n */\nfunction optionValueToSelection(optionValue: string): PluginEditorSelection {\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const type = words[0] as PluginType | undefined;\n const kind = words[1];\n if (type === undefined || kind === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n type,\n kind,\n };\n}\n"],"names":["MenuItem","TextField","forwardRef","useCallback","useListPluginMetadata","PluginKindSelect","props","ref","pluginTypes","value","propValue","onChange","others","data","isLoading","selectionToOptionValue","handleChange","event","optionValueToSelection","target","renderValue","selected","selectedValue","find","v","kind","type","spec","name","display","select","inputRef","aria-label","SelectProps","data-testid","map","metadata","displayName","OPTION_VALUE_DELIMITER","selector","join","optionValue","words","split","undefined","Error"],"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;;AAEjC,SAASA,QAAQ,EAAEC,SAAS,QAAwB,gBAAgB;AACpE,SAASC,UAAU,EAAgBC,WAAW,QAAQ,QAAQ;AAE9D,SAASC,qBAAqB,QAAQ,gBAAgB;AAStD;;;;;;CAMC,GACD,OAAO,MAAMC,iCAAmBH,WAAW,CAACI,OAA8BC;IACxE,MAAM,EAAEC,WAAW,EAAEC,OAAOC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,QAAQ,GAAGN;IAC/D,MAAM,EAAEO,IAAI,EAAEC,SA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,OAAOgB,KAAK,CAAC,EAAE;IACrB,MAAMjB,OAAOiB,KAAK,CAAC,EAAE;IACrB,IAAIhB,SAASkB,aAAanB,SAASmB,WAAW;QAC5C,MAAM,IAAIC,MAAM;IAClB;IACA,OAAO;QACLnB;QACAD;IACF;AACF"}
@@ -6,5 +6,6 @@ export * from './plugin-base';
6
6
  export * from './plugin-loading';
7
7
  export * from './time-series-queries';
8
8
  export * from './trace-queries';
9
+ export * from './profile-queries';
9
10
  export * from './variables';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
@@ -18,6 +18,7 @@ export * from './plugin-base';
18
18
  export * from './plugin-loading';
19
19
  export * from './time-series-queries';
20
20
  export * from './trace-queries';
21
+ export * from './profile-queries';
21
22
  export * from './variables';
22
23
 
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.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\nexport * from './datasource';\nexport * from './legend';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './variables';\n"],"names":[],"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;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/model/index.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\nexport * from './datasource';\nexport * from './legend';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\n"],"names":[],"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;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc"}
@@ -4,6 +4,7 @@ import { PanelPlugin } from './panels';
4
4
  import { Plugin } from './plugin-base';
5
5
  import { TimeSeriesQueryPlugin } from './time-series-queries';
6
6
  import { TraceQueryPlugin } from './trace-queries';
7
+ import { ProfileQueryPlugin } from './profile-queries';
7
8
  import { VariablePlugin } from './variables';
8
9
  import { ExplorePlugin } from './explore';
9
10
  export interface PluginModuleSpec {
@@ -56,6 +57,7 @@ export interface SupportedPlugins {
56
57
  Panel: PanelPlugin;
57
58
  TimeSeriesQuery: TimeSeriesQueryPlugin;
58
59
  TraceQuery: TraceQueryPlugin;
60
+ ProfileQuery: ProfileQueryPlugin;
59
61
  Datasource: DatasourcePlugin;
60
62
  Explore: ExplorePlugin;
61
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC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EG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;KAEtB,CAAC,IAAI,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK;CAC3F,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,IAAI,SAAS,UAAU,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAEnF;;GAEG;AACH,KAAK,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/plugins.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 { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n"],"names":[],"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;AAiFjC,WAAuH"}
1
+ {"version":3,"sources":["../../src/model/plugins.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 { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n"],"names":[],"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;AAmFjC,WAAuH"}
@@ -0,0 +1,19 @@
1
+ import { Query, QueryKey } from '@tanstack/react-query';
2
+ import { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/core';
3
+ import { DatasourceStore } from '../runtime';
4
+ import { Plugin } from './plugin-base';
5
+ /**
6
+ * A plugin for running profile queries.
7
+ */
8
+ export interface ProfileQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
9
+ getProfileData: (spec: Spec, ctx: ProfileQueryContext) => Promise<ProfileData>;
10
+ }
11
+ /**
12
+ * Context available to ProfileQuery plugins at runtime.
13
+ */
14
+ export interface ProfileQueryContext {
15
+ datasourceStore: DatasourceStore;
16
+ absoluteTimeRange?: AbsoluteTimeRange;
17
+ }
18
+ export type ProfileDataQuery = Query<ProfileData, unknown, ProfileData, QueryKey>;
19
+ //# sourceMappingURL=profile-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-queries.d.ts","sourceRoot":"","sources":["../../src/model/profile-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC1E,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CAChF;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=profile-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/profile-queries.ts"],"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 { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/core';\nimport { DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * A plugin for running profile queries.\n */\nexport interface ProfileQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getProfileData: (spec: Spec, ctx: ProfileQueryContext) => Promise<ProfileData>;\n}\n\n/**\n * Context available to ProfileQuery plugins at runtime.\n */\nexport interface ProfileQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n}\n\nexport type ProfileDataQuery = Query<ProfileData, unknown, ProfileData, QueryKey>;\n"],"names":[],"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;AAsBjC,WAAkF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAoC,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AAKxE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,6DAA+D,CAAC;AAE/F,wBAAgB,qBAAqB,IAAI,sBAAsB,CAM9D;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAqBzG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAqEjF"}
1
+ {"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAoC,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AAMxE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,6DAA+D,CAAC;AAE/F,wBAAgB,qBAAqB,IAAI,sBAAsB,CAM9D;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAqBzG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CA6EjF"}
@@ -14,6 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { createContext, useCallback, useContext, useMemo } from 'react';
15
15
  import { useTimeSeriesQueries } from '../time-series-queries';
16
16
  import { useTraceQueries } from '../trace-queries';
17
+ import { useProfileQueries } from '../profile-queries';
17
18
  import { useUsageMetrics } from '../UsageMetricsProvider';
18
19
  import { transformQueryResults, useQueryType } from './model';
19
20
  export const DataQueriesContext = /*#__PURE__*/ createContext(undefined);
@@ -59,17 +60,22 @@ export function DataQueriesProvider(props) {
59
60
  const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);
60
61
  const traceQueries = queryDefinitions.filter((definition)=>definition.kind === 'TraceQuery');
61
62
  const traceResults = useTraceQueries(traceQueries);
63
+ const profileQueries = queryDefinitions.filter((definition)=>definition.kind === 'ProfileQuery');
64
+ const profileResults = useProfileQueries(profileQueries);
62
65
  const refetchAll = useCallback(()=>{
63
66
  timeSeriesResults.forEach((result)=>result.refetch());
64
67
  traceResults.forEach((result)=>result.refetch());
68
+ profileResults.forEach((result)=>result.refetch());
65
69
  }, [
66
70
  timeSeriesResults,
67
- traceResults
71
+ traceResults,
72
+ profileResults
68
73
  ]);
69
74
  const ctx = useMemo(()=>{
70
75
  const mergedQueryResults = [
71
76
  ...transformQueryResults(timeSeriesResults, timeSeriesQueries),
72
- ...transformQueryResults(traceResults, traceQueries)
77
+ ...transformQueryResults(traceResults, traceQueries),
78
+ ...transformQueryResults(profileResults, profileQueries)
73
79
  ];
74
80
  if (queryOptions?.enabled) {
75
81
  for (const result of mergedQueryResults){
@@ -94,6 +100,8 @@ export function DataQueriesProvider(props) {
94
100
  timeSeriesResults,
95
101
  traceQueries,
96
102
  traceResults,
103
+ profileQueries,
104
+ profileResults,
97
105
  refetchAll,
98
106
  queryOptions?.enabled,
99
107
  usageMetrics
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"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 { createContext, ReactElement, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport { useTraceQueries, TraceQueryDefinition } from '../trace-queries';\n\nimport { useUsageMetrics } from '../UsageMetricsProvider';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n useQueryType,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext(): DataQueriesContextType {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult?.definition?.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition?.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n const filteredCtx = {\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n\n return filteredCtx;\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps): ReactElement {\n const { definitions, options, children, queryOptions } = props;\n\n // Returns a query kind, for example \"TimeSeriesQuery\" = getQueryType(\"PrometheusTimeSeriesQuery\")\n const getQueryType = useQueryType();\n\n const queryDefinitions = definitions.map((definition) => {\n const type = getQueryType(definition.kind);\n return {\n kind: type,\n spec: {\n plugin: definition,\n },\n };\n });\n\n const usageMetrics = useUsageMetrics();\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);\n const traceQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TraceQuery'\n ) as TraceQueryDefinition[];\n const traceResults = useTraceQueries(traceQueries);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n traceResults.forEach((result) => result.refetch());\n }, [timeSeriesResults, traceResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [\n ...transformQueryResults(timeSeriesResults, timeSeriesQueries),\n ...transformQueryResults(traceResults, traceQueries),\n ];\n\n if (queryOptions?.enabled) {\n for (const result of mergedQueryResults) {\n if (!result.isLoading && !result.isFetching && !result.error) {\n usageMetrics.markQuery(result.definition, 'success');\n } else if (result.error) {\n usageMetrics.markQuery(result.definition, 'error');\n } else {\n usageMetrics.markQuery(result.definition, 'pending');\n }\n }\n }\n\n return {\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [\n timeSeriesQueries,\n timeSeriesResults,\n traceQueries,\n traceResults,\n refetchAll,\n queryOptions?.enabled,\n usageMetrics,\n ]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","useTraceQueries","useUsageMetrics","transformQueryResults","useQueryType","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryResults","queryResults","filter","queryResult","definition","kind","filteredErrors","errors","index","filteredCtx","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","queryOptions","getQueryType","queryDefinitions","map","type","spec","plugin","usageMetrics","timeSeriesQueries","timeSeriesResults","traceQueries","traceRes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AAmBvB,IAAI,CAAC,CAACC,SAAWA,OAAOF,UAAU;YACjEG,WAAWqB,mBAAmBvB,IAAI,CAAC,CAACC,SAAWA,OAAOC,SAAS;YAC/DC;YACAP,QAAQ2B,mBAAmBX,GAAG,CAAC,CAACX,SAAWA,OAAOwB,KAAK;QACzD;IACF,GAAG;QACDR;QACAC;QACAC;QACAC;QACAjB;QACAM,cAAce;QACdR;KACD;IAED,qBAAO,KAAClC,mBAAmB6C,QAAQ;QAACC,OAAO3C;kBAAMuB;;AACnD"}
1
+ {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"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 { createContext, ReactElement, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport { useTraceQueries, TraceQueryDefinition } from '../trace-queries';\nimport { useProfileQueries, ProfileQueryDefinition } from '../profile-queries';\n\nimport { useUsageMetrics } from '../UsageMetricsProvider';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n useQueryType,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext(): DataQueriesContextType {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult?.definition?.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition?.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n const filteredCtx = {\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n\n return filteredCtx;\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps): ReactElement {\n const { definitions, options, children, queryOptions } = props;\n\n // Returns a query kind, for example \"TimeSeriesQuery\" = getQueryType(\"PrometheusTimeSeriesQuery\")\n const getQueryType = useQueryType();\n\n const queryDefinitions = definitions.map((definition) => {\n const type = getQueryType(definition.kind);\n return {\n kind: type,\n spec: {\n plugin: definition,\n },\n };\n });\n\n const usageMetrics = useUsageMetrics();\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);\n const traceQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TraceQuery'\n ) as TraceQueryDefinition[];\n const traceResults = useTraceQueries(traceQueries);\n const profileQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'ProfileQuery'\n ) as ProfileQueryDefinition[];\n const profileResults = useProfileQueries(profileQueries);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n traceResults.forEach((result) => result.refetch());\n profileResults.forEach((result) => result.refetch());\n }, [timeSeriesResults, traceResults, profileResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [\n ...transformQueryResults(timeSeriesResults, timeSeriesQueries),\n ...transformQueryResults(traceResults, traceQueries),\n ...transformQueryResults(profileResults, profileQueries),\n ];\n\n if (queryOptions?.enabled) {\n for (const result of mergedQueryResults) {\n if (!result.isLoading && !result.isFetching && !result.error) {\n usageMetrics.markQuery(result.definition, 'success');\n } else if (result.error) {\n usageMetrics.markQuery(result.definition, 'error');\n } else {\n usageMetrics.markQuery(result.definition, 'pending');\n }\n }\n }\n\n return {\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [\n timeSeriesQueries,\n timeSeriesResults,\n traceQueries,\n traceResults,\n profileQueries,\n profileResults,\n refetchAll,\n queryOptions?.enabled,\n usageMetrics,\n ]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","useTraceQueries","useProfileQueries","useUsageMetrics","transformQueryResults","useQueryType","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryResults","queryResults","filter","queryResult","definition","kind","filteredErrors","errors","index","filteredCtx","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","queryOptions","getQueryType","queryDefinitions","map","type","spec","plugin","usageMetrics","timeSeriesQueries","timeSeriesResults","traceQueries","traceResults","profileQueries","profileResults","forEach","refetch","mergedQueryResults","enabled","error","markQuery","Provider","value"],"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;;AAEjC,SAASA,aAAa,EAAgBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAEtF,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,eAAe,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,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC;IAC1F,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,aAAa,IAAI;IACzC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,CAW5G;AAED,wBAAgB,YAAY,IAAI,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAkEzE"}
@@ -31,11 +31,15 @@ export function useQueryType() {
31
31
  const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata([
32
32
  'TraceQuery'
33
33
  ]);
34
+ const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = useListPluginMetadata([
35
+ 'ProfileQuery'
36
+ ]);
34
37
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
35
38
  const queryTypeMap = useMemo(()=>{
36
39
  const map = {
37
40
  TimeSeriesQuery: [],
38
- TraceQuery: []
41
+ TraceQuery: [],
42
+ ProfileQuery: []
39
43
  };
40
44
  if (timeSeriesQueryPlugins) {
41
45
  timeSeriesQueryPlugins.forEach((plugin)=>{
@@ -47,10 +51,16 @@ export function useQueryType() {
47
51
  map[plugin.kind]?.push(plugin.spec.name);
48
52
  });
49
53
  }
54
+ if (profileQueryPlugins) {
55
+ profileQueryPlugins.forEach((plugin)=>{
56
+ map[plugin.kind]?.push(plugin.spec.name);
57
+ });
58
+ }
50
59
  return map;
51
60
  }, [
52
61
  timeSeriesQueryPlugins,
53
- traceQueryPlugins
62
+ traceQueryPlugins,
63
+ profileQueryPlugins
54
64
  ]);
55
65
  const getQueryType = useCallback((pluginKind)=>{
56
66
  const isLoading = (pluginKind)=>{
@@ -59,8 +69,10 @@ export function useQueryType() {
59
69
  return isTimeSeriesQueryLoading;
60
70
  case 'TempoTraceQuery':
61
71
  return isTraceQueryPluginLoading;
72
+ case 'PyroscopeProfileQuery':
73
+ return isProfileQueryPluginLoading;
62
74
  }
63
- return isTraceQueryPluginLoading || isTimeSeriesQueryLoading;
75
+ return isTraceQueryPluginLoading || isTimeSeriesQueryLoading || isProfileQueryPluginLoading;
64
76
  };
65
77
  if (isLoading(pluginKind)) {
66
78
  return undefined;
@@ -74,7 +86,8 @@ export function useQueryType() {
74
86
  }, [
75
87
  queryTypeMap,
76
88
  isTimeSeriesQueryLoading,
77
- isTraceQueryPluginLoading
89
+ isTraceQueryPluginLoading,
90
+ isProfileQueryPluginLoading
78
91
  ]);
79
92
  return getQueryType;
80
93
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.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 { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { ReactNode, useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\nexport type QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: ReactNode;\n options?: QueryOptions;\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]): QueryData[] {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata([\n 'TimeSeriesQuery',\n ]);\n const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata(['TraceQuery']);\n\n // For example, `map: {\"TimeSeriesQuery\":[\"PrometheusTimeSeriesQuery\"],\"TraceQuery\":[\"TempoTraceQuery\"]}`\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n TraceQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n\n if (traceQueryPlugins) {\n traceQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n return map;\n }, [timeSeriesQueryPlugins, traceQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n const isLoading = (pluginKind: string): boolean => {\n switch (pluginKind) {\n case 'PrometheusTimeSeriesQuery':\n return isTimeSeriesQueryLoading;\n case 'TempoTraceQuery':\n return isTraceQueryPluginLoading;\n }\n\n return isTraceQueryPluginLoading || isTimeSeriesQueryLoading;\n };\n\n if (isLoading(pluginKind)) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isTimeSeriesQueryLoading, isTraceQueryPluginLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","isTimeSeriesQueryLoading","traceQueryPlugins","isTraceQueryPluginLoading","queryTypeMap","TimeSeriesQuery","TraceQuery","forEach","plugin","kind","push","spec","name","getQueryType","pluginKind","undefined","queryType","includes","Error"],"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,SAAoBA,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AACxD,SAASC,qBAAqB,QAAQ,qBAAqB;AA+B3D,OAAO,SAASC,sBAAsBC,OAAyB,EAAEC,WAA8B;IAC7F,OAAOD,QAAQE,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,KAAK,EAAE,EAAEC;QACnE,OAAO;YACLC,YAAYR,WAAW,CAACO,EAAE;YAC1BL;YACAC;YACAC;YACAC;YACAC;QACF;IACF;AACF;AAEA,OAAO,SAASG;IACd,MAAM,EAAEP,MAAMQ,sBAAsB,EAAEN,WAAWO,wBAAwB,EAAE,GAAGd,sBAAsB;QAClG;KACD;IACD,MAAM,EAAEK,MAAMU,iBAAiB,EAAER,WAAWS,yBAAyB,EAAE,GAAGhB,sBAAsB;QAAC;KAAa;IAE9G,yGAAyG;IACzG,MAAMiB,eAAelB,QAAQ;QAC3B,MAAMK,MAAgC;YACpCc,iBAAiB,EAAE;YACnBC,YAAY,EAAE;QAChB;QAEA,IAAIN,wBAAwB;YAC1BA,uBAAuBO,OAAO,CAAC,CAACC;gBAC9BjB,GAAG,CAACiB,OAAOC,IAAI,CAAC,EAAEC,KAAKF,OAAOG,IAAI,CAACC,IAAI;YACzC;QACF;QAEA,IAAIV,mBAAmB;YACrBA,kBAAkBK,OAAO,CAAC,CAACC;gBACzBjB,GAAG,CAACiB,OAAOC,IAAI,CAAC,EAAEC,KAAKF,OAAOG,IAAI,CAACC,IAAI;YACzC;QACF;QACA,OAAOrB;IACT,GAAG;QAACS;QAAwBE;KAAkB;IAE9C,MAAMW,eAAe5B,YACnB,CAAC6B;QACC,MAAMpB,YAAY,CAACoB;YACjB,OAAQA;gBACN,KAAK;oBACH,OAAOb;gBACT,KAAK;oBACH,OAAOE;YACX;YAEA,OAAOA,6BAA6BF;QACtC;QAEA,IAAIP,UAAUoB,aAAa;YACzB,OAAOC;QACT;QAEA,IAAK,MAAMC,aAAaZ,aAAc;YACpC,IAAIA,YAAY,CAACY,UAAU,EAAEC,SAASH,aAAa;gBACjD,OAAOE;YACT;QACF;QAEA,MAAM,IAAIE,MAAM,CAAC,oCAAoC,EAAEJ,YAAY;IACrE,GACA;QAACV;QAAcH;QAA0BE;KAA0B;IAGrE,OAAOU;AACT"}
1
+ {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/model.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 { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { ReactNode, useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\nexport type QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: ReactNode;\n options?: QueryOptions;\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]): QueryData[] {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata([\n 'TimeSeriesQuery',\n ]);\n const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata(['TraceQuery']);\n const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = useListPluginMetadata(['ProfileQuery']);\n\n // For example, `map: {\"TimeSeriesQuery\":[\"PrometheusTimeSeriesQuery\"],\"TraceQuery\":[\"TempoTraceQuery\"]}`\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n TraceQuery: [],\n ProfileQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n\n if (traceQueryPlugins) {\n traceQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n\n if (profileQueryPlugins) {\n profileQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n return map;\n }, [timeSeriesQueryPlugins, traceQueryPlugins, profileQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n const isLoading = (pluginKind: string): boolean => {\n switch (pluginKind) {\n case 'PrometheusTimeSeriesQuery':\n return isTimeSeriesQueryLoading;\n case 'TempoTraceQuery':\n return isTraceQueryPluginLoading;\n case 'PyroscopeProfileQuery':\n return isProfileQueryPluginLoading;\n }\n\n return isTraceQueryPluginLoading || isTimeSeriesQueryLoading || isProfileQueryPluginLoading;\n };\n\n if (isLoading(pluginKind)) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isTimeSeriesQueryLoading, isTraceQueryPluginLoading, isProfileQueryPluginLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","isTimeSeriesQueryLoading","traceQueryPlugins","isTraceQueryPluginLoading","profileQueryPlugins","isProfileQueryPluginLoading","queryTypeMap","TimeSeriesQuery","TraceQuery","ProfileQuery","forEach","plugin","kind","push","spec","name","getQueryType","pluginKind","undefined","queryType","includes","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAk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AAqB;YACvBA,oBAAoBM,OAAO,CAAC,CAACC;gBAC3BpB,GAAG,CAACoB,OAAOC,IAAI,CAAC,EAAEC,KAAKF,OAAOG,IAAI,CAACC,IAAI;YACzC;QACF;QACA,OAAOxB;IACT,GAAG;QAACS;QAAwBE;QAAmBE;KAAoB;IAEnE,MAAMY,eAAe/B,YACnB,CAACgC;QACC,MAAMvB,YAAY,CAACuB;YACjB,OAAQA;gBACN,KAAK;oBACH,OAAOhB;gBACT,KAAK;oBACH,OAAOE;gBACT,KAAK;oBACH,OAAOE;YACX;YAEA,OAAOF,6BAA6BF,4BAA4BI;QAClE;QAEA,IAAIX,UAAUuB,aAAa;YACzB,OAAOC;QACT;QAEA,IAAK,MAAMC,aAAab,aAAc;YACpC,IAAIA,YAAY,CAACa,UAAU,EAAEC,SAASH,aAAa;gBACjD,OAAOE;YACT;QACF;QAEA,MAAM,IAAIE,MAAM,CAAC,oCAAoC,EAAEJ,YAAY;IACrE,GACA;QAACX;QAAcL;QAA0BE;QAA2BE;KAA4B;IAGlG,OAAOW;AACT"}
@@ -5,6 +5,7 @@ export * from './variables';
5
5
  export * from './TimeRangeProvider';
6
6
  export * from './time-series-queries';
7
7
  export * from './trace-queries';
8
+ export * from './profile-queries';
8
9
  export * from './DataQueriesProvider';
9
10
  export * from './QueryCountProvider';
10
11
  export * from './UsageMetricsProvider';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
@@ -17,6 +17,7 @@ export * from './variables';
17
17
  export * from './TimeRangeProvider';
18
18
  export * from './time-series-queries';
19
19
  export * from './trace-queries';
20
+ export * from './profile-queries';
20
21
  export * from './DataQueriesProvider';
21
22
  export * from './QueryCountProvider';
22
23
  export * from './UsageMetricsProvider';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/index.ts"],"sourcesContent":["// Copyright 2024 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\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './DataQueriesProvider';\nexport * from './QueryCountProvider';\nexport * from './UsageMetricsProvider';\n"],"names":[],"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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB"}
1
+ {"version":3,"sources":["../../src/runtime/index.ts"],"sourcesContent":["// Copyright 2024 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\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './DataQueriesProvider';\nexport * from './QueryCountProvider';\nexport * from './UsageMetricsProvider';\n"],"names":[],"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;AAEjC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB"}
@@ -0,0 +1,10 @@
1
+ import { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ export type ProfileQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'ProfileQuery', PluginSpec>;
4
+ export declare const PROFILE_QUERY_KEY = "ProfileQuery";
5
+ /**
6
+ * Run a profile query using a ProfileQuery plugin and return the results
7
+ * @param definitions: dashboard defintion for a profile query
8
+ */
9
+ export declare function useProfileQueries(definitions: ProfileQueryDefinition[]): Array<UseQueryResult<ProfileData>>;
10
+ //# sourceMappingURL=profile-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/profile-queries.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,MAAM,sBAAsB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAC3G,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,sBAAsB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CA4B3G"}
@@ -0,0 +1,52 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useQueries } from '@tanstack/react-query';
14
+ import { useDatasourceStore } from './datasources';
15
+ import { usePluginRegistry } from './plugin-registry';
16
+ import { useTimeRange } from './TimeRangeProvider';
17
+ export const PROFILE_QUERY_KEY = 'ProfileQuery';
18
+ /**
19
+ * Run a profile query using a ProfileQuery plugin and return the results
20
+ * @param definitions: dashboard defintion for a profile query
21
+ */ export function useProfileQueries(definitions) {
22
+ const { getPlugin } = usePluginRegistry();
23
+ const datasourceStore = useDatasourceStore();
24
+ const { absoluteTimeRange } = useTimeRange();
25
+ const context = {
26
+ datasourceStore,
27
+ absoluteTimeRange
28
+ };
29
+ // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)
30
+ // https://tanstack.com/query/v4/docs/react/reference/useQuery
31
+ return useQueries({
32
+ queries: definitions.map((definition)=>{
33
+ const queryKey = [
34
+ definition,
35
+ datasourceStore,
36
+ absoluteTimeRange
37
+ ]; // `queryKey` watches and reruns `queryFn` if keys in the array change
38
+ const profileQueryKind = definition?.spec?.plugin?.kind;
39
+ return {
40
+ queryKey: queryKey,
41
+ queryFn: async ()=>{
42
+ const plugin = await getPlugin(PROFILE_QUERY_KEY, profileQueryKind);
43
+ const data = await plugin.getProfileData(definition.spec.plugin.spec, context);
44
+ return data;
45
+ },
46
+ structuralSharing: false
47
+ };
48
+ })
49
+ });
50
+ }
51
+
52
+ //# sourceMappingURL=profile-queries.js.map
@@ -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.1",
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.1",
33
- "@perses-dev/core": "0.51.1",
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",