rails-profiler 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 786465dc498178e1ab9256de7b02b397df7db82b4fc817fc3adbe191d8170fcd
4
- data.tar.gz: acdeb2a1cdb00a59429bdf14a75f0551c4e94e65787b0640096dd5e044520999
3
+ metadata.gz: af1361f732061dbeaa22f808fb18e31d812e570eac67a7dd08687257d1400399
4
+ data.tar.gz: 0603edc83c99eb5122896e7aeb07a7cff85e944acfc45a3fc1268eae2b4e69aa
5
5
  SHA512:
6
- metadata.gz: 5e6e51705278a372284b5936aab067c5c1fc09d257561b2787e9d8a5847f608c1cdc2149b74259abc9f411b48e8369f5fd368fd934b13eb8c2a47efbafd27651
7
- data.tar.gz: f2cf3377ba982ee6135a0040d4f9d1c588c7255724d72d5fde8a38ed53cba188a40a669fa28161b906e3cc401b46405a2c24aac5d5438233e854b2e3c2ec3b74
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
  }