@grafana/scenes 5.25.1--canary.967.11837797508.0 → 5.25.1--canary.858.11930656504.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -6
  2. package/dist/esm/behaviors/SceneQueryController.js +60 -5
  3. package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
  4. package/dist/esm/behaviors/SceneRenderProfiler.js +169 -0
  5. package/dist/esm/behaviors/SceneRenderProfiler.js.map +1 -0
  6. package/dist/esm/components/SceneRefreshPicker.js +6 -1
  7. package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
  8. package/dist/esm/components/VizPanel/VizPanel.js +9 -6
  9. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  10. package/dist/esm/core/SceneTimeRange.js +3 -0
  11. package/dist/esm/core/SceneTimeRange.js.map +1 -1
  12. package/dist/esm/core/sceneGraph/getQueryController.js +19 -0
  13. package/dist/esm/core/sceneGraph/getQueryController.js.map +1 -0
  14. package/dist/esm/core/sceneGraph/index.js +3 -3
  15. package/dist/esm/core/sceneGraph/index.js.map +1 -1
  16. package/dist/esm/core/sceneGraph/sceneGraph.js +1 -26
  17. package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
  18. package/dist/esm/core/sceneGraph/utils.js +0 -2
  19. package/dist/esm/core/sceneGraph/utils.js.map +1 -1
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/querying/SceneQueryRunner.js +1 -3
  22. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  23. package/dist/esm/querying/registerQueryWithController.js +18 -2
  24. package/dist/esm/querying/registerQueryWithController.js.map +1 -1
  25. package/dist/esm/utils/getDataSource.js +17 -1
  26. package/dist/esm/utils/getDataSource.js.map +1 -1
  27. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +12 -8
  28. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  29. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +1 -4
  30. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
  31. package/dist/esm/variables/components/VariableValueSelect.js +5 -0
  32. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  33. package/dist/esm/variables/utils.js.map +1 -1
  34. package/dist/esm/variables/variants/TestVariable.js.map +1 -1
  35. package/dist/index.d.ts +44 -32
  36. package/dist/index.js +480 -232
  37. package/dist/index.js.map +1 -1
  38. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -41,19 +41,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
42
42
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
43
43
 
