@perses-dev/plugin-system 0.0.0-snapshot-time-zone-selector-946f408 → 0.0.0-snapshot-timeseries-panel-actions-e28c1fe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
- package/dist/cjs/components/PluginEditor/PluginEditor.js +41 -15
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +1 -3
- package/dist/cjs/constants/user-interface-text.js +0 -1
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/model/profile-queries.js +16 -0
- package/dist/cjs/remote/PluginRuntime.js +16 -8
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
- package/dist/cjs/runtime/DataQueriesProvider/model.js +17 -4
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +3 -30
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +1 -5
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -31
- package/dist/cjs/runtime/index.js +1 -0
- package/dist/cjs/runtime/profile-queries.js +65 -0
- package/dist/cjs/test/mock-data.js +23 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +37 -16
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +2 -4
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +0 -1
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +0 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/panels.d.ts +8 -0
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugins.d.ts +2 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/profile-queries.d.ts +19 -0
- package/dist/model/profile-queries.d.ts.map +1 -0
- package/dist/model/profile-queries.js +15 -0
- package/dist/model/profile-queries.js.map +1 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +16 -8
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +17 -4
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +0 -12
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +4 -28
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +0 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +2 -6
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +0 -4
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +1 -29
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/profile-queries.d.ts +10 -0
- package/dist/runtime/profile-queries.d.ts.map +1 -0
- package/dist/runtime/profile-queries.js +52 -0
- package/dist/runtime/profile-queries.js.map +1 -0
- package/dist/test/mock-data.d.ts +2 -1
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +20 -0
- package/dist/test/mock-data.js.map +1 -1
- package/package.json +3 -3
|
@@ -79,7 +79,7 @@ function HTTPSettingsEditor(props) {
|
|
|
79
79
|
const strDirect = 'Direct access';
|
|
80
80
|
const strProxy = 'Proxy';
|
|
81
81
|
// Initialize Proxy mode by default, if neither direct nor proxy mode is selected.
|
|
82
|
-
if (
|
|
82
|
+
if (value.directUrl === undefined && value.proxy === undefined) {
|
|
83
83
|
Object.assign(value, initialSpecProxy);
|
|
84
84
|
}
|
|
85
85
|
// utilitary function used for headers when renaming a property
|
|
@@ -100,32 +100,6 @@ function HTTPSettingsEditor(props) {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
const tabs = [
|
|
103
|
-
{
|
|
104
|
-
label: strDirect,
|
|
105
|
-
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
106
|
-
name: "URL",
|
|
107
|
-
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
108
|
-
...field,
|
|
109
|
-
fullWidth: true,
|
|
110
|
-
label: "URL",
|
|
111
|
-
value: value.directUrl || '',
|
|
112
|
-
error: !!fieldState.error,
|
|
113
|
-
helperText: fieldState.error?.message,
|
|
114
|
-
InputProps: {
|
|
115
|
-
readOnly: isReadonly
|
|
116
|
-
},
|
|
117
|
-
InputLabelProps: {
|
|
118
|
-
shrink: isReadonly ? true : undefined
|
|
119
|
-
},
|
|
120
|
-
onChange: (e)=>{
|
|
121
|
-
field.onChange(e);
|
|
122
|
-
onChange((0, _immer.produce)(value, (draft)=>{
|
|
123
|
-
draft.directUrl = e.target.value;
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
},
|
|
129
103
|
{
|
|
130
104
|
label: strProxy,
|
|
131
105
|
content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
@@ -485,6 +459,32 @@ function HTTPSettingsEditor(props) {
|
|
|
485
459
|
})
|
|
486
460
|
]
|
|
487
461
|
})
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
label: strDirect,
|
|
465
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
466
|
+
name: "URL",
|
|
467
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
468
|
+
...field,
|
|
469
|
+
fullWidth: true,
|
|
470
|
+
label: "URL",
|
|
471
|
+
value: value.directUrl || '',
|
|
472
|
+
error: !!fieldState.error,
|
|
473
|
+
helperText: fieldState.error?.message,
|
|
474
|
+
InputProps: {
|
|
475
|
+
readOnly: isReadonly
|
|
476
|
+
},
|
|
477
|
+
InputLabelProps: {
|
|
478
|
+
shrink: isReadonly ? true : undefined
|
|
479
|
+
},
|
|
480
|
+
onChange: (e)=>{
|
|
481
|
+
field.onChange(e);
|
|
482
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
483
|
+
draft.directUrl = e.target.value;
|
|
484
|
+
}));
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
488
|
}
|
|
489
489
|
];
|
|
490
490
|
// Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
|
|
@@ -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.
|
|
37
|
-
fullWidth: false,
|
|
42
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
38
43
|
sx: {
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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,
|
|
@@ -84,7 +84,6 @@ const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
|
84
84
|
const DEFAULT_HEIGHT = '34px';
|
|
85
85
|
function TimeRangeControls({ heightPx, showTimeRangeSelector = true, showRefreshButton = true, showRefreshInterval = true, showCustomTimeRange, showZoomButtons = true, timePresets }) {
|
|
86
86
|
const { timeRange, setTimeRange, refresh, refreshInterval, setRefreshInterval } = (0, _runtime.useTimeRange)();
|
|
87
|
-
const { timeZone } = (0, _runtime.useTimeZone)();
|
|
88
87
|
const showCustomTimeRangeValue = (0, _runtime.useShowCustomTimeRangeSetting)(showCustomTimeRange);
|
|
89
88
|
const showZoomInOutButtons = (0, _runtime.useShowZoomRangeSetting)(showZoomButtons);
|
|
90
89
|
const timePresetsValue = (0, _runtime.useTimeRangeOptionsSetting)(timePresets);
|
|
@@ -173,8 +172,7 @@ function TimeRangeControls({ heightPx, showTimeRangeSelector = true, showRefresh
|
|
|
173
172
|
value: timeRange,
|
|
174
173
|
onChange: setTimeRange,
|
|
175
174
|
height: height,
|
|
176
|
-
showCustomTimeRange: showCustomTimeRangeValue
|
|
177
|
-
timeZone: timeZone
|
|
175
|
+
showCustomTimeRange: showCustomTimeRangeValue
|
|
178
176
|
}),
|
|
179
177
|
showZoomInOutButtons && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
180
178
|
description: _constants.TOOLTIP_TEXT.zoomOut,
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -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
|
+
});
|
|
@@ -135,36 +135,44 @@ const getPluginRuntime = ()=>{
|
|
|
135
135
|
requiredVersion: '^5.5.0'
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
+
'@perses-dev/core': {
|
|
139
|
+
version: '0.51.0-rc.1',
|
|
140
|
+
lib: ()=>require('@perses-dev/core'),
|
|
141
|
+
shareConfig: {
|
|
142
|
+
singleton: true,
|
|
143
|
+
requiredVersion: '^0.51.0-rc.1'
|
|
144
|
+
}
|
|
145
|
+
},
|
|
138
146
|
'@perses-dev/components': {
|
|
139
|
-
version: '0.51.0-
|
|
147
|
+
version: '0.51.0-rc.1',
|
|
140
148
|
lib: ()=>require('@perses-dev/components'),
|
|
141
149
|
shareConfig: {
|
|
142
150
|
singleton: true,
|
|
143
|
-
requiredVersion: '^0.51.0-rc.
|
|
151
|
+
requiredVersion: '^0.51.0-rc.1'
|
|
144
152
|
}
|
|
145
153
|
},
|
|
146
154
|
'@perses-dev/plugin-system': {
|
|
147
|
-
version: '0.51.0-
|
|
155
|
+
version: '0.51.0-rc.1',
|
|
148
156
|
lib: ()=>require('@perses-dev/plugin-system'),
|
|
149
157
|
shareConfig: {
|
|
150
158
|
singleton: true,
|
|
151
|
-
requiredVersion: '^0.51.0-rc.
|
|
159
|
+
requiredVersion: '^0.51.0-rc.1'
|
|
152
160
|
}
|
|
153
161
|
},
|
|
154
162
|
'@perses-dev/explore': {
|
|
155
|
-
version: '0.51.0-
|
|
163
|
+
version: '0.51.0-rc.1',
|
|
156
164
|
lib: ()=>require('@perses-dev/explore'),
|
|
157
165
|
shareConfig: {
|
|
158
166
|
singleton: true,
|
|
159
|
-
requiredVersion: '^0.51.0-rc.
|
|
167
|
+
requiredVersion: '^0.51.0-rc.1'
|
|
160
168
|
}
|
|
161
169
|
},
|
|
162
170
|
'@perses-dev/dashboards': {
|
|
163
|
-
version: '0.51.0-
|
|
171
|
+
version: '0.51.0-rc.1',
|
|
164
172
|
lib: ()=>require('@perses-dev/dashboards'),
|
|
165
173
|
shareConfig: {
|
|
166
174
|
singleton: true,
|
|
167
|
-
requiredVersion: '^0.51.0-rc.
|
|
175
|
+
requiredVersion: '^0.51.0-rc.1'
|
|
168
176
|
}
|
|
169
177
|
},
|
|
170
178
|
// Below are the shared modules that are used by the plugins, this can be part of the SDK
|
|
@@ -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
|
}
|
|
@@ -35,15 +35,11 @@ _export(exports, {
|
|
|
35
35
|
},
|
|
36
36
|
useTimeRangeContext: function() {
|
|
37
37
|
return useTimeRangeContext;
|
|
38
|
-
},
|
|
39
|
-
useTimeZone: function() {
|
|
40
|
-
return useTimeZone;
|
|
41
38
|
}
|
|
42
39
|
});
|
|
43
40
|
const _jsxruntime = require("react/jsx-runtime");
|
|
44
41
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
45
42
|
const _core = require("@perses-dev/core");
|
|
46
|
-
const _components = require("@perses-dev/components");
|
|
47
43
|
const _refreshinterval = require("./refresh-interval");
|
|
48
44
|
function _getRequireWildcardCache(nodeInterop) {
|
|
49
45
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -97,29 +93,15 @@ function useTimeRangeContext() {
|
|
|
97
93
|
function useTimeRange() {
|
|
98
94
|
return useTimeRangeContext();
|
|
99
95
|
}
|
|
100
|
-
function useTimeZone() {
|
|
101
|
-
const { timeZone, setTimeZone } = useTimeRangeContext();
|
|
102
|
-
return {
|
|
103
|
-
timeZone,
|
|
104
|
-
setTimeZone,
|
|
105
|
-
formatWithUserTimeZone: (date, formatString)=>{
|
|
106
|
-
return (0, _components.formatWithTimeZone)(date, formatString, timeZone);
|
|
107
|
-
},
|
|
108
|
-
dateFormatOptionsWithUserTimeZone: (dateFormatOptions)=>{
|
|
109
|
-
return (0, _components.dateFormatOptionsWithTimeZone)(dateFormatOptions, timeZone);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
96
|
function useSuggestedStepMs(width) {
|
|
114
97
|
const { absoluteTimeRange } = useTimeRange();
|
|
115
98
|
if (width === undefined) return 0;
|
|
116
99
|
return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
|
|
117
100
|
}
|
|
118
101
|
function TimeRangeProvider(props) {
|
|
119
|
-
const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval
|
|
102
|
+
const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval } = props;
|
|
120
103
|
const [localTimeRange, setLocalTimeRange] = (0, _react.useState)(timeRange);
|
|
121
104
|
const [localRefreshInterval, setLocalRefreshInterval] = (0, _react.useState)(refreshInterval);
|
|
122
|
-
const [localTimeZone, setLocalTimeZone] = (0, _react.useState)(timeZone);
|
|
123
105
|
const [refreshCounter, setRefreshCounter] = (0, _react.useState)(0);
|
|
124
106
|
(0, _react.useEffect)(()=>{
|
|
125
107
|
setLocalTimeRange(timeRange);
|
|
@@ -132,11 +114,6 @@ function TimeRangeProvider(props) {
|
|
|
132
114
|
}, [
|
|
133
115
|
refreshInterval
|
|
134
116
|
]);
|
|
135
|
-
(0, _react.useEffect)(()=>{
|
|
136
|
-
setLocalTimeZone(timeZone);
|
|
137
|
-
}, [
|
|
138
|
-
timeZone
|
|
139
|
-
]);
|
|
140
117
|
const refresh = (0, _react.useCallback)(()=>{
|
|
141
118
|
setRefreshCounter((counter)=>counter + 1);
|
|
142
119
|
}, [
|
|
@@ -158,26 +135,22 @@ function TimeRangeProvider(props) {
|
|
|
158
135
|
const absoluteTimeRange = (0, _core.isRelativeTimeRange)(localTimeRange) ? (0, _core.toAbsoluteTimeRange)(localTimeRange) : localTimeRange;
|
|
159
136
|
return {
|
|
160
137
|
timeRange: localTimeRange,
|
|
161
|
-
timeZone: localTimeZone,
|
|
162
138
|
setTimeRange: setTimeRange ?? setLocalTimeRange,
|
|
163
139
|
absoluteTimeRange,
|
|
164
140
|
refresh,
|
|
165
141
|
refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,
|
|
166
142
|
refreshInterval: localRefreshInterval,
|
|
167
143
|
refreshIntervalInMs: refreshIntervalInMs,
|
|
168
|
-
setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval
|
|
169
|
-
setTimeZone: setTimeZone ?? setLocalTimeZone
|
|
144
|
+
setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval
|
|
170
145
|
};
|
|
171
146
|
}, [
|
|
172
147
|
localTimeRange,
|
|
173
|
-
localTimeZone,
|
|
174
148
|
setTimeRange,
|
|
175
149
|
refresh,
|
|
176
150
|
localRefreshInterval,
|
|
177
151
|
refreshCounter,
|
|
178
152
|
refreshIntervalInMs,
|
|
179
|
-
setRefreshInterval
|
|
180
|
-
setTimeZone
|
|
153
|
+
setRefreshInterval
|
|
181
154
|
]);
|
|
182
155
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeContext.Provider, {
|
|
183
156
|
value: ctx,
|
|
@@ -21,7 +21,6 @@ Object.defineProperty(exports, "TimeRangeProviderWithQueryParams", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _core = require("@perses-dev/core");
|
|
25
24
|
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
26
25
|
const _TimeRangeProvider = require("./TimeRangeProvider");
|
|
27
26
|
const _queryparams = require("./query-params");
|
|
@@ -31,17 +30,14 @@ function _interop_require_default(obj) {
|
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
function TimeRangeProviderWithQueryParams(props) {
|
|
34
|
-
const { initialTimeRange, initialRefreshInterval, children
|
|
33
|
+
const { initialTimeRange, initialRefreshInterval, children } = props;
|
|
35
34
|
const { timeRange, setTimeRange } = (0, _queryparams.useTimeRangeParams)(initialTimeRange);
|
|
36
35
|
const { refreshInterval, setRefreshInterval } = (0, _queryparams.useSetRefreshIntervalParams)(initialRefreshInterval);
|
|
37
|
-
const { timeZone, setTimeZone } = (0, _queryparams.useSetTimeZoneParams)(initialTimeZone);
|
|
38
36
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeRangeProvider.TimeRangeProvider, {
|
|
39
37
|
timeRange: timeRange,
|
|
40
38
|
refreshInterval: refreshInterval,
|
|
41
39
|
setTimeRange: setTimeRange,
|
|
42
40
|
setRefreshInterval: setRefreshInterval,
|
|
43
|
-
timeZone: timeZone,
|
|
44
|
-
setTimeZone: setTimeZone,
|
|
45
41
|
children: children
|
|
46
42
|
});
|
|
47
43
|
}
|
|
@@ -45,9 +45,6 @@ _export(exports, {
|
|
|
45
45
|
useSetRefreshIntervalParams: function() {
|
|
46
46
|
return useSetRefreshIntervalParams;
|
|
47
47
|
},
|
|
48
|
-
useSetTimeZoneParams: function() {
|
|
49
|
-
return useSetTimeZoneParams;
|
|
50
|
-
},
|
|
51
48
|
useTimeRangeParams: function() {
|
|
52
49
|
return useTimeRangeParams;
|
|
53
50
|
}
|
|
@@ -224,31 +221,3 @@ function useSetRefreshIntervalParams(initialRefreshInterval) {
|
|
|
224
221
|
setRefreshInterval: setRefreshInterval
|
|
225
222
|
};
|
|
226
223
|
}
|
|
227
|
-
function useSetTimeZoneParams(initialTimeZone) {
|
|
228
|
-
const [query, setQuery] = (0, _usequeryparams.useQueryParams)({
|
|
229
|
-
timeZone: _usequeryparams.StringParam
|
|
230
|
-
}, {
|
|
231
|
-
updateType: 'replaceIn'
|
|
232
|
-
});
|
|
233
|
-
const { timeZone } = query;
|
|
234
|
-
(0, _react.useEffect)(()=>{
|
|
235
|
-
if (!timeZone) {
|
|
236
|
-
setQuery({
|
|
237
|
-
timeZone: initialTimeZone
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}, [
|
|
241
|
-
setQuery,
|
|
242
|
-
timeZone,
|
|
243
|
-
initialTimeZone
|
|
244
|
-
]);
|
|
245
|
-
const setTimeZone = (0, _react.useCallback)((timeZone)=>setQuery({
|
|
246
|
-
timeZone
|
|
247
|
-
}), [
|
|
248
|
-
setQuery
|
|
249
|
-
]);
|
|
250
|
-
return {
|
|
251
|
-
timeZone: timeZone ? timeZone : initialTimeZone,
|
|
252
|
-
setTimeZone: setTimeZone
|
|
253
|
-
};
|
|
254
|
-
}
|
|
@@ -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
|
+
};
|