@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.
Files changed (270) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/__mf/css/async/1339.6763d50b.css +1 -0
  4. package/__mf/css/async/4758.6763d50b.css +1 -0
  5. package/__mf/css/async/9633.6763d50b.css +1 -0
  6. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  7. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  8. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  9. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  10. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  11. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  12. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  13. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  18. package/__mf/js/Pyroscope.24cb38f3.js +5 -0
  19. package/__mf/js/async/1101.380fb9ae.js +73 -0
  20. package/__mf/js/async/1101.380fb9ae.js.LICENSE.txt +19 -0
  21. package/__mf/js/async/1339.e58b309f.js +1 -0
  22. package/__mf/js/async/1964.88ffca96.js +2 -0
  23. package/__mf/js/async/1964.88ffca96.js.LICENSE.txt +9 -0
  24. package/__mf/js/async/2002.8fc3eb19.js +1 -0
  25. package/__mf/js/async/2114.6befeb2d.js +1 -0
  26. package/__mf/js/async/2292.ed7843fc.js +2 -0
  27. package/__mf/js/async/2292.ed7843fc.js.LICENSE.txt +24 -0
  28. package/__mf/js/async/2911.ec166b7f.js +38 -0
  29. package/__mf/js/async/3224.755c2f09.js +1 -0
  30. package/__mf/js/async/3431.bc5c0624.js +1 -0
  31. package/__mf/js/async/3863.dbe40473.js +2 -0
  32. package/__mf/js/async/3863.dbe40473.js.LICENSE.txt +9 -0
  33. package/__mf/js/async/3960.a5d41140.js +2 -0
  34. package/__mf/js/async/3960.a5d41140.js.LICENSE.txt +8 -0
  35. package/__mf/js/async/3980.f1ef0ece.js +2 -0
  36. package/__mf/js/async/3980.f1ef0ece.js.LICENSE.txt +9 -0
  37. package/__mf/js/async/4075.cde93ec7.js +1 -0
  38. package/__mf/js/async/4238.f154b81c.js +1 -0
  39. package/__mf/js/async/424.edb69d58.js +1 -0
  40. package/__mf/js/async/4368.2d817d5d.js +2 -0
  41. package/__mf/js/async/4368.2d817d5d.js.LICENSE.txt +15 -0
  42. package/__mf/js/async/4421.d44d1d6f.js +1 -0
  43. package/__mf/js/async/4556.aabe5dff.js +2 -0
  44. package/__mf/js/async/4556.aabe5dff.js.LICENSE.txt +9 -0
  45. package/__mf/js/async/4758.a629b413.js +1 -0
  46. package/__mf/js/async/5214.8d3dd135.js +1 -0
  47. package/__mf/js/async/5215.6fd5cc14.js +1 -0
  48. package/__mf/js/async/5220.d1e40fff.js +10 -0
  49. package/__mf/js/async/5220.d1e40fff.js.LICENSE.txt +17 -0
  50. package/__mf/js/async/5358.40b9537e.js +7 -0
  51. package/__mf/js/async/5358.40b9537e.js.LICENSE.txt +21 -0
  52. package/__mf/js/async/5409.0df9c301.js +1 -0
  53. package/__mf/js/async/5790.677172d7.js +1 -0
  54. package/__mf/js/async/5876.38b119d5.js +2 -0
  55. package/__mf/js/async/5876.38b119d5.js.LICENSE.txt +21 -0
  56. package/__mf/js/async/5924.582b0cc4.js +2 -0
  57. package/__mf/js/async/5924.582b0cc4.js.LICENSE.txt +9 -0
  58. package/__mf/js/async/5981.9c662ef8.js +2 -0
  59. package/__mf/js/async/5981.9c662ef8.js.LICENSE.txt +8 -0
  60. package/__mf/js/async/6292.e30a4c42.js +1 -0
  61. package/__mf/js/async/6377.f6e824aa.js +2 -0
  62. package/__mf/js/async/6377.f6e824aa.js.LICENSE.txt +32 -0
  63. package/__mf/js/async/6770.2f87fe88.js +1 -0
  64. package/__mf/js/async/694.5e15c44d.js +1 -0
  65. package/__mf/js/async/7376.c4cd77b0.js +1 -0
  66. package/__mf/js/async/738.fa73528b.js +1 -0
  67. package/__mf/js/async/7740.474defbd.js +1 -0
  68. package/__mf/js/async/8216.be450b83.js +1 -0
  69. package/__mf/js/async/8488.00c7f348.js +1 -0
  70. package/__mf/js/async/8930.496019db.js +1 -0
  71. package/__mf/js/async/9092.cfd47472.js +101 -0
  72. package/__mf/js/async/9173.5959814f.js +2 -0
  73. package/__mf/js/async/9173.5959814f.js.LICENSE.txt +19 -0
  74. package/__mf/js/async/9478.c76fe552.js +2 -0
  75. package/__mf/js/async/9478.c76fe552.js.LICENSE.txt +9 -0
  76. package/__mf/js/async/9633.a7997138.js +2 -0
  77. package/__mf/js/async/9633.a7997138.js.LICENSE.txt +9 -0
  78. package/__mf/js/async/__federation_expose_PyroscopeDatasource.76f63abf.js +2 -0
  79. package/__mf/js/async/__federation_expose_PyroscopeDatasource.76f63abf.js.LICENSE.txt +9 -0
  80. package/__mf/js/async/__federation_expose_PyroscopeExplorer.88d5e4fb.js +2 -0
  81. package/__mf/js/async/__federation_expose_PyroscopeExplorer.88d5e4fb.js.LICENSE.txt +9 -0
  82. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js +2 -0
  83. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js.LICENSE.txt +9 -0
  84. package/__mf/js/main.4caf1064.js +5 -0
  85. package/lib/bootstrap.d.ts +2 -0
  86. package/lib/bootstrap.d.ts.map +1 -0
  87. package/lib/bootstrap.js +19 -0
  88. package/lib/bootstrap.js.map +1 -0
  89. package/lib/cjs/bootstrap.js +26 -0
  90. package/lib/cjs/components/AddFilterItem.js +38 -0
  91. package/lib/cjs/components/DeleteFilterItem.js +42 -0
  92. package/lib/cjs/components/FilterItem.js +83 -0
  93. package/lib/cjs/components/Filters.js +106 -0
  94. package/lib/cjs/components/LabelName.js +59 -0
  95. package/lib/cjs/components/LabelValue.js +59 -0
  96. package/lib/cjs/components/Operator.js +45 -0
  97. package/lib/cjs/components/ProfileTypeSelector.js +57 -0
  98. package/lib/cjs/components/Service.js +60 -0
  99. package/lib/cjs/components/index.js +32 -0
  100. package/lib/cjs/env.d.js +14 -0
  101. package/lib/cjs/explore/PyroscopeExplorer.js +90 -0
  102. package/lib/cjs/explore/index.js +30 -0
  103. package/lib/cjs/getPluginModule.js +39 -0
  104. package/lib/cjs/index-federation.js +55 -0
  105. package/lib/cjs/index.js +40 -0
  106. package/lib/cjs/model/api-types.js +19 -0
  107. package/lib/cjs/model/index.js +33 -0
  108. package/lib/cjs/model/profile-query-model.js +16 -0
  109. package/lib/cjs/model/pyroscope-client.js +94 -0
  110. package/lib/cjs/model/pyroscope-selectors.js +46 -0
  111. package/lib/cjs/plugins/PyroscopeDatasourceEditor.js +70 -0
  112. package/lib/cjs/plugins/index.js +33 -0
  113. package/lib/cjs/plugins/pyroscope-datasource-types.js +16 -0
  114. package/lib/cjs/plugins/pyroscope-datasource.js +68 -0
  115. package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js +41 -0
  116. package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +114 -0
  117. package/lib/cjs/plugins/pyroscope-profile-query/get-profile-data.js +201 -0
  118. package/lib/cjs/plugins/pyroscope-profile-query/index.js +33 -0
  119. package/lib/cjs/plugins/pyroscope-profile-query/query-editor-model.js +120 -0
  120. package/lib/cjs/setup-tests.js +19 -0
  121. package/lib/cjs/test/index.js +30 -0
  122. package/lib/cjs/test/mock-data.js +151 -0
  123. package/lib/cjs/test/setup-tests.js +17 -0
  124. package/lib/cjs/utils/types.js +25 -0
  125. package/lib/cjs/utils/use-query.js +112 -0
  126. package/lib/components/AddFilterItem.d.ts +6 -0
  127. package/lib/components/AddFilterItem.d.ts.map +1 -0
  128. package/lib/components/AddFilterItem.js +25 -0
  129. package/lib/components/AddFilterItem.js.map +1 -0
  130. package/lib/components/DeleteFilterItem.d.ts +6 -0
  131. package/lib/components/DeleteFilterItem.d.ts.map +1 -0
  132. package/lib/components/DeleteFilterItem.js +29 -0
  133. package/lib/components/DeleteFilterItem.js.map +1 -0
  134. package/lib/components/FilterItem.d.ts +11 -0
  135. package/lib/components/FilterItem.d.ts.map +1 -0
  136. package/lib/components/FilterItem.js +75 -0
  137. package/lib/components/FilterItem.js.map +1 -0
  138. package/lib/components/Filters.d.ts +10 -0
  139. package/lib/components/Filters.d.ts.map +1 -0
  140. package/lib/components/Filters.js +98 -0
  141. package/lib/components/Filters.js.map +1 -0
  142. package/lib/components/LabelName.d.ts +9 -0
  143. package/lib/components/LabelName.d.ts.map +1 -0
  144. package/lib/components/LabelName.js +51 -0
  145. package/lib/components/LabelName.js.map +1 -0
  146. package/lib/components/LabelValue.d.ts +10 -0
  147. package/lib/components/LabelValue.d.ts.map +1 -0
  148. package/lib/components/LabelValue.js +51 -0
  149. package/lib/components/LabelValue.js.map +1 -0
  150. package/lib/components/Operator.d.ts +7 -0
  151. package/lib/components/Operator.d.ts.map +1 -0
  152. package/lib/components/Operator.js +37 -0
  153. package/lib/components/Operator.js.map +1 -0
  154. package/lib/components/ProfileTypeSelector.d.ts +9 -0
  155. package/lib/components/ProfileTypeSelector.d.ts.map +1 -0
  156. package/lib/components/ProfileTypeSelector.js +49 -0
  157. package/lib/components/ProfileTypeSelector.js.map +1 -0
  158. package/lib/components/Service.d.ts +9 -0
  159. package/lib/components/Service.d.ts.map +1 -0
  160. package/lib/components/Service.js +52 -0
  161. package/lib/components/Service.js.map +1 -0
  162. package/lib/components/index.d.ts +4 -0
  163. package/lib/components/index.d.ts.map +1 -0
  164. package/lib/components/index.js +17 -0
  165. package/lib/components/index.js.map +1 -0
  166. package/lib/env.d.js +15 -0
  167. package/lib/env.d.js.map +1 -0
  168. package/lib/explore/PyroscopeExplorer.d.ts +3 -0
  169. package/lib/explore/PyroscopeExplorer.d.ts.map +1 -0
  170. package/lib/explore/PyroscopeExplorer.js +82 -0
  171. package/lib/explore/PyroscopeExplorer.js.map +1 -0
  172. package/lib/explore/index.d.ts +2 -0
  173. package/lib/explore/index.d.ts.map +1 -0
  174. package/lib/explore/index.js +15 -0
  175. package/lib/explore/index.js.map +1 -0
  176. package/lib/getPluginModule.d.ts +6 -0
  177. package/lib/getPluginModule.d.ts.map +1 -0
  178. package/lib/getPluginModule.js +28 -0
  179. package/lib/getPluginModule.js.map +1 -0
  180. package/lib/index-federation.d.ts +1 -0
  181. package/lib/index-federation.d.ts.map +1 -0
  182. package/lib/index-federation.js +15 -0
  183. package/lib/index-federation.js.map +1 -0
  184. package/lib/index.d.ts +6 -0
  185. package/lib/index.d.ts.map +1 -0
  186. package/lib/index.js +19 -0
  187. package/lib/index.js.map +1 -0
  188. package/lib/model/api-types.d.ts +82 -0
  189. package/lib/model/api-types.d.ts.map +1 -0
  190. package/lib/model/api-types.js +20 -0
  191. package/lib/model/api-types.js.map +1 -0
  192. package/lib/model/index.d.ts +5 -0
  193. package/lib/model/index.d.ts.map +1 -0
  194. package/lib/model/index.js +18 -0
  195. package/lib/model/index.js.map +1 -0
  196. package/lib/model/profile-query-model.d.ts +13 -0
  197. package/lib/model/profile-query-model.d.ts.map +1 -0
  198. package/lib/model/profile-query-model.js +17 -0
  199. package/lib/model/profile-query-model.js.map +1 -0
  200. package/lib/model/pyroscope-client.d.ts +43 -0
  201. package/lib/model/pyroscope-client.d.ts.map +1 -0
  202. package/lib/model/pyroscope-client.js +77 -0
  203. package/lib/model/pyroscope-client.js.map +1 -0
  204. package/lib/model/pyroscope-selectors.d.ts +21 -0
  205. package/lib/model/pyroscope-selectors.d.ts.map +1 -0
  206. package/lib/model/pyroscope-selectors.js +30 -0
  207. package/lib/model/pyroscope-selectors.js.map +1 -0
  208. package/lib/plugins/PyroscopeDatasourceEditor.d.ts +9 -0
  209. package/lib/plugins/PyroscopeDatasourceEditor.d.ts.map +1 -0
  210. package/lib/plugins/PyroscopeDatasourceEditor.js +57 -0
  211. package/lib/plugins/PyroscopeDatasourceEditor.js.map +1 -0
  212. package/lib/plugins/index.d.ts +5 -0
  213. package/lib/plugins/index.d.ts.map +1 -0
  214. package/lib/plugins/index.js +18 -0
  215. package/lib/plugins/index.js.map +1 -0
  216. package/lib/plugins/pyroscope-datasource-types.d.ts +6 -0
  217. package/lib/plugins/pyroscope-datasource-types.d.ts.map +1 -0
  218. package/lib/plugins/pyroscope-datasource-types.js +15 -0
  219. package/lib/plugins/pyroscope-datasource-types.js.map +1 -0
  220. package/lib/plugins/pyroscope-datasource.d.ts +5 -0
  221. package/lib/plugins/pyroscope-datasource.d.ts.map +1 -0
  222. package/lib/plugins/pyroscope-datasource.js +60 -0
  223. package/lib/plugins/pyroscope-datasource.js.map +1 -0
  224. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.d.ts +14 -0
  225. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.d.ts.map +1 -0
  226. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js +33 -0
  227. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQuery.js.map +1 -0
  228. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.d.ts +4 -0
  229. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.d.ts.map +1 -0
  230. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +106 -0
  231. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js.map +1 -0
  232. package/lib/plugins/pyroscope-profile-query/get-profile-data.d.ts +9 -0
  233. package/lib/plugins/pyroscope-profile-query/get-profile-data.d.ts.map +1 -0
  234. package/lib/plugins/pyroscope-profile-query/get-profile-data.js +185 -0
  235. package/lib/plugins/pyroscope-profile-query/get-profile-data.js.map +1 -0
  236. package/lib/plugins/pyroscope-profile-query/index.d.ts +5 -0
  237. package/lib/plugins/pyroscope-profile-query/index.d.ts.map +1 -0
  238. package/lib/plugins/pyroscope-profile-query/index.js +18 -0
  239. package/lib/plugins/pyroscope-profile-query/index.js.map +1 -0
  240. package/lib/plugins/pyroscope-profile-query/query-editor-model.d.ts +34 -0
  241. package/lib/plugins/pyroscope-profile-query/query-editor-model.d.ts.map +1 -0
  242. package/lib/plugins/pyroscope-profile-query/query-editor-model.js +106 -0
  243. package/lib/plugins/pyroscope-profile-query/query-editor-model.js.map +1 -0
  244. package/lib/setup-tests.d.ts +2 -0
  245. package/lib/setup-tests.d.ts.map +1 -0
  246. package/lib/setup-tests.js +17 -0
  247. package/lib/setup-tests.js.map +1 -0
  248. package/lib/test/index.d.ts +2 -0
  249. package/lib/test/index.d.ts.map +1 -0
  250. package/lib/test/index.js +15 -0
  251. package/lib/test/index.js.map +1 -0
  252. package/lib/test/mock-data.d.ts +5 -0
  253. package/lib/test/mock-data.d.ts.map +1 -0
  254. package/lib/test/mock-data.js +133 -0
  255. package/lib/test/mock-data.js.map +1 -0
  256. package/lib/test/setup-tests.d.ts +2 -0
  257. package/lib/test/setup-tests.d.ts.map +1 -0
  258. package/lib/test/setup-tests.js +15 -0
  259. package/lib/test/setup-tests.js.map +1 -0
  260. package/lib/utils/types.d.ts +8 -0
  261. package/lib/utils/types.d.ts.map +1 -0
  262. package/lib/utils/types.js +17 -0
  263. package/lib/utils/types.js.map +1 -0
  264. package/lib/utils/use-query.d.ts +9 -0
  265. package/lib/utils/use-query.d.ts.map +1 -0
  266. package/lib/utils/use-query.js +87 -0
  267. package/lib/utils/use-query.js.map +1 -0
  268. package/mf-manifest.json +455 -0
  269. package/mf-stats.json +539 -0
  270. package/package.json +88 -0
