rails-profiler 0.15.0 → 0.17.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.
- checksums.yaml +4 -4
- data/app/assets/builds/profiler-toolbar.js +82 -34
- data/app/assets/builds/profiler.css +47 -0
- data/app/assets/builds/profiler.js +3219 -3059
- data/app/controllers/profiler/api/function_profiling_controller.rb +16 -4
- data/app/controllers/profiler/api/toolbar_controller.rb +1 -1
- data/lib/profiler/collectors/function_profiler_collector.rb +257 -35
- data/lib/profiler/railtie.rb +2 -1
- data/lib/profiler/version.rb +1 -1
- data/lib/profiler.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af1361f732061dbeaa22f808fb18e31d812e570eac67a7dd08687257d1400399
|
|
4
|
+
data.tar.gz: 0603edc83c99eb5122896e7aeb07a7cff85e944acfc45a3fc1268eae2b4e69aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e615b88c8d7253e24e00b416b1e5b6b858627a629714a6f041c77673fa1be1aee23bc57b999fc5016b101263c5fbc510594d6300994c007ccdef62ddab2fe42
|
|
7
|
+
data.tar.gz: 2cbe8336230ebd48a49b706a82d3f898516841b2b93d424a74a4f0aa9d9f23ab917e75ea91aef70a238f3c79db3460d3974765eda260e71efbee1864229b3f30
|
|
@@ -481,9 +481,6 @@
|
|
|
481
481
|
}
|
|
482
482
|
function RequestPanel({ profile, requestData }) {
|
|
483
483
|
const cls = statusClass(profile.status);
|
|
484
|
-
const headers = requestData.headers;
|
|
485
|
-
const responseBody = requestData.response_body;
|
|
486
|
-
const responseBodyEncoding = requestData.response_body_encoding;
|
|
487
484
|
const controllerAction = requestData.controller_action;
|
|
488
485
|
const routeName = requestData.route_name;
|
|
489
486
|
const routePattern = requestData.route_pattern;
|
|
@@ -529,37 +526,6 @@
|
|
|
529
526
|
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
530
527
|
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 40) })
|
|
531
528
|
] }, key))
|
|
532
|
-
] }),
|
|
533
|
-
headers && Object.keys(headers).length > 0 && /* @__PURE__ */ u3(k, { children: [
|
|
534
|
-
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Headers" }),
|
|
535
|
-
Object.entries(headers).slice(0, 5).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
536
|
-
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
537
|
-
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 50) })
|
|
538
|
-
] }, key))
|
|
539
|
-
] }),
|
|
540
|
-
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response" }),
|
|
541
|
-
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
542
|
-
/* @__PURE__ */ u3("span", { children: "Content-Type" }),
|
|
543
|
-
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: profile.response_headers?.["content-type"] || "N/A" })
|
|
544
|
-
] }),
|
|
545
|
-
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
546
|
-
/* @__PURE__ */ u3("span", { children: "Cache-Control" }),
|
|
547
|
-
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: profile.response_headers?.["cache-control"] || "N/A" })
|
|
548
|
-
] }),
|
|
549
|
-
profile.response_headers && Object.entries(profile.response_headers).filter(([k3]) => !["content-type", "cache-control"].includes(k3)).slice(0, 8).map(([key, value]) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
550
|
-
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: key }),
|
|
551
|
-
/* @__PURE__ */ u3("strong", { class: "profiler-text--xs profiler-text--mono", children: String(value).substring(0, 60) })
|
|
552
|
-
] }, key)),
|
|
553
|
-
responseBody && responseBodyEncoding !== "base64" && /* @__PURE__ */ u3(k, { children: [
|
|
554
|
-
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response Body" }),
|
|
555
|
-
/* @__PURE__ */ u3("pre", { style: "margin:0;padding:6px 0;font-size:10px;line-height:1.5;white-space:pre-wrap;word-break:break-all;color:var(--pf-text,#eef2f7);max-height:120px;overflow:hidden;", children: [
|
|
556
|
-
responseBody.substring(0, 300),
|
|
557
|
-
responseBody.length > 300 ? "\u2026" : ""
|
|
558
|
-
] })
|
|
559
|
-
] }),
|
|
560
|
-
responseBody && responseBodyEncoding === "base64" && /* @__PURE__ */ u3(k, { children: [
|
|
561
|
-
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Response Body" }),
|
|
562
|
-
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: /* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: "[binary]" }) })
|
|
563
529
|
] })
|
|
564
530
|
] })
|
|
565
531
|
] });
|
|
@@ -986,6 +952,61 @@
|
|
|
986
952
|
] });
|
|
987
953
|
}
|
|
988
954
|
|
|
955
|
+
// app/assets/typescript/profiler/components/toolbar/panels/JobsPanel.tsx
|
|
956
|
+
function JobsPanel({ jobs }) {
|
|
957
|
+
const completed = jobs.filter((j3) => j3.status === "completed").length;
|
|
958
|
+
const failed = jobs.filter((j3) => j3.status === "failed").length;
|
|
959
|
+
const preview = jobs.slice(0, 5);
|
|
960
|
+
const remaining = jobs.length - 5;
|
|
961
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
962
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
|
|
963
|
+
"Background Jobs",
|
|
964
|
+
/* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
|
|
965
|
+
jobs.length,
|
|
966
|
+
" job",
|
|
967
|
+
jobs.length !== 1 ? "s" : ""
|
|
968
|
+
] })
|
|
969
|
+
] }),
|
|
970
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
|
|
971
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header", children: "Summary" }),
|
|
972
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
973
|
+
/* @__PURE__ */ u3("span", { children: "Completed" }),
|
|
974
|
+
/* @__PURE__ */ u3("strong", { class: "profiler-text--success", children: completed })
|
|
975
|
+
] }),
|
|
976
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
977
|
+
/* @__PURE__ */ u3("span", { children: "Failed" }),
|
|
978
|
+
/* @__PURE__ */ u3("strong", { class: failed > 0 ? "profiler-text--error" : "profiler-text--muted", children: failed })
|
|
979
|
+
] }),
|
|
980
|
+
/* @__PURE__ */ u3("div", { class: "profiler-section__header profiler-mt-3", children: "Last jobs" }),
|
|
981
|
+
preview.map((job, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
982
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--xs profiler-text--mono", children: job.job_class }),
|
|
983
|
+
/* @__PURE__ */ u3("strong", { class: `profiler-text--xs profiler-text--mono ${job.status === "failed" ? "profiler-text--error" : "profiler-text--success"}`, children: [
|
|
984
|
+
job.status === "failed" ? "\u2717" : "\u2713",
|
|
985
|
+
" ",
|
|
986
|
+
job.duration?.toFixed(0),
|
|
987
|
+
"ms"
|
|
988
|
+
] })
|
|
989
|
+
] }, i3)),
|
|
990
|
+
remaining > 0 && /* @__PURE__ */ u3("div", { class: "profiler-more", children: [
|
|
991
|
+
"+ ",
|
|
992
|
+
remaining,
|
|
993
|
+
" more"
|
|
994
|
+
] })
|
|
995
|
+
] })
|
|
996
|
+
] });
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// app/assets/typescript/profiler/components/toolbar/panels/EnvPanel.tsx
|
|
1000
|
+
function EnvPanel({ envData }) {
|
|
1001
|
+
return /* @__PURE__ */ u3(k, { children: [
|
|
1002
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: "Environment" }),
|
|
1003
|
+
/* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
|
|
1004
|
+
/* @__PURE__ */ u3("span", { children: "Variables" }),
|
|
1005
|
+
/* @__PURE__ */ u3("strong", { children: envData.total })
|
|
1006
|
+
] }) })
|
|
1007
|
+
] });
|
|
1008
|
+
}
|
|
1009
|
+
|
|
989
1010
|
// app/assets/typescript/profiler/components/toolbar/ToolbarApp.tsx
|
|
990
1011
|
function statusClass2(status) {
|
|
991
1012
|
if (status >= 200 && status < 300) return "profiler-text--success";
|
|
@@ -1020,6 +1041,8 @@
|
|
|
1020
1041
|
const exceptionData = cd["exception"];
|
|
1021
1042
|
const routesData = cd["routes"];
|
|
1022
1043
|
const i18nData = cd["i18n"];
|
|
1044
|
+
const envData = cd["env"];
|
|
1045
|
+
const childJobs = profile.child_jobs ?? [];
|
|
1023
1046
|
const reqClass = statusClass2(profile.status);
|
|
1024
1047
|
const durClass = durationClass(profile.duration);
|
|
1025
1048
|
const dbClass = (dbData?.slow_queries ?? 0) > 0 ? "profiler-text--error" : "profiler-text--success";
|
|
@@ -1243,6 +1266,31 @@
|
|
|
1243
1266
|
]
|
|
1244
1267
|
}
|
|
1245
1268
|
),
|
|
1269
|
+
childJobs.length > 0 && /* @__PURE__ */ u3(
|
|
1270
|
+
ToolbarItem,
|
|
1271
|
+
{
|
|
1272
|
+
href: `/_profiler/profiles/${token}?tab=jobs`,
|
|
1273
|
+
className: childJobs.some((j3) => j3.status === "failed") ? "profiler-text--error" : "profiler-text--success",
|
|
1274
|
+
panelLarge: true,
|
|
1275
|
+
panel: /* @__PURE__ */ u3(JobsPanel, { jobs: childJobs }),
|
|
1276
|
+
children: [
|
|
1277
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "JOB" }),
|
|
1278
|
+
/* @__PURE__ */ u3("span", { children: childJobs.length }),
|
|
1279
|
+
childJobs.some((j3) => j3.status === "failed") && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: "\u2717" })
|
|
1280
|
+
]
|
|
1281
|
+
}
|
|
1282
|
+
),
|
|
1283
|
+
envData && envData.total > 0 && /* @__PURE__ */ u3(
|
|
1284
|
+
ToolbarItem,
|
|
1285
|
+
{
|
|
1286
|
+
href: `/_profiler/profiles/${token}?tab=env`,
|
|
1287
|
+
panel: /* @__PURE__ */ u3(EnvPanel, { envData }),
|
|
1288
|
+
children: [
|
|
1289
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "ENV" }),
|
|
1290
|
+
/* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: envData.total })
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1246
1294
|
/* @__PURE__ */ u3("a", { href: "/_profiler", class: "profiler-toolbar-item", children: "\u2B21 Profiler" })
|
|
1247
1295
|
] });
|
|
1248
1296
|
}
|
|
@@ -2702,6 +2702,53 @@ a.profiler-toolbar-item.profiler-text--warning::after {
|
|
|
2702
2702
|
.profiler-fn-profiling__toggle--active:hover {
|
|
2703
2703
|
background: rgba(245, 158, 11, 0.15);
|
|
2704
2704
|
}
|
|
2705
|
+
.profiler-fn-profiling__mode-selector {
|
|
2706
|
+
display: inline-flex;
|
|
2707
|
+
border: 1px solid var(--profiler-border-strong);
|
|
2708
|
+
border-radius: var(--profiler-radius-sm);
|
|
2709
|
+
overflow: hidden;
|
|
2710
|
+
}
|
|
2711
|
+
.profiler-fn-profiling__mode-btn {
|
|
2712
|
+
height: 28px;
|
|
2713
|
+
padding: 0 12px;
|
|
2714
|
+
background: var(--profiler-bg-lighter);
|
|
2715
|
+
border: none;
|
|
2716
|
+
border-right: 1px solid var(--profiler-border-strong);
|
|
2717
|
+
color: var(--profiler-text-muted);
|
|
2718
|
+
font-size: var(--profiler-text-xs);
|
|
2719
|
+
font-weight: 600;
|
|
2720
|
+
font-family: var(--profiler-font-sans);
|
|
2721
|
+
cursor: pointer;
|
|
2722
|
+
transition: all var(--profiler-transition-base);
|
|
2723
|
+
white-space: nowrap;
|
|
2724
|
+
}
|
|
2725
|
+
.profiler-fn-profiling__mode-btn:last-child {
|
|
2726
|
+
border-right: none;
|
|
2727
|
+
}
|
|
2728
|
+
.profiler-fn-profiling__mode-btn:hover:not(:disabled):not(.profiler-fn-profiling__mode-btn--active) {
|
|
2729
|
+
background: var(--profiler-bg-elevated);
|
|
2730
|
+
color: var(--profiler-text);
|
|
2731
|
+
}
|
|
2732
|
+
.profiler-fn-profiling__mode-btn--active {
|
|
2733
|
+
background: var(--profiler-accent-bg);
|
|
2734
|
+
color: var(--profiler-accent);
|
|
2735
|
+
cursor: default;
|
|
2736
|
+
}
|
|
2737
|
+
.profiler-fn-profiling__mode-btn:disabled {
|
|
2738
|
+
opacity: 0.5;
|
|
2739
|
+
cursor: not-allowed;
|
|
2740
|
+
}
|
|
2741
|
+
.profiler-fn-profiling__cpu-pct {
|
|
2742
|
+
color: var(--profiler-text-subtle);
|
|
2743
|
+
font-size: 0.85em;
|
|
2744
|
+
}
|
|
2745
|
+
.profiler-fn-profiling__gc--medium {
|
|
2746
|
+
color: #f59e0b;
|
|
2747
|
+
}
|
|
2748
|
+
.profiler-fn-profiling__gc--high {
|
|
2749
|
+
color: #ef4444;
|
|
2750
|
+
font-weight: 600;
|
|
2751
|
+
}
|
|
2705
2752
|
.profiler-fn-profiling__hint {
|
|
2706
2753
|
margin: 12px 0 0;
|
|
2707
2754
|
padding: 10px 14px;
|