@perses-dev/pyroscope-plugin 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/__mf/css/async/1339.6763d50b.css +1 -0
- package/__mf/css/async/4758.6763d50b.css +1 -0
- package/__mf/css/async/9633.6763d50b.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/Pyroscope.24cb38f3.js +5 -0
- package/__mf/js/async/1101.380fb9ae.js +73 -0
- package/__mf/js/async/1101.380fb9ae.js.LICENSE.txt +19 -0
- package/__mf/js/async/1339.e58b309f.js +1 -0
- package/__mf/js/async/1964.88ffca96.js +2 -0
- package/__mf/js/async/1964.88ffca96.js.LICENSE.txt +9 -0
- package/__mf/js/async/2002.8fc3eb19.js +1 -0
- package/__mf/js/async/2114.6befeb2d.js +1 -0
- package/__mf/js/async/2292.ed7843fc.js +2 -0
- package/__mf/js/async/2292.ed7843fc.js.LICENSE.txt +24 -0
- package/__mf/js/async/2911.ec166b7f.js +38 -0
- package/__mf/js/async/3224.755c2f09.js +1 -0
- package/__mf/js/async/3431.bc5c0624.js +1 -0
- package/__mf/js/async/3863.dbe40473.js +2 -0
- package/__mf/js/async/3863.dbe40473.js.LICENSE.txt +9 -0
- package/__mf/js/async/3960.a5d41140.js +2 -0
- package/__mf/js/async/3960.a5d41140.js.LICENSE.txt +8 -0
- package/__mf/js/async/3980.f1ef0ece.js +2 -0
- package/__mf/js/async/3980.f1ef0ece.js.LICENSE.txt +9 -0
- package/__mf/js/async/4075.cde93ec7.js +1 -0
- package/__mf/js/async/4238.f154b81c.js +1 -0
- package/__mf/js/async/424.edb69d58.js +1 -0
- package/__mf/js/async/4368.2d817d5d.js +2 -0
- package/__mf/js/async/4368.2d817d5d.js.LICENSE.txt +15 -0
- package/__mf/js/async/4421.d44d1d6f.js +1 -0
- package/__mf/js/async/4556.aabe5dff.js +2 -0
- package/__mf/js/async/4556.aabe5dff.js.LICENSE.txt +9 -0
- package/__mf/js/async/4758.a629b413.js +1 -0
- package/__mf/js/async/5214.8d3dd135.js +1 -0
- package/__mf/js/async/5215.6fd5cc14.js +1 -0
- package/__mf/js/async/5220.d1e40fff.js +10 -0
- package/__mf/js/async/5220.d1e40fff.js.LICENSE.txt +17 -0
- package/__mf/js/async/5358.40b9537e.js +7 -0
- package/__mf/js/async/5358.40b9537e.js.LICENSE.txt +21 -0
- package/__mf/js/async/5409.0df9c301.js +1 -0
- package/__mf/js/async/5790.677172d7.js +1 -0
- package/__mf/js/async/5876.38b119d5.js +2 -0
- package/__mf/js/async/5876.38b119d5.js.LICENSE.txt +21 -0
- package/__mf/js/async/5924.582b0cc4.js +2 -0
- package/__mf/js/async/5924.582b0cc4.js.LICENSE.txt +9 -0
- package/__mf/js/async/5981.9c662ef8.js +2 -0
- package/__mf/js/async/5981.9c662ef8.js.LICENSE.txt +8 -0
- package/__mf/js/async/6292.e30a4c42.js +1 -0
- package/__mf/js/async/6377.f6e824aa.js +2 -0
- package/__mf/js/async/6377.f6e824aa.js.LICENSE.txt +32 -0
- package/__mf/js/async/6770.2f87fe88.js +1 -0
- package/__mf/js/async/694.5e15c44d.js +1 -0
- package/__mf/js/async/7376.c4cd77b0.js +1 -0
- package/__mf/js/async/738.fa73528b.js +1 -0
- package/__mf/js/async/7740.474defbd.js +1 -0
- package/__mf/js/async/8216.be450b83.js +1 -0
- package/__mf/js/async/8488.00c7f348.js +1 -0
- package/__mf/js/async/8930.496019db.js +1 -0
- package/__mf/js/async/9092.cfd47472.js +101 -0
- package/__mf/js/async/9173.5959814f.js +2 -0
- package/__mf/js/async/9173.5959814f.js.LICENSE.txt +19 -0
- package/__mf/js/async/9478.c76fe552.js +2 -0
- package/__mf/js/async/9478.c76fe552.js.LICENSE.txt +9 -0
- package/__mf/js/async/9633.a7997138.js +2 -0
- package/__mf/js/async/9633.a7997138.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_PyroscopeDatasource.76f63abf.js +2 -0
- package/__mf/js/async/__federation_expose_PyroscopeDatasource.76f63abf.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_PyroscopeExplorer.88d5e4fb.js +2 -0
- package/__mf/js/async/__federation_expose_PyroscopeExplorer.88d5e4fb.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js +2 -0
- package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js.LICENSE.txt +9 -0
- package/__mf/js/main.4caf1064.js +5 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/components/AddFilterItem.js +38 -0
- package/lib/cjs/components/DeleteFilterItem.js +42 -0
- package/lib/cjs/components/FilterItem.js +83 -0
- package/lib/cjs/components/Filters.js +106 -0
- package/lib/cjs/components/LabelName.js +59 -0
- package/lib/cjs/components/LabelValue.js +59 -0
- package/lib/cjs/components/Operator.js +45 -0
- package/lib/cjs/components/ProfileTypeSelector.js +57 -0
- package/lib/cjs/components/Service.js +60 -0
- package/lib/cjs/components/index.js +32 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/explore/PyroscopeExplorer.js +90 -0
- package/lib/cjs/explore/index.js +30 -0
- package/lib/cjs/getPluginModule.js +39 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +40 -0
- package/lib/cjs/model/api-types.js +19 -0
- package/lib/cjs/model/index.js +33 -0
- package/lib/cjs/model/profile-query-model.js +16 -0
- package/lib/cjs/model/pyroscope-client.js +94 -0
- package/lib/cjs/model/pyroscope-selectors.js +46 -0
- package/lib/cjs/plugins/PyroscopeDatasourceEditor.js +70 -0
- package/lib/cjs/plugins/index.js +33 -0
- package/lib/cjs/plugins/pyroscope-datasource-types.js +16 -0
- package/lib/cjs/plugins/pyroscope-datasource.js +68 -0
- package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js +41 -0
- package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +114 -0
- package/lib/cjs/plugins/pyroscope-profile-query/get-profile-data.js +201 -0
- package/lib/cjs/plugins/pyroscope-profile-query/index.js +33 -0
- package/lib/cjs/plugins/pyroscope-profile-query/query-editor-model.js +120 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/test/index.js +30 -0
- package/lib/cjs/test/mock-data.js +151 -0
- package/lib/cjs/test/setup-tests.js +17 -0
- package/lib/cjs/utils/types.js +25 -0
- package/lib/cjs/utils/use-query.js +112 -0
- package/lib/components/AddFilterItem.d.ts +6 -0
- package/lib/components/AddFilterItem.d.ts.map +1 -0
- package/lib/components/AddFilterItem.js +25 -0
- package/lib/components/AddFilterItem.js.map +1 -0
- package/lib/components/DeleteFilterItem.d.ts +6 -0
- package/lib/components/DeleteFilterItem.d.ts.map +1 -0
- package/lib/components/DeleteFilterItem.js +29 -0
- package/lib/components/DeleteFilterItem.js.map +1 -0
- package/lib/components/FilterItem.d.ts +11 -0
- package/lib/components/FilterItem.d.ts.map +1 -0
- package/lib/components/FilterItem.js +75 -0
- package/lib/components/FilterItem.js.map +1 -0
- package/lib/components/Filters.d.ts +10 -0
- package/lib/components/Filters.d.ts.map +1 -0
- package/lib/components/Filters.js +98 -0
- package/lib/components/Filters.js.map +1 -0
- package/lib/components/LabelName.d.ts +9 -0
- package/lib/components/LabelName.d.ts.map +1 -0
- package/lib/components/LabelName.js +51 -0
- package/lib/components/LabelName.js.map +1 -0
- package/lib/components/LabelValue.d.ts +10 -0
- package/lib/components/LabelValue.d.ts.map +1 -0
- package/lib/components/LabelValue.js +51 -0
- package/lib/components/LabelValue.js.map +1 -0
- package/lib/components/Operator.d.ts +7 -0
- package/lib/components/Operator.d.ts.map +1 -0
- package/lib/components/Operator.js +37 -0
- package/lib/components/Operator.js.map +1 -0
- package/lib/components/ProfileTypeSelector.d.ts +9 -0
- package/lib/components/ProfileTypeSelector.d.ts.map +1 -0
- package/lib/components/ProfileTypeSelector.js +49 -0
- package/lib/components/ProfileTypeSelector.js.map +1 -0
- package/lib/components/Service.d.ts +9 -0
- package/lib/components/Service.d.ts.map +1 -0
- package/lib/components/Service.js +52 -0
- package/lib/components/Service.js.map +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +17 -0
- package/lib/components/index.js.map +1 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/explore/PyroscopeExplorer.d.ts +3 -0
- package/lib/explore/PyroscopeExplorer.d.ts.map +1 -0
- package/lib/explore/PyroscopeExplorer.js +82 -0
- package/lib/explore/PyroscopeExplorer.js.map +1 -0
- package/lib/explore/index.d.ts +2 -0
- package/lib/explore/index.d.ts.map +1 -0
- package/lib/explore/index.js +15 -0
- package/lib/explore/index.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +28 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/model/api-types.d.ts +82 -0
- package/lib/model/api-types.d.ts.map +1 -0
- package/lib/model/api-types.js +20 -0
- package/lib/model/api-types.js.map +1 -0
- package/lib/model/index.d.ts +5 -0
- package/lib/model/index.d.ts.map +1 -0
- package/lib/model/index.js +18 -0
- package/lib/model/index.js.map +1 -0
- package/lib/model/profile-query-model.d.ts +13 -0
- package/lib/model/profile-query-model.d.ts.map +1 -0
- package/lib/model/profile-query-model.js +17 -0
- package/lib/model/profile-query-model.js.map +1 -0
- package/lib/model/pyroscope-client.d.ts +43 -0
- package/lib/model/pyroscope-client.d.ts.map +1 -0
- package/lib/model/pyroscope-client.js +77 -0
- package/lib/model/pyroscope-client.js.map +1 -0
- package/lib/model/pyroscope-selectors.d.ts +21 -0
- package/lib/model/pyroscope-selectors.d.ts.map +1 -0
- package/lib/model/pyroscope-selectors.js +30 -0
- package/lib/model/pyroscope-selectors.js.map +1 -0
- package/lib/plugins/PyroscopeDatasourceEditor.d.ts +9 -0
- package/lib/plugins/PyroscopeDatasourceEditor.d.ts.map +1 -0
- package/lib/plugins/PyroscopeDatasourceEditor.js +57 -0
- package/lib/plugins/PyroscopeDatasourceEditor.js.map +1 -0
- package/lib/plugins/index.d.ts +5 -0
- package/lib/plugins/index.d.ts.map +1 -0
- package/lib/plugins/index.js +18 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/pyroscope-datasource-types.d.ts +6 -0
- package/lib/plugins/pyroscope-datasource-types.d.ts.map +1 -0
- package/lib/plugins/pyroscope-datasource-types.js +15 -0
- package/lib/plugins/pyroscope-datasource-types.js.map +1 -0
- package/lib/plugins/pyroscope-datasource.d.ts +5 -0
- package/lib/plugins/pyroscope-datasource.d.ts.map +1 -0
- package/lib/plugins/pyroscope-datasource.js +60 -0
- package/lib/plugins/pyroscope-datasource.js.map +1 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.d.ts +14 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.d.ts.map +1 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js +33 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js.map +1 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.d.ts +4 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.d.ts.map +1 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +106 -0
- package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js.map +1 -0
- package/lib/plugins/pyroscope-profile-query/get-profile-data.d.ts +9 -0
- package/lib/plugins/pyroscope-profile-query/get-profile-data.d.ts.map +1 -0
- package/lib/plugins/pyroscope-profile-query/get-profile-data.js +185 -0
- package/lib/plugins/pyroscope-profile-query/get-profile-data.js.map +1 -0
- package/lib/plugins/pyroscope-profile-query/index.d.ts +5 -0
- package/lib/plugins/pyroscope-profile-query/index.d.ts.map +1 -0
- package/lib/plugins/pyroscope-profile-query/index.js +18 -0
- package/lib/plugins/pyroscope-profile-query/index.js.map +1 -0
- package/lib/plugins/pyroscope-profile-query/query-editor-model.d.ts +34 -0
- package/lib/plugins/pyroscope-profile-query/query-editor-model.d.ts.map +1 -0
- package/lib/plugins/pyroscope-profile-query/query-editor-model.js +106 -0
- package/lib/plugins/pyroscope-profile-query/query-editor-model.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/test/index.d.ts +2 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +15 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/mock-data.d.ts +5 -0
- package/lib/test/mock-data.d.ts.map +1 -0
- package/lib/test/mock-data.js +133 -0
- package/lib/test/mock-data.js.map +1 -0
- package/lib/test/setup-tests.d.ts +2 -0
- package/lib/test/setup-tests.d.ts.map +1 -0
- package/lib/test/setup-tests.js +15 -0
- package/lib/test/setup-tests.js.map +1 -0
- package/lib/utils/types.d.ts +8 -0
- package/lib/utils/types.d.ts.map +1 -0
- package/lib/utils/types.js +17 -0
- package/lib/utils/types.js.map +1 -0
- package/lib/utils/use-query.d.ts +9 -0
- package/lib/utils/use-query.d.ts.map +1 -0
- package/lib/utils/use-query.js +87 -0
- package/lib/utils/use-query.js.map +1 -0
- package/mf-manifest.json +455 -0
- package/mf-stats.json +539 -0
- package/package.json +88 -0
package/lib/env.d.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
/// <reference types="@rsbuild/core/types" />
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=env.d.js.map
|
package/lib/env.d.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/env.d.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\n/// <reference types=\"@rsbuild/core/types\" />\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,6CAA6C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PyroscopeExplorer.d.ts","sourceRoot":"","sources":["../../../src/explore/PyroscopeExplorer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAgCrC,wBAAgB,iBAAiB,IAAI,YAAY,CA8BhD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Box, Stack } from '@mui/material';
|
|
15
|
+
import { DataQueriesProvider, MultiQueryEditor } from '@perses-dev/plugin-system';
|
|
16
|
+
import { Panel } from '@perses-dev/dashboards';
|
|
17
|
+
import { useExplorerManagerContext } from '@perses-dev/explore';
|
|
18
|
+
const initialSpec = {
|
|
19
|
+
palette: 'package-name',
|
|
20
|
+
showSettings: true,
|
|
21
|
+
showSeries: true,
|
|
22
|
+
showTable: true,
|
|
23
|
+
showFlameGraph: true
|
|
24
|
+
};
|
|
25
|
+
function FlameGraphPanel({ queries }) {
|
|
26
|
+
return /*#__PURE__*/ _jsx(Panel, {
|
|
27
|
+
panelOptions: {
|
|
28
|
+
hideHeader: true
|
|
29
|
+
},
|
|
30
|
+
definition: {
|
|
31
|
+
kind: 'Panel',
|
|
32
|
+
spec: {
|
|
33
|
+
queries,
|
|
34
|
+
display: {
|
|
35
|
+
name: ''
|
|
36
|
+
},
|
|
37
|
+
plugin: {
|
|
38
|
+
kind: 'FlameChart',
|
|
39
|
+
spec: initialSpec
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function PyroscopeExplorer() {
|
|
46
|
+
const { data: { queries = [] }, setData } = useExplorerManagerContext();
|
|
47
|
+
// map ProfileQueryDefinition to Definition<UnknownSpec>
|
|
48
|
+
const definitions = queries.length ? queries.map((query)=>{
|
|
49
|
+
return {
|
|
50
|
+
kind: query.spec.plugin.kind,
|
|
51
|
+
spec: query.spec.plugin.spec
|
|
52
|
+
};
|
|
53
|
+
}) : [];
|
|
54
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
55
|
+
gap: 2,
|
|
56
|
+
sx: {
|
|
57
|
+
width: '100%'
|
|
58
|
+
},
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ _jsx(MultiQueryEditor, {
|
|
61
|
+
queryTypes: [
|
|
62
|
+
'ProfileQuery'
|
|
63
|
+
],
|
|
64
|
+
onChange: (newQueries)=>setData({
|
|
65
|
+
queries: newQueries
|
|
66
|
+
}),
|
|
67
|
+
queries: queries
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ _jsx(DataQueriesProvider, {
|
|
70
|
+
definitions: definitions,
|
|
71
|
+
children: /*#__PURE__*/ _jsx(Box, {
|
|
72
|
+
height: 980,
|
|
73
|
+
children: /*#__PURE__*/ _jsx(FlameGraphPanel, {
|
|
74
|
+
queries: queries
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=PyroscopeExplorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/explore/PyroscopeExplorer.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 { Box, Stack } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { DataQueriesProvider, MultiQueryEditor } from '@perses-dev/plugin-system';\nimport { Panel } from '@perses-dev/dashboards';\nimport { QueryDefinition } from '@perses-dev/core';\nimport { useExplorerManagerContext } from '@perses-dev/explore';\n\ninterface ProfilesExplorerQueryParams {\n queries?: QueryDefinition[];\n}\n\nconst initialSpec = {\n palette: 'package-name',\n showSettings: true,\n showSeries: true,\n showTable: true,\n showFlameGraph: true,\n};\n\nfunction FlameGraphPanel({ queries }: { queries: QueryDefinition[] }): ReactElement {\n return (\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries, display: { name: '' }, plugin: { kind: 'FlameChart', spec: initialSpec } },\n }}\n />\n );\n}\n\nexport function PyroscopeExplorer(): ReactElement {\n const {\n data: { queries = [] },\n setData,\n } = useExplorerManagerContext<ProfilesExplorerQueryParams>();\n\n // map ProfileQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query: QueryDefinition) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor\n queryTypes={['ProfileQuery']}\n onChange={(newQueries) => setData({ queries: newQueries })}\n queries={queries}\n />\n <DataQueriesProvider definitions={definitions}>\n <Box height={980}>\n <FlameGraphPanel queries={queries} />\n </Box>\n </DataQueriesProvider>\n </Stack>\n );\n}\n"],"names":["Box","Stack","DataQueriesProvider","MultiQueryEditor","Panel","useExplorerManagerContext","initialSpec","palette","showSettings","showSeries","showTable","showFlameGraph","FlameGraphPanel","queries","panelOptions","hideHeader","definition","kind","spec","display","name","plugin","PyroscopeExplorer","data","setData","definitions","length","map","query","gap","sx","width","queryTypes","onChange","newQueries","height"],"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,KAAK,QAAQ,gBAAgB;AAE3C,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAClF,SAASC,KAAK,QAAQ,yBAAyB;AAE/C,SAASC,yBAAyB,QAAQ,sBAAsB;AAMhE,MAAMC,cAAc;IAClBC,SAAS;IACTC,cAAc;IACdC,YAAY;IACZC,WAAW;IACXC,gBAAgB;AAClB;AAEA,SAASC,gBAAgB,EAAEC,OAAO,EAAkC;IAClE,qBACE,KAACT;QACCU,cAAc;YACZC,YAAY;QACd;QACAC,YAAY;YACVC,MAAM;YACNC,MAAM;gBAAEL;gBAASM,SAAS;oBAAEC,MAAM;gBAAG;gBAAGC,QAAQ;oBAAEJ,MAAM;oBAAcC,MAAMZ;gBAAY;YAAE;QAC5F;;AAGN;AAEA,OAAO,SAASgB;IACd,MAAM,EACJC,MAAM,EAAEV,UAAU,EAAE,EAAE,EACtBW,OAAO,EACR,GAAGnB;IAEJ,wDAAwD;IACxD,MAAMoB,cAAcZ,QAAQa,MAAM,GAC9Bb,QAAQc,GAAG,CAAC,CAACC;QACX,OAAO;YACLX,MAAMW,MAAMV,IAAI,CAACG,MAAM,CAACJ,IAAI;YAC5BC,MAAMU,MAAMV,IAAI,CAACG,MAAM,CAACH,IAAI;QAC9B;IACF,KACA,EAAE;IAEN,qBACE,MAACjB;QAAM4B,KAAK;QAAGC,IAAI;YAAEC,OAAO;QAAO;;0BACjC,KAAC5B;gBACC6B,YAAY;oBAAC;iBAAe;gBAC5BC,UAAU,CAACC,aAAeV,QAAQ;wBAAEX,SAASqB;oBAAW;gBACxDrB,SAASA;;0BAEX,KAACX;gBAAoBuB,aAAaA;0BAChC,cAAA,KAACzB;oBAAImC,QAAQ;8BACX,cAAA,KAACvB;wBAAgBC,SAASA;;;;;;AAKpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/explore/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,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 * from './PyroscopeExplorer';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/explore/index.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\nexport * from './PyroscopeExplorer';\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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 packageJson from '../package.json';
|
|
14
|
+
/**
|
|
15
|
+
* Returns the plugin module information from package.json
|
|
16
|
+
*/ export function getPluginModule() {
|
|
17
|
+
const { name, version, perses } = packageJson;
|
|
18
|
+
return {
|
|
19
|
+
kind: 'PluginModule',
|
|
20
|
+
metadata: {
|
|
21
|
+
name,
|
|
22
|
+
version
|
|
23
|
+
},
|
|
24
|
+
spec: perses
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=getPluginModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","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;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index-federation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-federation.d.ts","sourceRoot":"","sources":["../../src/index-federation.ts"],"names":[],"mappings":""}
|
|
@@ -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
|
+
import('./bootstrap');
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index-federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index-federation.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('./bootstrap');\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,MAAM,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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 * from './components';
|
|
14
|
+
export * from './explore';
|
|
15
|
+
export { getPluginModule } from './getPluginModule';
|
|
16
|
+
export * from './model';
|
|
17
|
+
export * from './plugins';
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.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\nexport * from './components';\nexport * from './explore';\nexport { getPluginModule } from './getPluginModule';\nexport * from './model';\nexport * from './plugins';\n"],"names":["getPluginModule"],"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,YAAY;AAC1B,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,UAAU;AACxB,cAAc,YAAY"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request parameters of Pyroscope HTTP API endpoint GET /pyroscope/render
|
|
3
|
+
* https://grafana.com/docs/pyroscope/latest/reference-server-api/#querying-profile-data
|
|
4
|
+
*/
|
|
5
|
+
export interface SearchProfilesParameters {
|
|
6
|
+
query: string;
|
|
7
|
+
/** the start time can be an absolute value (number) or a relative value (string). Ex of relative value : now-15m*/
|
|
8
|
+
from: string | number;
|
|
9
|
+
/** end of the search window, default : now */
|
|
10
|
+
until?: string | number;
|
|
11
|
+
/** format of the returned profiling data, default: json */
|
|
12
|
+
format?: 'json' | 'dot';
|
|
13
|
+
/** maximum number of nodes the resulting flame graph will contain, default: 50 */
|
|
14
|
+
maxNodes?: number;
|
|
15
|
+
groupeBy?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Response of Pyroscope HTTP API endpoint GET /pyroscope/render
|
|
19
|
+
* https://grafana.com/docs/pyroscope/latest/reference-server-api/#query-output
|
|
20
|
+
*/
|
|
21
|
+
export interface SearchProfilesResponse {
|
|
22
|
+
flamebearer: Flamebearer;
|
|
23
|
+
metadata: Metadata;
|
|
24
|
+
timeline: Timeline;
|
|
25
|
+
}
|
|
26
|
+
export interface Flamebearer {
|
|
27
|
+
names: string[];
|
|
28
|
+
levels: number[][];
|
|
29
|
+
numTicks: number;
|
|
30
|
+
maxSelf: number;
|
|
31
|
+
}
|
|
32
|
+
export interface Metadata {
|
|
33
|
+
format: 'single' | 'double';
|
|
34
|
+
spyName: string;
|
|
35
|
+
sampleRate: number;
|
|
36
|
+
units: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Timeline {
|
|
40
|
+
startTime: number;
|
|
41
|
+
samples: number[];
|
|
42
|
+
durationDelta: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/ProfileTypes
|
|
46
|
+
*/
|
|
47
|
+
export type SearchProfileTypesParameters = Record<string, never>;
|
|
48
|
+
/**
|
|
49
|
+
* Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/ProfileTypes
|
|
50
|
+
*/
|
|
51
|
+
export interface SearchProfileTypesResponse {
|
|
52
|
+
profileTypes: ProfileType[];
|
|
53
|
+
}
|
|
54
|
+
export interface ProfileType {
|
|
55
|
+
ID: string;
|
|
56
|
+
name: string;
|
|
57
|
+
sampleType: string;
|
|
58
|
+
sampleUnit: string;
|
|
59
|
+
periodType: string;
|
|
60
|
+
periodUnit: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelNames
|
|
64
|
+
*/
|
|
65
|
+
export type SearchLabelNamesParameters = Record<string, never>;
|
|
66
|
+
/**
|
|
67
|
+
* Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelNames
|
|
68
|
+
*/
|
|
69
|
+
export interface SearchLabelNamesResponse {
|
|
70
|
+
names: string[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelValues
|
|
74
|
+
*/
|
|
75
|
+
export type SearchLabelValuesParameters = Record<string, never>;
|
|
76
|
+
/**
|
|
77
|
+
* Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelValues
|
|
78
|
+
*/
|
|
79
|
+
export interface SearchLabelValuesResponse {
|
|
80
|
+
names: string[];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=api-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../../src/model/api-types.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,mHAAmH;IACnH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Request parameters of Pyroscope HTTP API endpoint GET /pyroscope/render
|
|
15
|
+
* https://grafana.com/docs/pyroscope/latest/reference-server-api/#querying-profile-data
|
|
16
|
+
*/ /**
|
|
17
|
+
* Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelValues
|
|
18
|
+
*/ export { };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=api-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/api-types.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\n/**\n * Request parameters of Pyroscope HTTP API endpoint GET /pyroscope/render\n * https://grafana.com/docs/pyroscope/latest/reference-server-api/#querying-profile-data\n */\nexport interface SearchProfilesParameters {\n query: string;\n /** the start time can be an absolute value (number) or a relative value (string). Ex of relative value : now-15m*/\n from: string | number;\n /** end of the search window, default : now */\n until?: string | number;\n /** format of the returned profiling data, default: json */\n format?: 'json' | 'dot';\n /** maximum number of nodes the resulting flame graph will contain, default: 50 */\n maxNodes?: number;\n groupeBy?: string;\n}\n\n/**\n * Response of Pyroscope HTTP API endpoint GET /pyroscope/render\n * https://grafana.com/docs/pyroscope/latest/reference-server-api/#query-output\n */\nexport interface SearchProfilesResponse {\n flamebearer: Flamebearer;\n metadata: Metadata;\n timeline: Timeline;\n}\n\nexport interface Flamebearer {\n names: string[];\n levels: number[][];\n numTicks: number;\n maxSelf: number;\n}\n\nexport interface Metadata {\n format: 'single' | 'double';\n spyName: string;\n sampleRate: number;\n units: string;\n name: string;\n}\n\nexport interface Timeline {\n startTime: number;\n samples: number[];\n durationDelta: number;\n}\n\n/**\n * Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/ProfileTypes\n */\nexport type SearchProfileTypesParameters = Record<string, never>;\n\n/**\n * Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/ProfileTypes\n */\nexport interface SearchProfileTypesResponse {\n profileTypes: ProfileType[];\n}\n\nexport interface ProfileType {\n ID: string;\n name: string;\n sampleType: string;\n sampleUnit: string;\n periodType: string;\n periodUnit: string;\n}\n\n/**\n * Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelNames\n */\nexport type SearchLabelNamesParameters = Record<string, never>;\n\n/**\n * Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelNames\n */\nexport interface SearchLabelNamesResponse {\n names: string[];\n}\n\n/**\n * Request parameters of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelValues\n */\nexport type SearchLabelValuesParameters = Record<string, never>;\n\n/**\n * Response of Pyroscope HTTP API endpoint POST /querier.v1.QuerierService/LabelValues\n */\nexport interface SearchLabelValuesResponse {\n names: string[];\n}\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;;;CAGC,GAmFD;;CAEC,GACD,WAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 * from './pyroscope-client';
|
|
14
|
+
export * from './pyroscope-selectors';
|
|
15
|
+
export * from './profile-query-model';
|
|
16
|
+
export * from './api-types';
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/index.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\nexport * from './pyroscope-client';\nexport * from './pyroscope-selectors';\nexport * from './profile-query-model';\nexport * from './api-types';\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,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,cAAc"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LabelFilter } from '../utils/types';
|
|
2
|
+
import { PyroscopeDatasourceSelector } from './pyroscope-selectors';
|
|
3
|
+
/**
|
|
4
|
+
* The spec/options for the PyroscopeProfileQuery plugin.
|
|
5
|
+
*/
|
|
6
|
+
export interface PyroscopeProfileQuerySpec {
|
|
7
|
+
datasource?: PyroscopeDatasourceSelector;
|
|
8
|
+
maxNodes?: number;
|
|
9
|
+
profileType: string;
|
|
10
|
+
filters?: LabelFilter[];
|
|
11
|
+
service?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=profile-query-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-query-model.d.ts","sourceRoot":"","sources":["../../../src/model/profile-query-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* The spec/options for the PyroscopeProfileQuery plugin.
|
|
15
|
+
*/ export { };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=profile-query-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/profile-query-model.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 { LabelFilter } from '../utils/types';\nimport { PyroscopeDatasourceSelector } from './pyroscope-selectors';\n/**\n * The spec/options for the PyroscopeProfileQuery plugin.\n */\nexport interface PyroscopeProfileQuerySpec {\n datasource?: PyroscopeDatasourceSelector;\n maxNodes?: number;\n profileType: string;\n filters?: LabelFilter[];\n service?: string;\n}\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;AAIjC;;CAEC,GACD,WAMC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RequestHeaders } from '@perses-dev/core';
|
|
2
|
+
import { DatasourceClient } from '@perses-dev/plugin-system';
|
|
3
|
+
import { SearchProfilesParameters, SearchProfilesResponse, SearchProfileTypesParameters, SearchProfileTypesResponse, SearchLabelNamesParameters, SearchLabelNamesResponse, SearchLabelValuesParameters, SearchLabelValuesResponse } from './api-types';
|
|
4
|
+
interface PyroscopeClientOptions {
|
|
5
|
+
datasourceUrl: string;
|
|
6
|
+
headers?: RequestHeaders;
|
|
7
|
+
}
|
|
8
|
+
export interface PyroscopeClient extends DatasourceClient {
|
|
9
|
+
options: PyroscopeClientOptions;
|
|
10
|
+
searchProfiles(params: SearchProfilesParameters, headers?: RequestHeaders): Promise<SearchProfilesResponse>;
|
|
11
|
+
searchProfileTypes(params: SearchProfileTypesParameters, headers: RequestHeaders, body: Record<string, string | number>): Promise<SearchProfileTypesResponse>;
|
|
12
|
+
searchLabelNames(params: SearchLabelNamesParameters, headers: RequestHeaders, body: Record<string, string | number>): Promise<SearchLabelNamesResponse>;
|
|
13
|
+
searchLabelValues(params: SearchLabelValuesParameters, headers: RequestHeaders, body: Record<string, string | number>): Promise<SearchLabelValuesResponse>;
|
|
14
|
+
searchServices(params: SearchLabelValuesParameters, headers: RequestHeaders): Promise<SearchLabelValuesResponse>;
|
|
15
|
+
}
|
|
16
|
+
export interface QueryOptions {
|
|
17
|
+
datasourceUrl: string;
|
|
18
|
+
headers?: RequestHeaders;
|
|
19
|
+
}
|
|
20
|
+
export declare const executeRequest: <T>(...args: Parameters<typeof global.fetch>) => Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns profiling data.
|
|
23
|
+
*/
|
|
24
|
+
export declare function searchProfiles(params: SearchProfilesParameters, queryOptions: QueryOptions): Promise<SearchProfilesResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a list of all profile types.
|
|
27
|
+
*/
|
|
28
|
+
export declare function searchProfileTypes(params: SearchProfileTypesParameters, queryOptions: QueryOptions, body: Record<string, string | number>): Promise<SearchProfileTypesResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a list of all label names.
|
|
31
|
+
*/
|
|
32
|
+
export declare function searchLabelNames(params: SearchLabelNamesParameters, queryOptions: QueryOptions, body: Record<string, string | number>): Promise<SearchLabelNamesResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a list of all label values for a given label name.
|
|
35
|
+
*/
|
|
36
|
+
export declare function searchLabelValues(params: SearchLabelValuesParameters, queryOptions: QueryOptions, body: Record<string, string | number>): Promise<SearchLabelValuesResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a list of all services.
|
|
39
|
+
* This is a special case of label values where the label name is "service_name".
|
|
40
|
+
*/
|
|
41
|
+
export declare function searchServices(params: SearchLabelValuesParameters, queryOptions: QueryOptions): Promise<SearchLabelValuesResponse>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=pyroscope-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pyroscope-client.d.ts","sourceRoot":"","sources":["../../../src/model/pyroscope-client.ts"],"names":[],"mappings":"AAaA,OAAO,EAAS,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,UAAU,sBAAsB;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,OAAO,EAAE,sBAAsB,CAAC;IAChC,cAAc,CAAC,MAAM,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC5G,kBAAkB,CAChB,MAAM,EAAE,4BAA4B,EACpC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,gBAAgB,CACd,MAAM,EAAE,0BAA0B,EAClC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACrC,iBAAiB,CACf,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,cAAc,CAAC,MAAM,EAAE,2BAA2B,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClH;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,eAAO,MAAM,cAAc,GAAU,CAAC,EAAE,GAAG,MAAM,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAG,OAAO,CAAC,CAAC,CAQ3F,CAAC;AAsCF;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,wBAAwB,EAChC,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,0BAA0B,CAAC,CAOrC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,wBAAwB,CAAC,CAOnC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,2BAA2B,EACnC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAOpC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,2BAA2B,EACnC,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,yBAAyB,CAAC,CAOpC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { fetch } from '@perses-dev/core';
|
|
14
|
+
export const executeRequest = async (...args)=>{
|
|
15
|
+
const response = await fetch(...args);
|
|
16
|
+
try {
|
|
17
|
+
return await response.json();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.error('Invalid response from server', e);
|
|
20
|
+
throw new Error('Invalid response from server');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function fetchWithGet(apiURI, params, queryOptions) {
|
|
24
|
+
const { datasourceUrl, headers = {} } = queryOptions;
|
|
25
|
+
let url = `${datasourceUrl}${apiURI}`;
|
|
26
|
+
if (params) {
|
|
27
|
+
url += '?' + new URLSearchParams(params);
|
|
28
|
+
}
|
|
29
|
+
const init = {
|
|
30
|
+
method: 'GET',
|
|
31
|
+
headers
|
|
32
|
+
};
|
|
33
|
+
return executeRequest(url, init);
|
|
34
|
+
}
|
|
35
|
+
function fetchWithPost(apiURI, params, queryOptions, body) {
|
|
36
|
+
const { datasourceUrl, headers = {} } = queryOptions;
|
|
37
|
+
let url = `${datasourceUrl}${apiURI}`;
|
|
38
|
+
if (params) {
|
|
39
|
+
url += '?' + new URLSearchParams(params);
|
|
40
|
+
}
|
|
41
|
+
const init = {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers,
|
|
44
|
+
body: JSON.stringify(body)
|
|
45
|
+
};
|
|
46
|
+
return executeRequest(url, init);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns profiling data.
|
|
50
|
+
*/ export function searchProfiles(params, queryOptions) {
|
|
51
|
+
return fetchWithGet('/pyroscope/render', params, queryOptions);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns a list of all profile types.
|
|
55
|
+
*/ export function searchProfileTypes(params, queryOptions, body) {
|
|
56
|
+
return fetchWithPost('/querier.v1.QuerierService/ProfileTypes', params, queryOptions, body);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns a list of all label names.
|
|
60
|
+
*/ export function searchLabelNames(params, queryOptions, body) {
|
|
61
|
+
return fetchWithPost('/querier.v1.QuerierService/LabelNames', params, queryOptions, body);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns a list of all label values for a given label name.
|
|
65
|
+
*/ export function searchLabelValues(params, queryOptions, body) {
|
|
66
|
+
return fetchWithPost('/querier.v1.QuerierService/LabelValues', params, queryOptions, body);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns a list of all services.
|
|
70
|
+
* This is a special case of label values where the label name is "service_name".
|
|
71
|
+
*/ export function searchServices(params, queryOptions) {
|
|
72
|
+
return fetchWithPost('/querier.v1.QuerierService/LabelValues', params, queryOptions, {
|
|
73
|
+
name: 'service_name'
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=pyroscope-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/pyroscope-client.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 { fetch, RequestHeaders } from '@perses-dev/core';\nimport { DatasourceClient } from '@perses-dev/plugin-system';\nimport {\n SearchProfilesParameters,\n SearchProfilesResponse,\n SearchProfileTypesParameters,\n SearchProfileTypesResponse,\n SearchLabelNamesParameters,\n SearchLabelNamesResponse,\n SearchLabelValuesParameters,\n SearchLabelValuesResponse,\n} from './api-types';\n\ninterface PyroscopeClientOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface PyroscopeClient extends DatasourceClient {\n options: PyroscopeClientOptions;\n searchProfiles(params: SearchProfilesParameters, headers?: RequestHeaders): Promise<SearchProfilesResponse>;\n searchProfileTypes(\n params: SearchProfileTypesParameters,\n headers: RequestHeaders,\n body: Record<string, string | number>\n ): Promise<SearchProfileTypesResponse>;\n searchLabelNames(\n params: SearchLabelNamesParameters,\n headers: RequestHeaders,\n body: Record<string, string | number>\n ): Promise<SearchLabelNamesResponse>;\n searchLabelValues(\n params: SearchLabelValuesParameters,\n headers: RequestHeaders,\n body: Record<string, string | number>\n ): Promise<SearchLabelValuesResponse>;\n searchServices(params: SearchLabelValuesParameters, headers: RequestHeaders): Promise<SearchLabelValuesResponse>;\n}\n\nexport interface QueryOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport const executeRequest = async <T>(...args: Parameters<typeof global.fetch>): Promise<T> => {\n const response = await fetch(...args);\n try {\n return await response.json();\n } catch (e) {\n console.error('Invalid response from server', e);\n throw new Error('Invalid response from server');\n }\n};\n\nfunction fetchWithGet<T, TResponse>(apiURI: string, params: T | null, queryOptions: QueryOptions): Promise<TResponse> {\n const { datasourceUrl, headers = {} } = queryOptions;\n\n let url = `${datasourceUrl}${apiURI}`;\n if (params) {\n url += '?' + new URLSearchParams(params);\n }\n const init = {\n method: 'GET',\n headers,\n };\n\n return executeRequest<TResponse>(url, init);\n}\n\nfunction fetchWithPost<T, TResponse>(\n apiURI: string,\n params: T | null,\n queryOptions: QueryOptions,\n body: Record<string, string | number>\n): Promise<TResponse> {\n const { datasourceUrl, headers = {} } = queryOptions;\n\n let url = `${datasourceUrl}${apiURI}`;\n if (params) {\n url += '?' + new URLSearchParams(params);\n }\n const init = {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n };\n\n return executeRequest<TResponse>(url, init);\n}\n\n/**\n * Returns profiling data.\n */\nexport function searchProfiles(\n params: SearchProfilesParameters,\n queryOptions: QueryOptions\n): Promise<SearchProfilesResponse> {\n return fetchWithGet<SearchProfilesParameters, SearchProfilesResponse>('/pyroscope/render', params, queryOptions);\n}\n\n/**\n * Returns a list of all profile types.\n */\nexport function searchProfileTypes(\n params: SearchProfileTypesParameters,\n queryOptions: QueryOptions,\n body: Record<string, string | number>\n): Promise<SearchProfileTypesResponse> {\n return fetchWithPost<SearchProfileTypesParameters, SearchProfileTypesResponse>(\n '/querier.v1.QuerierService/ProfileTypes',\n params,\n queryOptions,\n body\n );\n}\n\n/**\n * Returns a list of all label names.\n */\nexport function searchLabelNames(\n params: SearchLabelNamesParameters,\n queryOptions: QueryOptions,\n body: Record<string, string | number>\n): Promise<SearchLabelNamesResponse> {\n return fetchWithPost<SearchLabelNamesParameters, SearchLabelNamesResponse>(\n '/querier.v1.QuerierService/LabelNames',\n params,\n queryOptions,\n body\n );\n}\n\n/**\n * Returns a list of all label values for a given label name.\n */\nexport function searchLabelValues(\n params: SearchLabelValuesParameters,\n queryOptions: QueryOptions,\n body: Record<string, string | number>\n): Promise<SearchLabelValuesResponse> {\n return fetchWithPost<SearchLabelValuesParameters, SearchLabelValuesResponse>(\n '/querier.v1.QuerierService/LabelValues',\n params,\n queryOptions,\n body\n );\n}\n\n/**\n * Returns a list of all services.\n * This is a special case of label values where the label name is \"service_name\".\n */\nexport function searchServices(\n params: SearchLabelValuesParameters,\n queryOptions: QueryOptions\n): Promise<SearchLabelValuesResponse> {\n return fetchWithPost<SearchLabelValuesParameters, SearchLabelValuesResponse>(\n '/querier.v1.QuerierService/LabelValues',\n params,\n queryOptions,\n { name: 'service_name' }\n );\n}\n"],"names":["fetch","executeRequest","args","response","json","e","console","error","Error","fetchWithGet","apiURI","params","queryOptions","datasourceUrl","headers","url","URLSearchParams","init","method","fetchWithPost","body","JSON","stringify","searchProfiles","searchProfileTypes","searchLabelNames","searchLabelValues","searchServices","name"],"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,KAAK,QAAwB,mBAAmB;AA4CzD,OAAO,MAAMC,iBAAiB,OAAU,GAAGC;IACzC,MAAMC,WAAW,MAAMH,SAASE;IAChC,IAAI;QACF,OAAO,MAAMC,SAASC,IAAI;IAC5B,EAAE,OAAOC,GAAG;QACVC,QAAQC,KAAK,CAAC,gCAAgCF;QAC9C,MAAM,IAAIG,MAAM;IAClB;AACF,EAAE;AAEF,SAASC,aAA2BC,MAAc,EAAEC,MAAgB,EAAEC,YAA0B;IAC9F,MAAM,EAAEC,aAAa,EAAEC,UAAU,CAAC,CAAC,EAAE,GAAGF;IAExC,IAAIG,MAAM,GAAGF,gBAAgBH,QAAQ;IACrC,IAAIC,QAAQ;QACVI,OAAO,MAAM,IAAIC,gBAAgBL;IACnC;IACA,MAAMM,OAAO;QACXC,QAAQ;QACRJ;IACF;IAEA,OAAOb,eAA0Bc,KAAKE;AACxC;AAEA,SAASE,cACPT,MAAc,EACdC,MAAgB,EAChBC,YAA0B,EAC1BQ,IAAqC;IAErC,MAAM,EAAEP,aAAa,EAAEC,UAAU,CAAC,CAAC,EAAE,GAAGF;IAExC,IAAIG,MAAM,GAAGF,gBAAgBH,QAAQ;IACrC,IAAIC,QAAQ;QACVI,OAAO,MAAM,IAAIC,gBAAgBL;IACnC;IACA,MAAMM,OAAO;QACXC,QAAQ;QACRJ;QACAM,MAAMC,KAAKC,SAAS,CAACF;IACvB;IAEA,OAAOnB,eAA0Bc,KAAKE;AACxC;AAEA;;CAEC,GACD,OAAO,SAASM,eACdZ,MAAgC,EAChCC,YAA0B;IAE1B,OAAOH,aAA+D,qBAAqBE,QAAQC;AACrG;AAEA;;CAEC,GACD,OAAO,SAASY,mBACdb,MAAoC,EACpCC,YAA0B,EAC1BQ,IAAqC;IAErC,OAAOD,cACL,2CACAR,QACAC,cACAQ;AAEJ;AAEA;;CAEC,GACD,OAAO,SAASK,iBACdd,MAAkC,EAClCC,YAA0B,EAC1BQ,IAAqC;IAErC,OAAOD,cACL,yCACAR,QACAC,cACAQ;AAEJ;AAEA;;CAEC,GACD,OAAO,SAASM,kBACdf,MAAmC,EACnCC,YAA0B,EAC1BQ,IAAqC;IAErC,OAAOD,cACL,0CACAR,QACAC,cACAQ;AAEJ;AAEA;;;CAGC,GACD,OAAO,SAASO,eACdhB,MAAmC,EACnCC,YAA0B;IAE1B,OAAOO,cACL,0CACAR,QACAC,cACA;QAAEgB,MAAM;IAAe;AAE3B"}
|