@grafana/scenes 6.28.4 → 6.28.5--canary.1198.16615923333.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/dist/esm/behaviors/SceneQueryController.js +15 -10
- package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
- package/dist/esm/behaviors/SceneRenderProfiler.js +19 -20
- package/dist/esm/behaviors/SceneRenderProfiler.js.map +1 -1
- package/dist/esm/components/VizPanel/VizPanel.js +1 -1
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js +1 -1
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js +1 -1
- package/dist/esm/querying/layers/annotations/AnnotationsDataLayer.js.map +1 -1
- package/dist/esm/utils/getDataSource.js +1 -1
- package/dist/esm/utils/getDataSource.js.map +1 -1
- package/dist/esm/variables/variants/query/QueryVariable.js +1 -1
- package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +207 -201
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -607,246 +607,77 @@ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Ca
|
|
|
607
607
|
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
608
608
|
var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
609
609
|
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
610
|
-
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
|
611
|
-
const POST_STORM_WINDOW = 2e3;
|
|
612
|
-
const SPAN_THRESHOLD = 30;
|
|
613
|
-
class SceneRenderProfiler {
|
|
614
|
-
constructor(queryController) {
|
|
615
|
-
this.queryController = queryController;
|
|
616
|
-
__privateAdd$3(this, _profileInProgress, null);
|
|
617
|
-
__privateAdd$3(this, _profileStartTs, null);
|
|
618
|
-
__privateAdd$3(this, _trailAnimationFrameId, null);
|
|
619
|
-
// Will keep measured lengths trailing frames
|
|
620
|
-
__privateAdd$3(this, _recordedTrailingSpans, []);
|
|
621
|
-
this.lastFrameTime = 0;
|
|
622
|
-
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
|
623
|
-
const currentFrameTime = performance.now();
|
|
624
|
-
const frameLength = currentFrameTime - lastFrameTime;
|
|
625
|
-
__privateGet$3(this, _recordedTrailingSpans).push(frameLength);
|
|
626
|
-
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
|
627
|
-
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
628
|
-
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
|
629
|
-
));
|
|
630
|
-
} else {
|
|
631
|
-
const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
|
|
632
|
-
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
|
633
|
-
writeSceneLog(
|
|
634
|
-
this.constructor.name,
|
|
635
|
-
"Profile tail recorded, slow frames duration:",
|
|
636
|
-
slowFramesTime,
|
|
637
|
-
slowFrames,
|
|
638
|
-
__privateGet$3(this, _profileInProgress)
|
|
639
|
-
);
|
|
640
|
-
__privateSet$3(this, _recordedTrailingSpans, []);
|
|
641
|
-
const profileDuration = measurementStartTs - profileStartTs;
|
|
642
|
-
writeSceneLog(
|
|
643
|
-
this.constructor.name,
|
|
644
|
-
"Stoped recording, total measured time (network included):",
|
|
645
|
-
profileDuration + slowFramesTime
|
|
646
|
-
);
|
|
647
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
648
|
-
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
|
649
|
-
performance.measure(`DashboardInteraction ${__privateGet$3(this, _profileInProgress).origin}`, {
|
|
650
|
-
start: profileStartTs,
|
|
651
|
-
end: profileEndTs
|
|
652
|
-
});
|
|
653
|
-
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
|
654
|
-
if (this.queryController.state.onProfileComplete) {
|
|
655
|
-
this.queryController.state.onProfileComplete({
|
|
656
|
-
origin: __privateGet$3(this, _profileInProgress).origin,
|
|
657
|
-
crumbs: __privateGet$3(this, _profileInProgress).crumbs,
|
|
658
|
-
duration: profileDuration + slowFramesTime,
|
|
659
|
-
networkDuration,
|
|
660
|
-
// @ts-ignore
|
|
661
|
-
jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
|
|
662
|
-
// @ts-ignore
|
|
663
|
-
usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
|
|
664
|
-
// @ts-ignore
|
|
665
|
-
totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
|
|
666
|
-
});
|
|
667
|
-
__privateSet$3(this, _profileInProgress, null);
|
|
668
|
-
}
|
|
669
|
-
if (window.__runs) {
|
|
670
|
-
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
671
|
-
`;
|
|
672
|
-
} else {
|
|
673
|
-
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
674
|
-
`;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
startProfile(name) {
|
|
680
|
-
if (__privateGet$3(this, _profileInProgress)) {
|
|
681
|
-
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
|
682
|
-
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
|
683
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
684
|
-
writeSceneLog(this.constructor.name, "New profile: Stopped recording frames ");
|
|
685
|
-
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
|
686
|
-
__privateSet$3(this, _profileStartTs, performance.now());
|
|
687
|
-
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
|
688
|
-
} else {
|
|
689
|
-
this.addCrumb(name);
|
|
690
|
-
}
|
|
691
|
-
} else {
|
|
692
|
-
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
|
693
|
-
__privateSet$3(this, _profileStartTs, performance.now());
|
|
694
|
-
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
recordProfileTail(measurementStartTime, profileStartTs) {
|
|
698
|
-
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
699
|
-
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
|
700
|
-
));
|
|
701
|
-
}
|
|
702
|
-
tryCompletingProfile() {
|
|
703
|
-
writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
|
|
704
|
-
if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
|
|
705
|
-
writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
|
|
706
|
-
this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
isTailRecording() {
|
|
710
|
-
return Boolean(__privateGet$3(this, _trailAnimationFrameId));
|
|
711
|
-
}
|
|
712
|
-
cancelTailRecording() {
|
|
713
|
-
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
|
714
|
-
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
|
715
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
716
|
-
writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
addCrumb(crumb) {
|
|
720
|
-
if (__privateGet$3(this, _profileInProgress)) {
|
|
721
|
-
writeSceneLog(this.constructor.name, "Adding crumb:", crumb);
|
|
722
|
-
__privateGet$3(this, _profileInProgress).crumbs.push(crumb);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
_profileInProgress = new WeakMap();
|
|
727
|
-
_profileStartTs = new WeakMap();
|
|
728
|
-
_trailAnimationFrameId = new WeakMap();
|
|
729
|
-
_recordedTrailingSpans = new WeakMap();
|
|
730
|
-
function processRecordedSpans(spans) {
|
|
731
|
-
for (let i = spans.length - 1; i >= 0; i--) {
|
|
732
|
-
if (spans[i] > SPAN_THRESHOLD) {
|
|
733
|
-
return spans.slice(0, i + 1);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
return [spans[0]];
|
|
737
|
-
}
|
|
738
|
-
function captureNetwork(startTs, endTs) {
|
|
739
|
-
const entries = performance.getEntriesByType("resource");
|
|
740
|
-
performance.clearResourceTimings();
|
|
741
|
-
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
|
742
|
-
for (const entry of networkEntries) {
|
|
743
|
-
performance.measure("Network entry " + entry.name, {
|
|
744
|
-
start: entry.startTime,
|
|
745
|
-
end: entry.responseEnd
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
return calculateNetworkTime(networkEntries);
|
|
749
|
-
}
|
|
750
|
-
function calculateNetworkTime(requests) {
|
|
751
|
-
if (requests.length === 0) {
|
|
752
|
-
return 0;
|
|
753
|
-
}
|
|
754
|
-
requests.sort((a, b) => a.startTime - b.startTime);
|
|
755
|
-
let totalNetworkTime = 0;
|
|
756
|
-
let currentStart = requests[0].startTime;
|
|
757
|
-
let currentEnd = requests[0].responseEnd;
|
|
758
|
-
for (let i = 1; i < requests.length; i++) {
|
|
759
|
-
if (requests[i].startTime <= currentEnd) {
|
|
760
|
-
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
|
761
|
-
} else {
|
|
762
|
-
totalNetworkTime += currentEnd - currentStart;
|
|
763
|
-
currentStart = requests[i].startTime;
|
|
764
|
-
currentEnd = requests[i].responseEnd;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
totalNetworkTime += currentEnd - currentStart;
|
|
768
|
-
return totalNetworkTime;
|
|
769
|
-
}
|
|
770
|
-
const REFRESH_INTERACTION = "refresh";
|
|
771
|
-
const TIME_RANGE_CHANGE_INTERACTION = "time_range_change";
|
|
772
|
-
const FILTER_REMOVED_INTERACTION = "filter_removed";
|
|
773
|
-
const FILTER_CHANGED_INTERACTION = "filter_changed";
|
|
774
|
-
const FILTER_RESTORED_INTERACTION = "filter_restored";
|
|
775
|
-
const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
|
|
776
|
-
const SCOPES_CHANGED_INTERACTION = "scopes_changed";
|
|
777
|
-
|
|
778
|
-
var __typeError$2 = (msg) => {
|
|
779
|
-
throw TypeError(msg);
|
|
780
|
-
};
|
|
781
|
-
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
782
|
-
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
783
|
-
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
784
|
-
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
785
610
|
var _running, _tryCompleteProfileFrameId;
|
|
786
611
|
function isQueryController(s) {
|
|
787
612
|
return "isQueryController" in s;
|
|
788
613
|
}
|
|
789
614
|
class SceneQueryController extends SceneObjectBase {
|
|
790
|
-
constructor(state = {}) {
|
|
615
|
+
constructor(state = {}, profiler) {
|
|
791
616
|
super({ ...state, isRunning: false });
|
|
617
|
+
this.profiler = profiler;
|
|
792
618
|
this.isQueryController = true;
|
|
793
|
-
this
|
|
794
|
-
__privateAdd$
|
|
795
|
-
__privateAdd$2(this, _tryCompleteProfileFrameId, null);
|
|
619
|
+
__privateAdd$3(this, _running, /* @__PURE__ */ new Set());
|
|
620
|
+
__privateAdd$3(this, _tryCompleteProfileFrameId, null);
|
|
796
621
|
this.runningQueriesCount = () => {
|
|
797
|
-
return __privateGet$
|
|
622
|
+
return __privateGet$3(this, _running).size;
|
|
798
623
|
};
|
|
624
|
+
if (profiler) {
|
|
625
|
+
this.profiler = profiler;
|
|
626
|
+
profiler.setQueryController(this);
|
|
627
|
+
}
|
|
799
628
|
this.addActivationHandler(() => {
|
|
800
|
-
return () => __privateGet$
|
|
629
|
+
return () => __privateGet$3(this, _running).clear();
|
|
801
630
|
});
|
|
802
631
|
}
|
|
803
632
|
startProfile(name) {
|
|
633
|
+
var _a;
|
|
804
634
|
if (!this.state.enableProfiling) {
|
|
805
635
|
return;
|
|
806
636
|
}
|
|
807
|
-
this.profiler.startProfile(name);
|
|
637
|
+
(_a = this.profiler) == null ? void 0 : _a.startProfile(name);
|
|
808
638
|
}
|
|
809
639
|
queryStarted(entry) {
|
|
810
|
-
__privateGet$
|
|
640
|
+
__privateGet$3(this, _running).add(entry);
|
|
811
641
|
this.changeRunningQueryCount(1, entry);
|
|
812
642
|
if (!this.state.isRunning) {
|
|
813
643
|
this.setState({ isRunning: true });
|
|
814
644
|
}
|
|
815
645
|
}
|
|
816
646
|
queryCompleted(entry) {
|
|
817
|
-
if (!__privateGet$
|
|
647
|
+
if (!__privateGet$3(this, _running).has(entry)) {
|
|
818
648
|
return;
|
|
819
649
|
}
|
|
820
|
-
__privateGet$
|
|
650
|
+
__privateGet$3(this, _running).delete(entry);
|
|
821
651
|
this.changeRunningQueryCount(-1);
|
|
822
|
-
if (__privateGet$
|
|
652
|
+
if (__privateGet$3(this, _running).size === 0) {
|
|
823
653
|
this.setState({ isRunning: false });
|
|
824
654
|
}
|
|
825
655
|
}
|
|
826
656
|
changeRunningQueryCount(dir, entry) {
|
|
827
|
-
var _a;
|
|
657
|
+
var _a, _b, _c, _d;
|
|
828
658
|
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
|
829
659
|
if (dir === 1 && this.state.enableProfiling) {
|
|
830
660
|
if (entry) {
|
|
831
|
-
this.profiler.addCrumb(`${entry.
|
|
661
|
+
(_b = this.profiler) == null ? void 0 : _b.addCrumb(`${entry.type}`);
|
|
832
662
|
}
|
|
833
|
-
if (this.profiler.isTailRecording()) {
|
|
834
|
-
writeSceneLog(
|
|
835
|
-
this.profiler.cancelTailRecording();
|
|
663
|
+
if ((_c = this.profiler) == null ? void 0 : _c.isTailRecording()) {
|
|
664
|
+
writeSceneLog("SceneQueryController", "New query started, cancelling tail recording");
|
|
665
|
+
(_d = this.profiler) == null ? void 0 : _d.cancelTailRecording();
|
|
836
666
|
}
|
|
837
667
|
}
|
|
838
668
|
if (this.state.enableProfiling) {
|
|
839
|
-
if (__privateGet$
|
|
840
|
-
cancelAnimationFrame(__privateGet$
|
|
669
|
+
if (__privateGet$3(this, _tryCompleteProfileFrameId)) {
|
|
670
|
+
cancelAnimationFrame(__privateGet$3(this, _tryCompleteProfileFrameId));
|
|
841
671
|
}
|
|
842
|
-
__privateSet$
|
|
843
|
-
|
|
672
|
+
__privateSet$3(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
|
|
673
|
+
var _a2;
|
|
674
|
+
(_a2 = this.profiler) == null ? void 0 : _a2.tryCompletingProfile();
|
|
844
675
|
}));
|
|
845
676
|
}
|
|
846
677
|
}
|
|
847
678
|
cancelAll() {
|
|
848
679
|
var _a;
|
|
849
|
-
for (const entry of __privateGet$
|
|
680
|
+
for (const entry of __privateGet$3(this, _running).values()) {
|
|
850
681
|
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
|
851
682
|
}
|
|
852
683
|
}
|
|
@@ -1016,6 +847,180 @@ function isValid$1(value, roundUp, timeZone) {
|
|
|
1016
847
|
return parsed.isValid();
|
|
1017
848
|
}
|
|
1018
849
|
|
|
850
|
+
var __typeError$2 = (msg) => {
|
|
851
|
+
throw TypeError(msg);
|
|
852
|
+
};
|
|
853
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
854
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
855
|
+
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
856
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
857
|
+
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
|
858
|
+
const POST_STORM_WINDOW = 2e3;
|
|
859
|
+
const SPAN_THRESHOLD = 30;
|
|
860
|
+
class SceneRenderProfiler {
|
|
861
|
+
constructor(queryController) {
|
|
862
|
+
this.queryController = queryController;
|
|
863
|
+
__privateAdd$2(this, _profileInProgress, null);
|
|
864
|
+
__privateAdd$2(this, _profileStartTs, null);
|
|
865
|
+
__privateAdd$2(this, _trailAnimationFrameId, null);
|
|
866
|
+
// Will keep measured lengths trailing frames
|
|
867
|
+
__privateAdd$2(this, _recordedTrailingSpans, []);
|
|
868
|
+
this.lastFrameTime = 0;
|
|
869
|
+
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
|
870
|
+
var _a;
|
|
871
|
+
const currentFrameTime = performance.now();
|
|
872
|
+
const frameLength = currentFrameTime - lastFrameTime;
|
|
873
|
+
__privateGet$2(this, _recordedTrailingSpans).push(frameLength);
|
|
874
|
+
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
|
875
|
+
if (__privateGet$2(this, _profileInProgress)) {
|
|
876
|
+
__privateSet$2(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
877
|
+
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
|
878
|
+
));
|
|
879
|
+
}
|
|
880
|
+
} else {
|
|
881
|
+
const slowFrames = processRecordedSpans(__privateGet$2(this, _recordedTrailingSpans));
|
|
882
|
+
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
|
883
|
+
writeSceneLog(
|
|
884
|
+
this.constructor.name,
|
|
885
|
+
"Profile tail recorded, slow frames duration:",
|
|
886
|
+
slowFramesTime,
|
|
887
|
+
slowFrames,
|
|
888
|
+
__privateGet$2(this, _profileInProgress)
|
|
889
|
+
);
|
|
890
|
+
__privateSet$2(this, _recordedTrailingSpans, []);
|
|
891
|
+
const profileDuration = measurementStartTs - profileStartTs;
|
|
892
|
+
writeSceneLog(
|
|
893
|
+
this.constructor.name,
|
|
894
|
+
"Stoped recording, total measured time (network included):",
|
|
895
|
+
profileDuration + slowFramesTime
|
|
896
|
+
);
|
|
897
|
+
__privateSet$2(this, _trailAnimationFrameId, null);
|
|
898
|
+
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
|
899
|
+
performance.measure(`DashboardInteraction ${__privateGet$2(this, _profileInProgress).origin}`, {
|
|
900
|
+
start: profileStartTs,
|
|
901
|
+
end: profileEndTs
|
|
902
|
+
});
|
|
903
|
+
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
|
904
|
+
if ((_a = this.queryController) == null ? void 0 : _a.state.onProfileComplete) {
|
|
905
|
+
this.queryController.state.onProfileComplete({
|
|
906
|
+
origin: __privateGet$2(this, _profileInProgress).origin,
|
|
907
|
+
crumbs: __privateGet$2(this, _profileInProgress).crumbs,
|
|
908
|
+
duration: profileDuration + slowFramesTime,
|
|
909
|
+
networkDuration,
|
|
910
|
+
// @ts-ignore
|
|
911
|
+
jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
|
|
912
|
+
// @ts-ignore
|
|
913
|
+
usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
|
|
914
|
+
// @ts-ignore
|
|
915
|
+
totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
|
|
916
|
+
});
|
|
917
|
+
__privateSet$2(this, _profileInProgress, null);
|
|
918
|
+
__privateSet$2(this, _trailAnimationFrameId, null);
|
|
919
|
+
}
|
|
920
|
+
if (window.__runs) {
|
|
921
|
+
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
922
|
+
`;
|
|
923
|
+
} else {
|
|
924
|
+
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
925
|
+
`;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
setQueryController(queryController) {
|
|
931
|
+
this.queryController = queryController;
|
|
932
|
+
}
|
|
933
|
+
startProfile(name) {
|
|
934
|
+
if (__privateGet$2(this, _profileInProgress)) {
|
|
935
|
+
this.addCrumb(name);
|
|
936
|
+
} else {
|
|
937
|
+
__privateSet$2(this, _profileInProgress, { origin: name, crumbs: [] });
|
|
938
|
+
__privateSet$2(this, _profileStartTs, performance.now());
|
|
939
|
+
writeSceneLog("SceneRenderProfiler", "Profile started:", __privateGet$2(this, _profileInProgress), __privateGet$2(this, _profileStartTs));
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
recordProfileTail(measurementStartTime, profileStartTs) {
|
|
943
|
+
__privateSet$2(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
944
|
+
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
|
945
|
+
));
|
|
946
|
+
}
|
|
947
|
+
tryCompletingProfile() {
|
|
948
|
+
var _a;
|
|
949
|
+
writeSceneLog("SceneRenderProfiler", "Trying to complete profile", __privateGet$2(this, _profileInProgress));
|
|
950
|
+
if (((_a = this.queryController) == null ? void 0 : _a.runningQueriesCount()) === 0 && __privateGet$2(this, _profileInProgress)) {
|
|
951
|
+
writeSceneLog("SceneRenderProfiler", "All queries completed, stopping profile");
|
|
952
|
+
this.recordProfileTail(performance.now(), __privateGet$2(this, _profileStartTs));
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
isTailRecording() {
|
|
956
|
+
return Boolean(__privateGet$2(this, _trailAnimationFrameId));
|
|
957
|
+
}
|
|
958
|
+
cancelTailRecording() {
|
|
959
|
+
if (__privateGet$2(this, _trailAnimationFrameId)) {
|
|
960
|
+
cancelAnimationFrame(__privateGet$2(this, _trailAnimationFrameId));
|
|
961
|
+
__privateSet$2(this, _trailAnimationFrameId, null);
|
|
962
|
+
writeSceneLog("SceneRenderProfiler", "Cancelled recording frames, new profile started");
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
addCrumb(crumb) {
|
|
966
|
+
if (__privateGet$2(this, _profileInProgress)) {
|
|
967
|
+
writeSceneLog("SceneRenderProfiler", "Adding crumb:", crumb);
|
|
968
|
+
__privateGet$2(this, _profileInProgress).crumbs.push(crumb);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
_profileInProgress = new WeakMap();
|
|
973
|
+
_profileStartTs = new WeakMap();
|
|
974
|
+
_trailAnimationFrameId = new WeakMap();
|
|
975
|
+
_recordedTrailingSpans = new WeakMap();
|
|
976
|
+
function processRecordedSpans(spans) {
|
|
977
|
+
for (let i = spans.length - 1; i >= 0; i--) {
|
|
978
|
+
if (spans[i] > SPAN_THRESHOLD) {
|
|
979
|
+
return spans.slice(0, i + 1);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return [spans[0]];
|
|
983
|
+
}
|
|
984
|
+
function captureNetwork(startTs, endTs) {
|
|
985
|
+
const entries = performance.getEntriesByType("resource");
|
|
986
|
+
performance.clearResourceTimings();
|
|
987
|
+
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
|
988
|
+
for (const entry of networkEntries) {
|
|
989
|
+
performance.measure("Network entry " + entry.name, {
|
|
990
|
+
start: entry.startTime,
|
|
991
|
+
end: entry.responseEnd
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
return calculateNetworkTime(networkEntries);
|
|
995
|
+
}
|
|
996
|
+
function calculateNetworkTime(requests) {
|
|
997
|
+
if (requests.length === 0) {
|
|
998
|
+
return 0;
|
|
999
|
+
}
|
|
1000
|
+
requests.sort((a, b) => a.startTime - b.startTime);
|
|
1001
|
+
let totalNetworkTime = 0;
|
|
1002
|
+
let currentStart = requests[0].startTime;
|
|
1003
|
+
let currentEnd = requests[0].responseEnd;
|
|
1004
|
+
for (let i = 1; i < requests.length; i++) {
|
|
1005
|
+
if (requests[i].startTime <= currentEnd) {
|
|
1006
|
+
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
|
1007
|
+
} else {
|
|
1008
|
+
totalNetworkTime += currentEnd - currentStart;
|
|
1009
|
+
currentStart = requests[i].startTime;
|
|
1010
|
+
currentEnd = requests[i].responseEnd;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
totalNetworkTime += currentEnd - currentStart;
|
|
1014
|
+
return totalNetworkTime;
|
|
1015
|
+
}
|
|
1016
|
+
const REFRESH_INTERACTION = "refresh";
|
|
1017
|
+
const TIME_RANGE_CHANGE_INTERACTION = "time_range_change";
|
|
1018
|
+
const FILTER_REMOVED_INTERACTION = "filter_removed";
|
|
1019
|
+
const FILTER_CHANGED_INTERACTION = "filter_changed";
|
|
1020
|
+
const FILTER_RESTORED_INTERACTION = "filter_restored";
|
|
1021
|
+
const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
|
|
1022
|
+
const SCOPES_CHANGED_INTERACTION = "scopes_changed";
|
|
1023
|
+
|
|
1019
1024
|
class SceneTimeRange extends SceneObjectBase {
|
|
1020
1025
|
constructor(state = {}) {
|
|
1021
1026
|
var _a;
|
|
@@ -2592,7 +2597,7 @@ async function getDataSource(datasource, scopedVars) {
|
|
|
2592
2597
|
if (queryControler && queryControler.state.enableProfiling) {
|
|
2593
2598
|
wrapPromiseInStateObservable(dsPromise).pipe(
|
|
2594
2599
|
registerQueryWithController({
|
|
2595
|
-
type: `
|
|
2600
|
+
type: `getDataSource/${(_a = datasource == null ? void 0 : datasource.type) != null ? _a : "unknown"}`,
|
|
2596
2601
|
origin: scopedVars.__sceneObject.value.valueOf()
|
|
2597
2602
|
})
|
|
2598
2603
|
).subscribe(() => {
|
|
@@ -6522,7 +6527,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
|
6522
6527
|
}
|
|
6523
6528
|
stream = stream.pipe(
|
|
6524
6529
|
registerQueryWithController({
|
|
6525
|
-
type: "
|
|
6530
|
+
type: "SceneQueryRunner/runQueries",
|
|
6526
6531
|
request: primary,
|
|
6527
6532
|
origin: this,
|
|
6528
6533
|
cancel: () => this.cancelQuery()
|
|
@@ -7443,7 +7448,7 @@ class QueryVariable extends MultiValueVariable {
|
|
|
7443
7448
|
const request = this.getRequest(target, args.searchFilter);
|
|
7444
7449
|
return runner.runRequest({ variable: this, searchFilter: args.searchFilter }, request).pipe(
|
|
7445
7450
|
registerQueryWithController({
|
|
7446
|
-
type: "
|
|
7451
|
+
type: "QueryVariable/getValueOptions",
|
|
7447
7452
|
request,
|
|
7448
7453
|
origin: this
|
|
7449
7454
|
}),
|
|
@@ -8692,7 +8697,7 @@ class VizPanel extends SceneObjectBase {
|
|
|
8692
8697
|
const panelPromise = importPanelPlugin(pluginId);
|
|
8693
8698
|
const queryControler = sceneGraph.getQueryController(this);
|
|
8694
8699
|
if (queryControler && queryControler.state.enableProfiling) {
|
|
8695
|
-
wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: `
|
|
8700
|
+
wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: `VizPanel/loadPlugin/${pluginId}`, origin: this })).subscribe(() => {
|
|
8696
8701
|
});
|
|
8697
8702
|
}
|
|
8698
8703
|
const result = await panelPromise;
|
|
@@ -9484,7 +9489,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
|
|
|
9484
9489
|
const ds = await this.resolveDataSource(query);
|
|
9485
9490
|
let stream = executeAnnotationQuery(ds, timeRange, query, this).pipe(
|
|
9486
9491
|
registerQueryWithController({
|
|
9487
|
-
type: "
|
|
9492
|
+
type: "AnnotationsDataLayer/annotationsLoading",
|
|
9488
9493
|
origin: this,
|
|
9489
9494
|
cancel: () => this.cancelQuery()
|
|
9490
9495
|
}),
|
|
@@ -14600,6 +14605,7 @@ exports.SceneObjectUrlSyncConfig = SceneObjectUrlSyncConfig;
|
|
|
14600
14605
|
exports.SceneQueryRunner = SceneQueryRunner;
|
|
14601
14606
|
exports.SceneReactObject = SceneReactObject;
|
|
14602
14607
|
exports.SceneRefreshPicker = SceneRefreshPicker;
|
|
14608
|
+
exports.SceneRenderProfiler = SceneRenderProfiler;
|
|
14603
14609
|
exports.SceneTimePicker = SceneTimePicker;
|
|
14604
14610
|
exports.SceneTimeRange = SceneTimeRange;
|
|
14605
14611
|
exports.SceneTimeRangeCompare = SceneTimeRangeCompare;
|