44
- var __defProp$P = Object.defineProperty;
45
- var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
46
- var __hasOwnProp$P = Object.prototype.hasOwnProperty;
47
- var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
48
- var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
- var __spreadValues$P = (a, b) => {
44
+ var __defProp$Q = Object.defineProperty;
45
+ var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$Q = (a, b) => {
50
50
  for (var prop in b || (b = {}))
51
- if (__hasOwnProp$P.call(b, prop))
52
- __defNormalProp$P(a, prop, b[prop]);
53
- if (__getOwnPropSymbols$P)
54
- for (var prop of __getOwnPropSymbols$P(b)) {
55
- if (__propIsEnum$P.call(b, prop))
56
- __defNormalProp$P(a, prop, b[prop]);
51
+ if (__hasOwnProp$Q.call(b, prop))
52
+ __defNormalProp$Q(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$Q)
54
+ for (var prop of __getOwnPropSymbols$Q(b)) {
55
+ if (__propIsEnum$Q.call(b, prop))
56
+ __defNormalProp$Q(a, prop, b[prop]);
57
57
  }
58
58
  return a;
59
59
  };
@@ -62,7 +62,7 @@ function useAppQueryParams() {
62
62
  return runtime.locationSearchToObject(location.search || "");
63
63
  }
64
64
  function getUrlWithAppState(path, searchObject, preserveParams) {
65
- const paramsCopy = __spreadValues$P({}, searchObject);
65
+ const paramsCopy = __spreadValues$Q({}, searchObject);
66
66
  if (preserveParams) {
67
67
  for (const key of Object.keys(paramsCopy)) {
68
68
  if (!preserveParams.includes(key)) {
@@ -76,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
76
76
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
77
77
  }
78
78
 
79
- var __defProp$O = Object.defineProperty;
80
- var __defProps$w = Object.defineProperties;
81
- var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
82
- var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
83
- var __hasOwnProp$O = Object.prototype.hasOwnProperty;
84
- var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
85
- var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
- var __spreadValues$O = (a, b) => {
79
+ var __defProp$P = Object.defineProperty;
80
+ var __defProps$x = Object.defineProperties;
81
+ var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
82
+ var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$P = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
85
+ var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
+ var __spreadValues$P = (a, b) => {
87
87
  for (var prop in b || (b = {}))
88
- if (__hasOwnProp$O.call(b, prop))
89
- __defNormalProp$O(a, prop, b[prop]);
90
- if (__getOwnPropSymbols$O)
91
- for (var prop of __getOwnPropSymbols$O(b)) {
92
- if (__propIsEnum$O.call(b, prop))
93
- __defNormalProp$O(a, prop, b[prop]);
88
+ if (__hasOwnProp$P.call(b, prop))
89
+ __defNormalProp$P(a, prop, b[prop]);
90
+ if (__getOwnPropSymbols$P)
91
+ for (var prop of __getOwnPropSymbols$P(b)) {
92
+ if (__propIsEnum$P.call(b, prop))
93
+ __defNormalProp$P(a, prop, b[prop]);
94
94
  }
95
95
  return a;
96
96
  };
97
- var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
97
+ var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
98
98
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
99
99
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
100
100
  if (runtimePanelPlugins.has(pluginId)) {
101
101
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
102
102
  }
103
- plugin.meta = __spreadProps$w(__spreadValues$O({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$x(__spreadValues$P({}, plugin.meta), {
104
104
  id: pluginId,
105
105
  name: pluginId,
106
106
  module: "runtime plugin",
@@ -128,33 +128,33 @@ function loadPanelPluginSync(pluginId) {
128
128
  return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
129
129
  }
130
130
 
131
- var __defProp$N = Object.defineProperty;
132
- var __defProps$v = Object.defineProperties;
133
- var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
134
- var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
135
- var __hasOwnProp$N = Object.prototype.hasOwnProperty;
136
- var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
137
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
- var __spreadValues$N = (a, b) => {
131
+ var __defProp$O = Object.defineProperty;
132
+ var __defProps$w = Object.defineProperties;
133
+ var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
134
+ var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
135
+ var __hasOwnProp$O = Object.prototype.hasOwnProperty;
136
+ var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
137
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
+ var __spreadValues$O = (a, b) => {
139
139
  for (var prop in b || (b = {}))
140
- if (__hasOwnProp$N.call(b, prop))
141
- __defNormalProp$N(a, prop, b[prop]);
142
- if (__getOwnPropSymbols$N)
143
- for (var prop of __getOwnPropSymbols$N(b)) {
144
- if (__propIsEnum$N.call(b, prop))
145
- __defNormalProp$N(a, prop, b[prop]);
140
+ if (__hasOwnProp$O.call(b, prop))
141
+ __defNormalProp$O(a, prop, b[prop]);
142
+ if (__getOwnPropSymbols$O)
143
+ for (var prop of __getOwnPropSymbols$O(b)) {
144
+ if (__propIsEnum$O.call(b, prop))
145
+ __defNormalProp$O(a, prop, b[prop]);
146
146
  }
147
147
  return a;
148
148
  };
149
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
149
+ var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
150
150
  var __objRest$5 = (source, exclude) => {
151
151
  var target = {};
152
152
  for (var prop in source)
153
- if (__hasOwnProp$N.call(source, prop) && exclude.indexOf(prop) < 0)
153
+ if (__hasOwnProp$O.call(source, prop) && exclude.indexOf(prop) < 0)
154
154
  target[prop] = source[prop];
155
- if (source != null && __getOwnPropSymbols$N)
156
- for (var prop of __getOwnPropSymbols$N(source)) {
157
- if (exclude.indexOf(prop) < 0 && __propIsEnum$N.call(source, prop))
155
+ if (source != null && __getOwnPropSymbols$O)
156
+ for (var prop of __getOwnPropSymbols$O(source)) {
157
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$O.call(source, prop))
158
158
  target[prop] = source[prop];
159
159
  }
160
160
  return target;
@@ -172,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
172
172
  if (!model.isActive) {
173
173
  return null;
174
174
  }
175
- return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$v(__spreadValues$N({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$w(__spreadValues$O({}, otherProps), {
176
176
  model
177
177
  }));
178
178
  }
@@ -188,49 +188,49 @@ class UserActionEvent extends data.BusEventWithPayload {
188
188
  }
189
189
  UserActionEvent.type = "scene-object-user-action";
190
190
 
191
- var __accessCheck$3 = (obj, member, msg) => {
191
+ var __accessCheck$4 = (obj, member, msg) => {
192
192
  if (!member.has(obj))
193
193
  throw TypeError("Cannot " + msg);
194
194
  };
195
- var __privateGet$3 = (obj, member, getter) => {
196
- __accessCheck$3(obj, member, "read from private field");
195
+ var __privateGet$4 = (obj, member, getter) => {
196
+ __accessCheck$4(obj, member, "read from private field");
197
197
  return getter ? getter.call(obj) : member.get(obj);
198
198
  };
199
- var __privateAdd$3 = (obj, member, value) => {
199
+ var __privateAdd$4 = (obj, member, value) => {
200
200
  if (member.has(obj))
201
201
  throw TypeError("Cannot add the same private member more than once");
202
202
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
203
203
  };
204
- var __privateSet$2 = (obj, member, value, setter) => {
205
- __accessCheck$3(obj, member, "write to private field");
204
+ var __privateSet$4 = (obj, member, value, setter) => {
205
+ __accessCheck$4(obj, member, "write to private field");
206
206
  setter ? setter.call(obj, value) : member.set(obj, value);
207
207
  return value;
208
208
  };
209
209
  var _ref;
210
210
  class SceneObjectRef {
211
211
  constructor(ref) {
212
- __privateAdd$3(this, _ref, void 0);
213
- __privateSet$2(this, _ref, ref);
212
+ __privateAdd$4(this, _ref, void 0);
213
+ __privateSet$4(this, _ref, ref);
214
214
  }
215
215
  resolve() {
216
- return __privateGet$3(this, _ref);
216
+ return __privateGet$4(this, _ref);
217
217
  }
218
218
  }
219
219
  _ref = new WeakMap();
220
220
 
221
- var __defProp$M = Object.defineProperty;
222
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
223
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
224
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
225
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
- var __spreadValues$M = (a, b) => {
221
+ var __defProp$N = Object.defineProperty;
222
+ var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
223
+ var __hasOwnProp$N = Object.prototype.hasOwnProperty;
224
+ var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
225
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
+ var __spreadValues$N = (a, b) => {
227
227
  for (var prop in b || (b = {}))
228
- if (__hasOwnProp$M.call(b, prop))
229
- __defNormalProp$M(a, prop, b[prop]);
230
- if (__getOwnPropSymbols$M)
231
- for (var prop of __getOwnPropSymbols$M(b)) {
232
- if (__propIsEnum$M.call(b, prop))
233
- __defNormalProp$M(a, prop, b[prop]);
228
+ if (__hasOwnProp$N.call(b, prop))
229
+ __defNormalProp$N(a, prop, b[prop]);
230
+ if (__getOwnPropSymbols$N)
231
+ for (var prop of __getOwnPropSymbols$N(b)) {
232
+ if (__propIsEnum$N.call(b, prop))
233
+ __defNormalProp$N(a, prop, b[prop]);
234
234
  }
235
235
  return a;
236
236
  };
@@ -293,7 +293,7 @@ class SceneObjectBase {
293
293
  }
294
294
  setState(update) {
295
295
  const prevState = this._state;
296
- const newState = __spreadValues$M(__spreadValues$M({}, this._state), update);
296
+ const newState = __spreadValues$N(__spreadValues$N({}, this._state), update);
297
297
  this._state = Object.freeze(newState);
298
298
  this._setParent(update);
299
299
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -489,19 +489,19 @@ function forEachChild(state, callback) {
489
489
  }
490
490
  }
491
491
 
492
- var __defProp$L = Object.defineProperty;
493
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
494
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
495
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
496
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
497
- var __spreadValues$L = (a, b) => {
492
+ var __defProp$M = Object.defineProperty;
493
+ var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
494
+ var __hasOwnProp$M = Object.prototype.hasOwnProperty;
495
+ var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
496
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
497
+ var __spreadValues$M = (a, b) => {
498
498
  for (var prop in b || (b = {}))
499
- if (__hasOwnProp$L.call(b, prop))
500
- __defNormalProp$L(a, prop, b[prop]);
501
- if (__getOwnPropSymbols$L)
502
- for (var prop of __getOwnPropSymbols$L(b)) {
503
- if (__propIsEnum$L.call(b, prop))
504
- __defNormalProp$L(a, prop, b[prop]);
499
+ if (__hasOwnProp$M.call(b, prop))
500
+ __defNormalProp$M(a, prop, b[prop]);
501
+ if (__getOwnPropSymbols$M)
502
+ for (var prop of __getOwnPropSymbols$M(b)) {
503
+ if (__propIsEnum$M.call(b, prop))
504
+ __defNormalProp$M(a, prop, b[prop]);
505
505
  }
506
506
  return a;
507
507
  };
@@ -510,7 +510,7 @@ function cloneSceneObject(sceneObject, withState) {
510
510
  return new sceneObject.constructor(clonedState);
511
511
  }
512
512
  function cloneSceneObjectState(sceneState, withState) {
513
- const clonedState = __spreadValues$L({}, sceneState);
513
+ const clonedState = __spreadValues$M({}, sceneState);
514
514
  Object.assign(clonedState, withState);
515
515
  for (const key in clonedState) {
516
516
  if (withState && withState[key] !== void 0) {
@@ -529,8 +529,6 @@ function cloneSceneObjectState(sceneState, withState) {
529
529
  for (const child of propValue) {
530
530
  if (child instanceof SceneObjectBase) {
531
531
  newArray.push(child.clone());
532
- } else if (typeof child === "object") {
533
- newArray.push(__spreadValues$L({}, child));
534
532
  } else {
535
533
  newArray.push(child);
536
534
  }
@@ -613,6 +611,305 @@ function lookupVariable(name, sceneObject) {
613
611
  return null;
614
612
  }
615
613
 
614
+ function writeSceneLog(logger, message, ...rest) {
615
+ let loggingEnabled = false;
616
+ if (typeof window !== "undefined") {
617
+ loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
618
+ }
619
+ if (loggingEnabled) {
620
+ console.log(`${logger}: `, message, ...rest);
621
+ }
622
+ }
623
+
624
+ var __accessCheck$3 = (obj, member, msg) => {
625
+ if (!member.has(obj))
626
+ throw TypeError("Cannot " + msg);
627
+ };
628
+ var __privateGet$3 = (obj, member, getter) => {
629
+ __accessCheck$3(obj, member, "read from private field");
630
+ return getter ? getter.call(obj) : member.get(obj);
631
+ };
632
+ var __privateAdd$3 = (obj, member, value) => {
633
+ if (member.has(obj))
634
+ throw TypeError("Cannot add the same private member more than once");
635
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
636
+ };
637
+ var __privateSet$3 = (obj, member, value, setter) => {
638
+ __accessCheck$3(obj, member, "write to private field");
639
+ setter ? setter.call(obj, value) : member.set(obj, value);
640
+ return value;
641
+ };
642
+ var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
643
+ const POST_STORM_WINDOW = 2e3;
644
+ const SPAN_THRESHOLD = 30;
645
+ class SceneRenderProfiler {
646
+ constructor(queryController) {
647
+ this.queryController = queryController;
648
+ __privateAdd$3(this, _profileInProgress, null);
649
+ __privateAdd$3(this, _profileStartTs, null);
650
+ __privateAdd$3(this, _trailAnimationFrameId, null);
651
+ __privateAdd$3(this, _recordedTrailingSpans, []);
652
+ this.lastFrameTime = 0;
653
+ this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
654
+ const currentFrameTime = performance.now();
655
+ const frameLength = currentFrameTime - lastFrameTime;
656
+ __privateGet$3(this, _recordedTrailingSpans).push(frameLength);
657
+ if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
658
+ __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
659
+ () => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
660
+ ));
661
+ } else {
662
+ const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
663
+ const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
664
+ writeSceneLog(
665
+ this.constructor.name,
666
+ "Profile tail recorded, slow frames duration:",
667
+ slowFramesTime,
668
+ slowFrames,
669
+ __privateGet$3(this, _profileInProgress)
670
+ );
671
+ __privateSet$3(this, _recordedTrailingSpans, []);
672
+ const profileDuration = measurementStartTs - profileStartTs;
673
+ writeSceneLog(
674
+ this.constructor.name,
675
+ "Stoped recording, total measured time (network included):",
676
+ profileDuration + slowFramesTime
677
+ );
678
+ __privateSet$3(this, _trailAnimationFrameId, null);
679
+ const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
680
+ performance.measure("DashboardInteraction", {
681
+ start: profileStartTs,
682
+ end: profileEndTs
683
+ });
684
+ const networkDuration = captureNetwork(profileStartTs, profileEndTs);
685
+ if (this.queryController.state.onProfileComplete) {
686
+ this.queryController.state.onProfileComplete({
687
+ origin: __privateGet$3(this, _profileInProgress).origin,
688
+ crumbs: __privateGet$3(this, _profileInProgress).crumbs,
689
+ duration: profileDuration + slowFramesTime,
690
+ networkDuration,
691
+ jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
692
+ usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
693
+ totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
694
+ });
695
+ }
696
+ if (window.__runs) {
697
+ window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
698
+ `;
699
+ } else {
700
+ window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
701
+ `;
702
+ }
703
+ }
704
+ };
705
+ }
706
+ startProfile(name) {
707
+ if (__privateGet$3(this, _trailAnimationFrameId)) {
708
+ cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
709
+ __privateSet$3(this, _trailAnimationFrameId, null);
710
+ writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
711
+ }
712
+ __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
713
+ __privateSet$3(this, _profileStartTs, performance.now());
714
+ writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
715
+ }
716
+ recordProfileTail(measurementStartTime, profileStartTs) {
717
+ __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
718
+ () => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
719
+ ));
720
+ }
721
+ tryCompletingProfile() {
722
+ writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
723
+ if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
724
+ writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
725
+ this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
726
+ }
727
+ }
728
+ isTailRecording() {
729
+ return Boolean(__privateGet$3(this, _trailAnimationFrameId));
730
+ }
731
+ cancelTailRecording() {
732
+ if (__privateGet$3(this, _trailAnimationFrameId)) {
733
+ cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
734
+ __privateSet$3(this, _trailAnimationFrameId, null);
735
+ writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
736
+ }
737
+ }
738
+ addCrumb(crumb) {
739
+ if (__privateGet$3(this, _profileInProgress)) {
740
+ __privateGet$3(this, _profileInProgress).crumbs.push(crumb);
741
+ }
742
+ }
743
+ }
744
+ _profileInProgress = new WeakMap();
745
+ _profileStartTs = new WeakMap();
746
+ _trailAnimationFrameId = new WeakMap();
747
+ _recordedTrailingSpans = new WeakMap();
748
+ function processRecordedSpans(spans) {
749
+ for (let i = spans.length - 1; i >= 0; i--) {
750
+ if (spans[i] > SPAN_THRESHOLD) {
751
+ return spans.slice(0, i + 1);
752
+ }
753
+ }
754
+ return [spans[0]];
755
+ }
756
+ function captureNetwork(startTs, endTs) {
757
+ const entries = performance.getEntriesByType("resource");
758
+ performance.clearResourceTimings();
759
+ const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
760
+ for (const entry of networkEntries) {
761
+ performance.measure("Network entry " + entry.name, {
762
+ start: entry.startTime,
763
+ end: entry.responseEnd
764
+ });
765
+ }
766
+ return calculateNetworkTime(networkEntries);
767
+ }
768
+ function calculateNetworkTime(requests) {
769
+ if (requests.length === 0) {
770
+ return 0;
771
+ }
772
+ requests.sort((a, b) => a.startTime - b.startTime);
773
+ let totalNetworkTime = 0;
774
+ let currentStart = requests[0].startTime;
775
+ let currentEnd = requests[0].responseEnd;
776
+ for (let i = 1; i < requests.length; i++) {
777
+ if (requests[i].startTime <= currentEnd) {
778
+ currentEnd = Math.max(currentEnd, requests[i].responseEnd);
779
+ } else {
780
+ totalNetworkTime += currentEnd - currentStart;
781
+ currentStart = requests[i].startTime;
782
+ currentEnd = requests[i].responseEnd;
783
+ }
784
+ }
785
+ totalNetworkTime += currentEnd - currentStart;
786
+ return totalNetworkTime;
787
+ }
788
+
789
+ var __defProp$L = Object.defineProperty;
790
+ var __defProps$v = Object.defineProperties;
791
+ var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
792
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
793
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
794
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
795
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
796
+ var __spreadValues$L = (a, b) => {
797
+ for (var prop in b || (b = {}))
798
+ if (__hasOwnProp$L.call(b, prop))
799
+ __defNormalProp$L(a, prop, b[prop]);
800
+ if (__getOwnPropSymbols$L)
801
+ for (var prop of __getOwnPropSymbols$L(b)) {
802
+ if (__propIsEnum$L.call(b, prop))
803
+ __defNormalProp$L(a, prop, b[prop]);
804
+ }
805
+ return a;
806
+ };
807
+ var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
808
+ var __accessCheck$2 = (obj, member, msg) => {
809
+ if (!member.has(obj))
810
+ throw TypeError("Cannot " + msg);
811
+ };
812
+ var __privateGet$2 = (obj, member, getter) => {
813
+ __accessCheck$2(obj, member, "read from private field");
814
+ return getter ? getter.call(obj) : member.get(obj);
815
+ };
816
+ var __privateAdd$2 = (obj, member, value) => {
817
+ if (member.has(obj))
818
+ throw TypeError("Cannot add the same private member more than once");
819
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
820
+ };
821
+ var __privateSet$2 = (obj, member, value, setter) => {
822
+ __accessCheck$2(obj, member, "write to private field");
823
+ setter ? setter.call(obj, value) : member.set(obj, value);
824
+ return value;
825
+ };
826
+ var _running, _tryCompleteProfileFrameId;
827
+ function isQueryController(s) {
828
+ return "isQueryController" in s;
829
+ }
830
+ class SceneQueryController extends SceneObjectBase {
831
+ constructor(state = {}) {
832
+ super(__spreadProps$v(__spreadValues$L({}, state), { isRunning: false }));
833
+ this.isQueryController = true;
834
+ this.profiler = new SceneRenderProfiler(this);
835
+ __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
836
+ __privateAdd$2(this, _tryCompleteProfileFrameId, null);
837
+ this.runningQueriesCount = () => {
838
+ return __privateGet$2(this, _running).size;
839
+ };
840
+ this.addActivationHandler(() => {
841
+ return () => __privateGet$2(this, _running).clear();
842
+ });
843
+ }
844
+ startProfile(source) {
845
+ if (!this.state.enableProfiling) {
846
+ return;
847
+ }
848
+ this.profiler.startProfile(source.constructor.name);
849
+ }
850
+ queryStarted(entry) {
851
+ __privateGet$2(this, _running).add(entry);
852
+ this.changeRunningQueryCount(1, entry);
853
+ if (!this.state.isRunning) {
854
+ this.setState({ isRunning: true });
855
+ }
856
+ }
857
+ queryCompleted(entry) {
858
+ if (!__privateGet$2(this, _running).has(entry)) {
859
+ return;
860
+ }
861
+ __privateGet$2(this, _running).delete(entry);
862
+ this.changeRunningQueryCount(-1);
863
+ if (__privateGet$2(this, _running).size === 0) {
864
+ this.setState({ isRunning: false });
865
+ }
866
+ }
867
+ changeRunningQueryCount(dir, entry) {
868
+ var _a;
869
+ window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
870
+ if (dir === 1 && this.state.enableProfiling) {
871
+ if (entry) {
872
+ this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
873
+ }
874
+ if (this.profiler.isTailRecording()) {
875
+ writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
876
+ this.profiler.cancelTailRecording();
877
+ }
878
+ }
879
+ if (this.state.enableProfiling) {
880
+ if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
881
+ cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
882
+ }
883
+ __privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
884
+ this.profiler.tryCompletingProfile();
885
+ }));
886
+ }
887
+ }
888
+ cancelAll() {
889
+ var _a;
890
+ for (const entry of __privateGet$2(this, _running).values()) {
891
+ (_a = entry.cancel) == null ? void 0 : _a.call(entry);
892
+ }
893
+ }
894
+ }
895
+ _running = new WeakMap();
896
+ _tryCompleteProfileFrameId = new WeakMap();
897
+
898
+ function getQueryController(sceneObject) {
899
+ let parent = sceneObject;
900
+ while (parent) {
901
+ if (parent.state.$behaviors) {
902
+ for (const behavior of parent.state.$behaviors) {
903
+ if (isQueryController(behavior)) {
904
+ return behavior;
905
+ }
906
+ }
907
+ }
908
+ parent = parent.parent;
909
+ }
910
+ return void 0;
911
+ }
912
+
616
913
  var __defProp$K = Object.defineProperty;
617
914
  var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
618
915
  var __hasOwnProp$K = Object.prototype.hasOwnProperty;
@@ -789,6 +1086,8 @@ class SceneTimeRange extends SceneObjectBase {
789
1086
  this.state.UNSAFE_nowDelay
790
1087
  );
791
1088
  if (update.from !== this.state.from || update.to !== this.state.to) {
1089
+ const queryController = getQueryController(this);
1090
+ queryController == null ? void 0 : queryController.startProfile(this);
792
1091
  this._urlSync.performBrowserHistoryAction(() => {
793
1092
  this.setState(update);
794
1093
  });
@@ -2135,70 +2434,55 @@ function isDataLayer(obj) {
2135
2434
  return "isDataLayer" in obj;
2136
2435
  }
2137
2436
 
2138
- var __accessCheck$2 = (obj, member, msg) => {
2139
- if (!member.has(obj))
2140
- throw TypeError("Cannot " + msg);
2141
- };
2142
- var __privateGet$2 = (obj, member, getter) => {
2143
- __accessCheck$2(obj, member, "read from private field");
2144
- return getter ? getter.call(obj) : member.get(obj);
2145
- };
2146
- var __privateAdd$2 = (obj, member, value) => {
2147
- if (member.has(obj))
2148
- throw TypeError("Cannot add the same private member more than once");
2149
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2150
- };
2151
- var _running;
2152
- function isQueryController(s) {
2153
- return "isQueryController" in s;
2154
- }
2155
- class SceneQueryController extends SceneObjectBase {
2156
- constructor() {
2157
- super({ isRunning: false });
2158
- this.isQueryController = true;
2159
- __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
2160
- this.addActivationHandler(() => {
2161
- return () => __privateGet$2(this, _running).clear();
2162
- });
2163
- }
2164
- queryStarted(entry) {
2165
- __privateGet$2(this, _running).add(entry);
2166
- this.changeRunningQueryCount(1);
2167
- if (!this.state.isRunning) {
2168
- this.setState({ isRunning: true });
2169
- }
2170
- }
2171
- queryCompleted(entry) {
2172
- if (!__privateGet$2(this, _running).has(entry)) {
2173
- return;
2174
- }
2175
- __privateGet$2(this, _running).delete(entry);
2176
- this.changeRunningQueryCount(-1);
2177
- if (__privateGet$2(this, _running).size === 0) {
2178
- this.setState({ isRunning: false });
2179
- }
2180
- }
2181
- changeRunningQueryCount(dir) {
2182
- var _a;
2183
- window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
2184
- }
2185
- cancelAll() {
2186
- var _a;
2187
- for (const entry of __privateGet$2(this, _running).values()) {
2188
- (_a = entry.cancel) == null ? void 0 : _a.call(entry);
2437
+ function registerQueryWithController(entry) {
2438
+ return (queryStream) => {
2439
+ const queryControler = sceneGraph.getQueryController(entry.origin);
2440
+ if (!queryControler) {
2441
+ return queryStream;
2189
2442
  }
2190
- }
2443
+ return new rxjs.Observable((observer) => {
2444
+ if (!entry.cancel) {
2445
+ entry.cancel = () => observer.complete();
2446
+ }
2447
+ queryControler.queryStarted(entry);
2448
+ let markedAsCompleted = false;
2449
+ const sub = queryStream.subscribe({
2450
+ next: (v) => {
2451
+ if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2452
+ markedAsCompleted = true;
2453
+ queryControler.queryCompleted(entry);
2454
+ }
2455
+ observer.next(v);
2456
+ },
2457
+ error: (e) => observer.error(e),
2458
+ complete: () => {
2459
+ observer.complete();
2460
+ }
2461
+ });
2462
+ return () => {
2463
+ sub.unsubscribe();
2464
+ if (!markedAsCompleted) {
2465
+ queryControler.queryCompleted(entry);
2466
+ }
2467
+ };
2468
+ });
2469
+ };
2191
2470
  }
2192
- _running = new WeakMap();
2193
-
2194
- function writeSceneLog(logger, message, ...rest) {
2195
- let loggingEnabled = false;
2196
- if (typeof window !== "undefined") {
2197
- loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
2198
- }
2199
- if (loggingEnabled) {
2200
- console.log(`${logger}: `, message, ...rest);
2201
- }
2471
+ function wrapPromiseInStateObservable(promise) {
2472
+ return new rxjs.Observable((observer) => {
2473
+ observer.next({ state: schema.LoadingState.Loading });
2474
+ const promiseObservable = rxjs.from(promise);
2475
+ promiseObservable.pipe(
2476
+ rxjs.map(() => ({ state: schema.LoadingState.Done })),
2477
+ rxjs.catchError(() => {
2478
+ observer.next({ state: schema.LoadingState.Error });
2479
+ return [];
2480
+ })
2481
+ ).subscribe({
2482
+ next: (result) => observer.next(result),
2483
+ complete: () => observer.complete()
2484
+ });
2485
+ });
2202
2486
  }
2203
2487
 
2204
2488
  async function getDataSource(datasource, scopedVars) {
@@ -2211,7 +2495,21 @@ async function getDataSource(datasource, scopedVars) {
2211
2495
  if (datasource && datasource.query) {
2212
2496
  return datasource;
2213
2497
  }
2214
- return await runtime.getDataSourceSrv().get(datasource, scopedVars);
2498
+ const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
2499
+ if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
2500
+ const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
2501
+ if (queryControler && queryControler.state.enableProfiling) {
2502
+ wrapPromiseInStateObservable(dsPromise).pipe(
2503
+ registerQueryWithController({
2504
+ type: "plugin",
2505
+ origin: scopedVars.__sceneObject.value.valueOf()
2506
+ })
2507
+ ).subscribe(() => {
2508
+ });
2509
+ }
2510
+ }
2511
+ const result = await dsPromise;
2512
+ return result;
2215
2513
  }
2216
2514
 
2217
2515
  class VariableValueRecorder {
@@ -2459,41 +2757,6 @@ function findActiveAdHocFilterVariableByUid(dsUid) {
2459
2757
  return void 0;
2460
2758
  }
2461
2759
 
2462
- function registerQueryWithController(entry) {
2463
- return (queryStream) => {
2464
- const queryControler = sceneGraph.getQueryController(entry.origin);
2465
- if (!queryControler) {
2466
- return queryStream;
2467
- }
2468
- return new rxjs.Observable((observer) => {
2469
- if (!entry.cancel) {
2470
- entry.cancel = () => observer.complete();
2471
- }
2472
- queryControler.queryStarted(entry);
2473
- let markedAsCompleted = false;
2474
- const sub = queryStream.subscribe({
2475
- next: (v) => {
2476
- if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2477
- markedAsCompleted = true;
2478
- queryControler.queryCompleted(entry);
2479
- }
2480
- observer.next(v);
2481
- },
2482
- error: (e) => observer.error(e),
2483
- complete: () => {
2484
- observer.complete();
2485
- }
2486
- });
2487
- return () => {
2488
- sub.unsubscribe();
2489
- if (!markedAsCompleted) {
2490
- queryControler.queryCompleted(entry);
2491
- }
2492
- };
2493
- });
2494
- };
2495
- }
2496
-
2497
2760
  const allActiveGroupByVariables = /* @__PURE__ */ new Set();
2498
2761
  function findActiveGroupByVariablesByUid(dsUid) {
2499
2762
  var _a;
@@ -2602,6 +2865,7 @@ function VariableValueSelect({ model }) {
2602
2865
  const [inputValue, setInputValue] = React.useState("");
2603
2866
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2604
2867
  const selectValue = toSelectableValue$2(value, String(text));
2868
+ const queryController = sceneGraph.getQueryController(model);
2605
2869
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2606
2870
  const onInputChange = (value2, { action }) => {
2607
2871
  if (action === "input-change") {
@@ -2641,6 +2905,7 @@ function VariableValueSelect({ model }) {
2641
2905
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
2642
2906
  onChange: (newValue) => {
2643
2907
  model.changeValueTo(newValue.value, newValue.label);
2908
+ queryController == null ? void 0 : queryController.startProfile(model);
2644
2909
  if (hasCustomValue !== newValue.__isNew__) {
2645
2910
  setHasCustomValue(newValue.__isNew__);
2646
2911
  }
@@ -2652,6 +2917,7 @@ function VariableValueSelectMulti({ model }) {
2652
2917
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2653
2918
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2654
2919
  const [inputValue, setInputValue] = React.useState("");
2920
+ const queryController = sceneGraph.getQueryController(model);
2655
2921
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2656
2922
  React.useEffect(() => {
2657
2923
  setUncommittedValue(arrayValue);
@@ -2697,6 +2963,7 @@ function VariableValueSelectMulti({ model }) {
2697
2963
  onInputChange,
2698
2964
  onBlur: () => {
2699
2965
  model.changeValueTo(uncommittedValue);
2966
+ queryController == null ? void 0 : queryController.startProfile(model);
2700
2967
  },
2701
2968
  filterOption: filterNoOp$2,
2702
2969
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
@@ -3310,10 +3577,12 @@ function AdHocFilterRenderer({ filter, model }) {
3310
3577
  const [isOperatorOpen, setIsOperatorOpen] = React.useState(false);
3311
3578
  const [valueInputValue, setValueInputValue] = React.useState("");
3312
3579
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3313
- const [uncommittedValue, setUncommittedValue] = React.useState(filter.values ? filter.values.map((value, index) => {
3314
- var _a2;
3315
- return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3316
- }) : []);
3580
+ const [uncommittedValue, setUncommittedValue] = React.useState(
3581
+ filter.values ? filter.values.map((value, index) => {
3582
+ var _a2;
3583
+ return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3584
+ }) : []
3585
+ );
3317
3586
  const isMultiValue = isMultiValueOperator(filter.operator);
3318
3587
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3319
3588
  const valueValue = keyLabelToOption(filter.value, (_a = filter.valueLabels) == null ? void 0 : _a[0]);
@@ -3336,10 +3605,12 @@ function AdHocFilterRenderer({ filter, model }) {
3336
3605
  setUncommittedValue([]);
3337
3606
  } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {
3338
3607
  update.values = [filter.value];
3339
- setUncommittedValue([{
3340
- value: filter.value,
3341
- label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3342
- }]);
3608
+ setUncommittedValue([
3609
+ {
3610
+ value: filter.value,
3611
+ label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3612
+ }
3613
+ ]);
3343
3614
  }
3344
3615
  model._updateFilter(filter, update);
3345
3616
  };
@@ -3618,10 +3889,7 @@ function deserializeUrlToFilters(value) {
3618
3889
  }
3619
3890
  function toArray(filter) {
3620
3891
  var _a;
3621
- const result = [
3622
- toUrlCommaDelimitedString(filter.key, filter.keyLabel),
3623
- filter.operator
3624
- ];
3892
+ const result = [toUrlCommaDelimitedString(filter.key, filter.keyLabel), filter.operator];
3625
3893
  if (isMultiValueOperator(filter.operator)) {
3626
3894
  filter.values.forEach((value, index) => {
3627
3895
  var _a2;
@@ -5348,9 +5616,7 @@ class SceneQueryRunner extends SceneObjectBase {
5348
5616
  })
5349
5617
  );
5350
5618
  }
5351
- this.subscribeToTimeRangeChanges(
5352
- timeRange
5353
- );
5619
+ this.subscribeToTimeRangeChanges(timeRange);
5354
5620
  if (this.shouldRunQueriesOnActivate()) {
5355
5621
  this.runQueries();
5356
5622
  }
@@ -6664,30 +6930,6 @@ function findDescendents(scene, descendentType) {
6664
6930
  const targetScenes = findAllObjects(scene, isDescendentType);
6665
6931
  return targetScenes.filter(isDescendentType);
6666
6932
  }
6667
- function getQueryController(sceneObject) {
6668
- let parent = sceneObject;
6669
- while (parent) {
6670
- if (parent.state.$behaviors) {
6671
- for (const behavior of parent.state.$behaviors) {
6672
- if (isQueryController(behavior)) {
6673
- return behavior;
6674
- }
6675
- }
6676
- }
6677
- parent = parent.parent;
6678
- }
6679
- return void 0;
6680
- }
6681
- function getUrlSyncManager(sceneObject) {
6682
- let parent = sceneObject;
6683
- while (parent) {
6684
- if ("urlSyncManager" in parent.state) {
6685
- return parent.state.urlSyncManager;
6686
- }
6687
- parent = parent.parent;
6688
- }
6689
- return void 0;
6690
- }
6691
6933
 
6692
6934
  const sceneGraph = {
6693
6935
  getVariables,
@@ -6703,9 +6945,8 @@ const sceneGraph = {
6703
6945
  findObject,
6704
6946
  findAllObjects,
6705
6947
  getAncestor,
6706
- findDescendents,
6707
6948
  getQueryController,
6708
- getUrlSyncManager
6949
+ findDescendents
6709
6950
  };
6710
6951
 
6711
6952
  class UniqueUrlKeyMapper {
@@ -7577,7 +7818,13 @@ class VizPanel extends SceneObjectBase {
7577
7818
  } else {
7578
7819
  const { importPanelPlugin } = runtime.getPluginImportUtils();
7579
7820
  try {
7580
- const result = await importPanelPlugin(pluginId);
7821
+ const panelPromise = importPanelPlugin(pluginId);
7822
+ const queryControler = sceneGraph.getQueryController(this);
7823
+ if (queryControler && queryControler.state.enableProfiling) {
7824
+ wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
7825
+ });
7826
+ }
7827
+ const result = await panelPromise;
7581
7828
  this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
7582
7829
  } catch (err) {
7583
7830
  this._pluginLoaded(getPanelPluginNotFound(pluginId));
@@ -7646,11 +7893,7 @@ class VizPanel extends SceneObjectBase {
7646
7893
  }
7647
7894
  async changePluginType(pluginId, newOptions, newFieldConfig) {
7648
7895
  var _a, _b;
7649
- const {
7650
- options: prevOptions,
7651
- fieldConfig: prevFieldConfig,
7652
- pluginId: prevPluginId
7653
- } = this.state;
7896
+ const { options: prevOptions, fieldConfig: prevFieldConfig, pluginId: prevPluginId } = this.state;
7654
7897
  this._dataWithFieldConfig = void 0;
7655
7898
  const isAfterPluginChange = this.state.pluginId !== pluginId;
7656
7899
  await this._loadPlugin(pluginId, newOptions != null ? newOptions : {}, newFieldConfig, isAfterPluginChange);
@@ -11167,6 +11410,7 @@ class SceneRefreshPicker extends SceneObjectBase {
11167
11410
  this._autoRefreshBlocked = false;
11168
11411
  this.onRefresh = () => {
11169
11412
  const queryController = sceneGraph.getQueryController(this);
11413
+ queryController == null ? void 0 : queryController.startProfile(this);
11170
11414
  if (queryController == null ? void 0 : queryController.state.isRunning) {
11171
11415
  queryController.cancelAll();
11172
11416
  return;
@@ -11222,6 +11466,8 @@ class SceneRefreshPicker extends SceneObjectBase {
11222
11466
  }
11223
11467
  this._intervalTimer = setInterval(() => {
11224
11468
  if (this.isTabVisible()) {
11469
+ const queryController = sceneGraph.getQueryController(this);
11470
+ queryController == null ? void 0 : queryController.startProfile(this);
11225
11471
  timeRange.onRefresh();
11226
11472
  } else {
11227
11473
  this._autoRefreshBlocked = true;
@@ -11295,7 +11541,9 @@ function SceneRefreshPickerRenderer({ model }) {
11295
11541
  tooltip,
11296
11542
  width,
11297
11543
  text,
11298
- onRefresh: model.onRefresh,
11544
+ onRefresh: () => {
11545
+ model.onRefresh();
11546
+ },
11299
11547
  primary,
11300
11548
  onIntervalChanged: model.onIntervalChanged,
11301
11549
  isLoading: isRunning,