@@ -0,0 +1,94 @@
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
+ executeRequest: function() {
25
+ return executeRequest;
26
+ },
27
+ searchLabelNames: function() {
28
+ return searchLabelNames;
29
+ },
30
+ searchLabelValues: function() {
31
+ return searchLabelValues;
32
+ },
33
+ searchProfileTypes: function() {
34
+ return searchProfileTypes;
35
+ },
36
+ searchProfiles: function() {
37
+ return searchProfiles;
38
+ },
39
+ searchServices: function() {
40
+ return searchServices;
41
+ }
42
+ });
43
+ const _core = require("@perses-dev/core");
44
+ const executeRequest = async (...args)=>{
45
+ const response = await (0, _core.fetch)(...args);
46
+ try {
47
+ return await response.json();
48
+ } catch (e) {
49
+ console.error('Invalid response from server', e);
50
+ throw new Error('Invalid response from server');
51
+ }
52
+ };
53
+ function fetchWithGet(apiURI, params, queryOptions) {
54
+ const { datasourceUrl, headers = {} } = queryOptions;
55
+ let url = `${datasourceUrl}${apiURI}`;
56
+ if (params) {
57
+ url += '?' + new URLSearchParams(params);
58
+ }
59
+ const init = {
60
+ method: 'GET',
61
+ headers
62
+ };
63
+ return executeRequest(url, init);
64
+ }
65
+ function fetchWithPost(apiURI, params, queryOptions, body) {
66
+ const { datasourceUrl, headers = {} } = queryOptions;
67
+ let url = `${datasourceUrl}${apiURI}`;
68
+ if (params) {
69
+ url += '?' + new URLSearchParams(params);
70
+ }
71
+ const init = {
72
+ method: 'POST',
73
+ headers,
74
+ body: JSON.stringify(body)
75
+ };
76
+ return executeRequest(url, init);
77
+ }
78
+ function searchProfiles(params, queryOptions) {
79
+ return fetchWithGet('/pyroscope/render', params, queryOptions);
80
+ }
81
+ function searchProfileTypes(params, queryOptions, body) {
82
+ return fetchWithPost('/querier.v1.QuerierService/ProfileTypes', params, queryOptions, body);
83
+ }
84
+ function searchLabelNames(params, queryOptions, body) {
85
+ return fetchWithPost('/querier.v1.QuerierService/LabelNames', params, queryOptions, body);
86
+ }
87
+ function searchLabelValues(params, queryOptions, body) {
88
+ return fetchWithPost('/querier.v1.QuerierService/LabelValues', params, queryOptions, body);
89
+ }
90
+ function searchServices(params, queryOptions) {
91
+ return fetchWithPost('/querier.v1.QuerierService/LabelValues', params, queryOptions, {
92
+ name: 'service_name'
93
+ });
94
+ }
@@ -0,0 +1,46 @@
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
+ DEFAULT_PYROSCOPE: function() {
25
+ return DEFAULT_PYROSCOPE;
26
+ },
27
+ PYROSCOPE_DATASOURCE_KIND: function() {
28
+ return PYROSCOPE_DATASOURCE_KIND;
29
+ },
30
+ isDefaultPyroscopeSelector: function() {
31
+ return isDefaultPyroscopeSelector;
32
+ },
33
+ isPyroscopeDatasourceSelector: function() {
34
+ return isPyroscopeDatasourceSelector;
35
+ }
36
+ });
37
+ const PYROSCOPE_DATASOURCE_KIND = 'PyroscopeDatasource';
38
+ const DEFAULT_PYROSCOPE = {
39
+ kind: PYROSCOPE_DATASOURCE_KIND
40
+ };
41
+ function isDefaultPyroscopeSelector(selector) {
42
+ return selector.name === undefined;
43
+ }
44
+ function isPyroscopeDatasourceSelector(selector) {
45
+ return selector.kind === PYROSCOPE_DATASOURCE_KIND;
46
+ }
@@ -0,0 +1,70 @@
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
+ Object.defineProperty(exports, "PyroscopeDatasourceEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PyroscopeDatasourceEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _pluginsystem = require("@perses-dev/plugin-system");
25
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
26
+ function _interop_require_default(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
29
+ };
30
+ }
31
+ function PyroscopeDatasourceEditor(props) {
32
+ const { value, onChange, isReadonly } = props;
33
+ const initialSpecDirect = {
34
+ directUrl: ''
35
+ };
36
+ const initialSpecProxy = {
37
+ proxy: {
38
+ kind: 'HTTPProxy',
39
+ spec: {
40
+ allowedEndpoints: [
41
+ // list of standard endpoints suggested by default
42
+ {
43
+ endpointPattern: '/pyroscope/render',
44
+ method: 'GET'
45
+ },
46
+ {
47
+ endpointPattern: '/querier.v1.QuerierService/ProfileTypes',
48
+ method: 'POST'
49
+ },
50
+ {
51
+ endpointPattern: '/querier.v1.QuerierService/LabelNames',
52
+ method: 'POST'
53
+ },
54
+ {
55
+ endpointPattern: '/querier.v1.QuerierService/LabelValues',
56
+ method: 'POST'
57
+ }
58
+ ],
59
+ url: ''
60
+ }
61
+ }
62
+ };
63
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.HTTPSettingsEditor, {
64
+ value: value,
65
+ onChange: onChange,
66
+ isReadonly: isReadonly,
67
+ initialSpecDirect: initialSpecDirect,
68
+ initialSpecProxy: initialSpecProxy
69
+ });
70
+ }
@@ -0,0 +1,33 @@
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
+ _export_star(require("./pyroscope-profile-query"), exports);
18
+ _export_star(require("./pyroscope-datasource-types"), exports);
19
+ _export_star(require("./pyroscope-datasource"), exports);
20
+ _export_star(require("./PyroscopeDatasourceEditor"), exports);
21
+ function _export_star(from, to) {
22
+ Object.keys(from).forEach(function(k) {
23
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
24
+ Object.defineProperty(to, k, {
25
+ enumerable: true,
26
+ get: function() {
27
+ return from[k];
28
+ }
29
+ });
30
+ }
31
+ });
32
+ return from;
33
+ }
@@ -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
+ });
@@ -0,0 +1,68 @@
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
+ Object.defineProperty(exports, "PyroscopeDatasource", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PyroscopeDatasource;
21
+ }
22
+ });
23
+ const _pyroscopeclient = require("../model/pyroscope-client");
24
+ const _PyroscopeDatasourceEditor = require("./PyroscopeDatasourceEditor");
25
+ /**
26
+ * Creates a PyroscopeClient for a specific datasource spec.
27
+ */ const createClient = (spec, options)=>{
28
+ const { directUrl, proxy } = spec;
29
+ const { proxyUrl } = options;
30
+ // Use the direct URL if specified, but fallback to the proxyUrl by default if not specified
31
+ const datasourceUrl = directUrl ?? proxyUrl;
32
+ if (datasourceUrl === undefined) {
33
+ throw new Error('No URL specified for Pyroscope client. You can use directUrl in the spec to configure it.');
34
+ }
35
+ const specHeaders = proxy?.spec.headers;
36
+ return {
37
+ options: {
38
+ datasourceUrl
39
+ },
40
+ searchProfiles: (params, headers)=>(0, _pyroscopeclient.searchProfiles)(params, {
41
+ datasourceUrl,
42
+ headers: headers ?? specHeaders
43
+ }),
44
+ searchProfileTypes: (params, headers, body)=>(0, _pyroscopeclient.searchProfileTypes)(params, {
45
+ datasourceUrl,
46
+ headers: headers ?? specHeaders
47
+ }, body),
48
+ searchLabelNames: (params, headers, body)=>(0, _pyroscopeclient.searchLabelNames)(params, {
49
+ datasourceUrl,
50
+ headers: headers ?? specHeaders
51
+ }, body),
52
+ searchLabelValues: (params, headers, body)=>(0, _pyroscopeclient.searchLabelValues)(params, {
53
+ datasourceUrl,
54
+ headers: headers ?? specHeaders
55
+ }, body),
56
+ searchServices: (params, headers)=>(0, _pyroscopeclient.searchServices)(params, {
57
+ datasourceUrl,
58
+ headers: headers ?? specHeaders
59
+ })
60
+ };
61
+ };
62
+ const PyroscopeDatasource = {
63
+ createClient,
64
+ OptionsEditorComponent: _PyroscopeDatasourceEditor.PyroscopeDatasourceEditor,
65
+ createInitialOptions: ()=>({
66
+ directUrl: ''
67
+ })
68
+ };
@@ -0,0 +1,41 @@
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
+ Object.defineProperty(exports, "PyroscopeProfileQuery", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PyroscopeProfileQuery;
21
+ }
22
+ });
23
+ const _getprofiledata = require("./get-profile-data");
24
+ const _PyroscopeProfileQueryEditor = require("./PyroscopeProfileQueryEditor");
25
+ const PyroscopeProfileQuery = {
26
+ getProfileData: _getprofiledata.getProfileData,
27
+ OptionsEditorComponent: _PyroscopeProfileQueryEditor.PyroscopeProfileQueryEditor,
28
+ createInitialOptions: ()=>({
29
+ maxNodes: 0,
30
+ datasource: undefined,
31
+ service: '',
32
+ profileType: '',
33
+ filters: [
34
+ {
35
+ labelName: '',
36
+ labelValue: '',
37
+ operator: '='
38
+ }
39
+ ]
40
+ })
41
+ };
@@ -0,0 +1,114 @@
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
+ Object.defineProperty(exports, "PyroscopeProfileQueryEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return PyroscopeProfileQueryEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _pluginsystem = require("@perses-dev/plugin-system");
25
+ const _components = require("@perses-dev/components");
26
+ const _immer = require("immer");
27
+ const _material = require("@mui/material");
28
+ const _pyroscopeselectors = require("../../model/pyroscope-selectors");
29
+ const _components1 = require("../../components");
30
+ const _queryeditormodel = require("./query-editor-model");
31
+ function PyroscopeProfileQueryEditor(props) {
32
+ const { onChange, value } = props;
33
+ const { datasource } = value;
34
+ const selectedDatasource = datasource ?? _pyroscopeselectors.DEFAULT_PYROSCOPE;
35
+ const datasourceSelectLabelID = (0, _components.useId)('pyroscope-datasource-label');
36
+ const { maxNodes, handleMaxNodesChange, maxNodesHasError } = (0, _queryeditormodel.useMaxNodesState)(props);
37
+ const { profileType, handleProfileTypeChange } = (0, _queryeditormodel.useProfileTypeState)(props);
38
+ const { service, handleServiceChange } = (0, _queryeditormodel.useServiceState)(props);
39
+ const { filters, handleFiltersChange } = (0, _queryeditormodel.useFiltersState)(props);
40
+ const handleDatasourceChange = (next)=>{
41
+ // Check if the next value is a DatasourceSelector
42
+ if (typeof next === 'object' && 'kind' in next && 'name' in next) {
43
+ if ((0, _pyroscopeselectors.isPyroscopeDatasourceSelector)(next)) {
44
+ onChange((0, _immer.produce)(value, (draft)=>{
45
+ // If they're using the default, just omit the datasource prop (i.e. set to undefined)
46
+ const nextDatasource = (0, _pyroscopeselectors.isDefaultPyroscopeSelector)(next) ? undefined : next;
47
+ draft.datasource = nextDatasource;
48
+ }));
49
+ return;
50
+ }
51
+ }
52
+ throw new Error('Got unexpected non-Pyroscope datasource selector');
53
+ };
54
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
55
+ spacing: 2,
56
+ children: [
57
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormControl, {
58
+ margin: "dense",
59
+ fullWidth: false,
60
+ children: [
61
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
62
+ id: datasourceSelectLabelID,
63
+ shrink: true,
64
+ children: "Pyroscope Datasource"
65
+ }),
66
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
67
+ datasourcePluginKind: _pyroscopeselectors.PYROSCOPE_DATASOURCE_KIND,
68
+ value: selectedDatasource,
69
+ onChange: handleDatasourceChange,
70
+ labelId: datasourceSelectLabelID,
71
+ label: "Pyroscope Datasource",
72
+ notched: true
73
+ })
74
+ ]
75
+ }),
76
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
77
+ direction: "row",
78
+ spacing: 0,
79
+ sx: {
80
+ flexWrap: 'wrap',
81
+ rowGap: 1,
82
+ gap: 2
83
+ },
84
+ children: [
85
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.Service, {
86
+ datasource: selectedDatasource,
87
+ value: service,
88
+ onChange: handleServiceChange
89
+ }),
90
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.ProfileTypeSelector, {
91
+ datasource: selectedDatasource,
92
+ value: profileType,
93
+ onChange: handleProfileTypeChange
94
+ }),
95
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
96
+ size: "small",
97
+ label: "Max Nodes",
98
+ value: maxNodes,
99
+ error: maxNodesHasError,
100
+ onChange: (e)=>handleMaxNodesChange(e.target.value),
101
+ sx: {
102
+ width: '110px'
103
+ }
104
+ })
105
+ ]
106
+ }),
107
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.Filters, {
108
+ datasource: selectedDatasource,
109
+ value: filters,
110
+ onChange: handleFiltersChange
111
+ })
112
+ ]
113
+ });
114
+ }
@@ -0,0 +1,201 @@
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
+ getProfileData: function() {
25
+ return getProfileData;
26
+ },
27
+ getUnixTimeRange: function() {
28
+ return getUnixTimeRange;
29
+ }
30
+ });
31
+ const _datefns = require("date-fns");
32
+ const _model = require("../../model");
33
+ const _types = require("../../utils/types");
34
+ function getUnixTimeRange(timeRange) {
35
+ const { start, end } = timeRange;
36
+ return {
37
+ start: Math.ceil((0, _datefns.getUnixTime)(start)),
38
+ end: Math.ceil((0, _datefns.getUnixTime)(end))
39
+ };
40
+ }
41
+ const getProfileData = async (spec, context)=>{
42
+ const defaultPyroscopeDatasource = {
43
+ kind: _model.PYROSCOPE_DATASOURCE_KIND
44
+ };
45
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? defaultPyroscopeDatasource);
46
+ const buildQueryString = ()=>{
47
+ let query = '';
48
+ if (spec.service) {
49
+ query = `service_name="${spec.service}"`;
50
+ }
51
+ if (spec.filters && spec.filters.length > 0) {
52
+ const filterExpr = (0, _types.computeFilterExpr)(spec.filters);
53
+ if (query === '') {
54
+ query = filterExpr;
55
+ } else {
56
+ query += ',' + filterExpr;
57
+ }
58
+ }
59
+ query = spec.profileType + (query === '' ? '' : '{' + query + '}');
60
+ return query;
61
+ };
62
+ const getParams = ()=>{
63
+ const params = {
64
+ // example of query
65
+ // query: `process_cpu:cpu:nanoseconds:cpu:nanoseconds{service_name="pyroscope"}`,
66
+ query: buildQueryString(),
67
+ // the default value is now-1h
68
+ from: 'now-1h'
69
+ };
70
+ // handle time range selection from UI drop down (e.g. last 5 minutes, last 1 hour )
71
+ if (context.absoluteTimeRange) {
72
+ const { start, end } = getUnixTimeRange(context.absoluteTimeRange);
73
+ params.from = start;
74
+ params.until = end;
75
+ }
76
+ if (spec.maxNodes) {
77
+ params.maxNodes = spec.maxNodes;
78
+ }
79
+ return params;
80
+ };
81
+ const response = await client.searchProfiles(getParams());
82
+ // return a profile data
83
+ return transformProfileResponse(response);
84
+ };
85
+ /**
86
+ * This function transform the Pyroscope response into the Perses profile format
87
+ */ function transformProfileResponse(response) {
88
+ const newResponse = {
89
+ profile: {
90
+ stackTrace: {}
91
+ },
92
+ numTicks: 0,
93
+ maxSelf: 0,
94
+ metadata: {
95
+ spyName: '',
96
+ sampleRate: 0,
97
+ units: '',
98
+ name: ''
99
+ },
100
+ timeline: {
101
+ startTime: 0,
102
+ samples: [],
103
+ durationDelta: 0
104
+ }
105
+ };
106
+ if (!response) {
107
+ return newResponse;
108
+ }
109
+ const stackTraces = [];
110
+ // stackTraces id from 1
111
+ let id = 1;
112
+ // Set the profile stackTrace property
113
+ for(let i = 0; i < response.flamebearer.levels.length; i++){
114
+ let current = 0;
115
+ const row = [];
116
+ const level = response.flamebearer.levels[i];
117
+ if (!level) {
118
+ continue;
119
+ }
120
+ for(let j = 0; j < level.length; j += 4){
121
+ const temp = {};
122
+ temp.id = id;
123
+ id += 1;
124
+ const indexInNamesArray = level[j + 3]; // index in names array
125
+ if (indexInNamesArray !== undefined) {
126
+ const name = response.flamebearer.names[indexInNamesArray];
127
+ if (name) {
128
+ temp.name = name;
129
+ }
130
+ }
131
+ temp.level = i;
132
+ const total = level[j + 1];
133
+ if (total !== undefined) {
134
+ temp.total = total;
135
+ }
136
+ const self = level[j + 2];
137
+ if (self !== undefined) {
138
+ temp.self = self;
139
+ }
140
+ // start and end
141
+ const offset = level[j];
142
+ if (offset !== undefined) {
143
+ current += offset; // current += offset
144
+ }
145
+ temp.start = current;
146
+ if (total !== undefined) {
147
+ current += total; // current += total
148
+ }
149
+ temp.end = current;
150
+ temp.children = [];
151
+ row.push(temp);
152
+ }
153
+ stackTraces.push(row);
154
+ }
155
+ addChildren(stackTraces); // adding children to nodes
156
+ if (stackTraces[0]?.[0]) {
157
+ newResponse.profile.stackTrace = stackTraces[0][0];
158
+ }
159
+ // Set other properties
160
+ newResponse.numTicks = response.flamebearer.numTicks;
161
+ newResponse.maxSelf = response.flamebearer.maxSelf;
162
+ newResponse.metadata = {
163
+ spyName: response.metadata.spyName,
164
+ sampleRate: response.metadata.sampleRate,
165
+ units: response.metadata.units,
166
+ name: response.metadata.name
167
+ };
168
+ newResponse.timeline = {
169
+ startTime: response.timeline.startTime,
170
+ samples: response.timeline.samples,
171
+ durationDelta: response.timeline.durationDelta
172
+ };
173
+ return newResponse;
174
+ }
175
+ // todo: optimize this method as soon as possible
176
+ function addChildren(stackTraces) {
177
+ // for (let i = stackTraces.length - 1; i > 0; i--) {
178
+ for(let i = 1; i < stackTraces.length; i++){
179
+ const currentLevel = stackTraces[i];
180
+ const parentLevel = stackTraces[i - 1];
181
+ if (!currentLevel || !parentLevel) {
182
+ continue;
183
+ }
184
+ for(let j = 0; j < currentLevel.length; j++){
185
+ const currentStack = currentLevel[j];
186
+ if (!currentStack) {
187
+ continue;
188
+ }
189
+ for(let k = 0; k < parentLevel.length; k++){
190
+ const parentStack = parentLevel[k];
191
+ if (!parentStack) {
192
+ continue;
193
+ }
194
+ if (currentStack.start >= parentStack.start && currentStack.end <= parentStack.end) {
195
+ parentStack.children.push(currentStack);
196
+ break;
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }