boto-rb-management-ui 0.31.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +22 -0
- data/db/migrations/20261201000001_create_boto_monitor_instances.rb +14 -0
- data/db/migrations/20261201000002_create_boto_monitor_series.rb +20 -0
- data/db/migrations/20261201000003_create_boto_monitor_errors.rb +19 -0
- data/db/migrations/20261201000004_create_boto_monitor_traces.rb +19 -0
- data/db/migrations/20261201000005_create_boto_monitor_runtime.rb +23 -0
- data/db/migrations/20261201000006_create_boto_monitor_n_plus_ones.rb +17 -0
- data/db/migrations/20261201000007_add_browser_data_to_boto_monitor.rb +31 -0
- data/db/migrations/20261203000001_create_boto_monitor_streams.rb +24 -0
- data/db/migrations/20261203000002_add_streams_open_to_boto_monitor_instances.rb +12 -0
- data/lib/boto/companions/management_ui.rb +8 -0
- data/lib/boto/management_ui/app.rb +84 -0
- data/lib/boto/management_ui/app_traits.rb +34 -0
- data/lib/boto/management_ui/assets/monitor/api.js +36 -0
- data/lib/boto/management_ui/assets/monitor/charts.js +212 -0
- data/lib/boto/management_ui/assets/monitor/constants.js +70 -0
- data/lib/boto/management_ui/assets/monitor/dom.js +70 -0
- data/lib/boto/management_ui/assets/monitor/format.js +76 -0
- data/lib/boto/management_ui/assets/monitor/header.js +2 -0
- data/lib/boto/management_ui/assets/monitor/main.js +33 -0
- data/lib/boto/management_ui/assets/monitor/panes.js +109 -0
- data/lib/boto/management_ui/assets/monitor/runtime.js +26 -0
- data/lib/boto/management_ui/assets/monitor/services.js +174 -0
- data/lib/boto/management_ui/assets/monitor/spa.js +203 -0
- data/lib/boto/management_ui/assets/monitor/traces.js +88 -0
- data/lib/boto/management_ui/assets/panel/base.css +87 -0
- data/lib/boto/management_ui/assets/panel/errors.css +36 -0
- data/lib/boto/management_ui/assets/panel/gateway.css +3 -0
- data/lib/boto/management_ui/assets/panel/layout.css +63 -0
- data/lib/boto/management_ui/assets/panel/monitor_layout.css +77 -0
- data/lib/boto/management_ui/assets/panel/monitor_tables.css +97 -0
- data/lib/boto/management_ui/assets/panel/service_view.css +102 -0
- data/lib/boto/management_ui/assets/panel/services.css +55 -0
- data/lib/boto/management_ui/assets/panel/spa.css +41 -0
- data/lib/boto/management_ui/assets/panel/tables.css +67 -0
- data/lib/boto/management_ui/assets/panel/tabs.css +71 -0
- data/lib/boto/management_ui/assets/panel/traces.css +45 -0
- data/lib/boto/management_ui/browser_telemetry.rb +87 -0
- data/lib/boto/management_ui/gateway_view.rb +57 -0
- data/lib/boto/management_ui/health_probe.rb +70 -0
- data/lib/boto/management_ui/in_process_receiver.rb +17 -0
- data/lib/boto/management_ui/monitor/api.rb +87 -0
- data/lib/boto/management_ui/monitor/batch_schema/browser_call_entry.rb +26 -0
- data/lib/boto/management_ui/monitor/batch_schema/browser_error_entry.rb +41 -0
- data/lib/boto/management_ui/monitor/batch_schema/checks.rb +90 -0
- data/lib/boto/management_ui/monitor/batch_schema/error_entry.rb +37 -0
- data/lib/boto/management_ui/monitor/batch_schema/n_plus_one_entry.rb +30 -0
- data/lib/boto/management_ui/monitor/batch_schema/page_entry.rb +25 -0
- data/lib/boto/management_ui/monitor/batch_schema/runtime.rb +33 -0
- data/lib/boto/management_ui/monitor/batch_schema/series.rb +41 -0
- data/lib/boto/management_ui/monitor/batch_schema/streams.rb +46 -0
- data/lib/boto/management_ui/monitor/batch_schema/trace_entry.rb +45 -0
- data/lib/boto/management_ui/monitor/batch_schema.rb +138 -0
- data/lib/boto/management_ui/monitor/ingest.rb +126 -0
- data/lib/boto/management_ui/monitor/memory_store/error_table.rb +53 -0
- data/lib/boto/management_ui/monitor/memory_store/instance_table.rb +45 -0
- data/lib/boto/management_ui/monitor/memory_store/n_plus_one_table.rb +44 -0
- data/lib/boto/management_ui/monitor/memory_store/runtime_table.rb +55 -0
- data/lib/boto/management_ui/monitor/memory_store/series_table.rb +49 -0
- data/lib/boto/management_ui/monitor/memory_store/staleness.rb +20 -0
- data/lib/boto/management_ui/monitor/memory_store/stream_table.rb +36 -0
- data/lib/boto/management_ui/monitor/memory_store/trace_table.rb +41 -0
- data/lib/boto/management_ui/monitor/memory_store.rb +118 -0
- data/lib/boto/management_ui/monitor/percentile.rb +38 -0
- data/lib/boto/management_ui/monitor/period.rb +48 -0
- data/lib/boto/management_ui/monitor/queries/browser_calls.rb +56 -0
- data/lib/boto/management_ui/monitor/queries/browser_view.rb +91 -0
- data/lib/boto/management_ui/monitor/queries/charts.rb +66 -0
- data/lib/boto/management_ui/monitor/queries/live_instances.rb +44 -0
- data/lib/boto/management_ui/monitor/queries/points.rb +61 -0
- data/lib/boto/management_ui/monitor/queries/route_view.rb +46 -0
- data/lib/boto/management_ui/monitor/queries/runtime_view.rb +80 -0
- data/lib/boto/management_ui/monitor/queries/service_cards.rb +65 -0
- data/lib/boto/management_ui/monitor/queries/streams.rb +39 -0
- data/lib/boto/management_ui/monitor/queries/trace_tree.rb +47 -0
- data/lib/boto/management_ui/monitor/queries/vitals.rb +50 -0
- data/lib/boto/management_ui/monitor/queries.rb +171 -0
- data/lib/boto/management_ui/monitor/retention.rb +62 -0
- data/lib/boto/management_ui/monitor/schema.rb +64 -0
- data/lib/boto/management_ui/monitor/sql_store/error_writer.rb +62 -0
- data/lib/boto/management_ui/monitor/sql_store/instance_writer.rb +63 -0
- data/lib/boto/management_ui/monitor/sql_store/n_plus_one_writer.rb +50 -0
- data/lib/boto/management_ui/monitor/sql_store/rows.rb +99 -0
- data/lib/boto/management_ui/monitor/sql_store/series_writer.rb +52 -0
- data/lib/boto/management_ui/monitor/sql_store/streams_writer.rb +34 -0
- data/lib/boto/management_ui/monitor/sql_store.rb +139 -0
- data/lib/boto/management_ui/monitor/store.rb +78 -0
- data/lib/boto/management_ui/monitor/stream_point.rb +45 -0
- data/lib/boto/management_ui/panel/env_rows.rb +54 -0
- data/lib/boto/management_ui/panel/html_view.rb +43 -0
- data/lib/boto/management_ui/panel/json_view.rb +43 -0
- data/lib/boto/management_ui/panel/masking.rb +43 -0
- data/lib/boto/management_ui/panel/page.rb +41 -0
- data/lib/boto/management_ui/panel/service_info.rb +62 -0
- data/lib/boto/management_ui/panel.html.erb +207 -0
- data/lib/boto/management_ui/panel.rb +115 -0
- data/lib/boto/management_ui/password_auth.rb +26 -0
- data/lib/boto/management_ui/service_list.rb +59 -0
- data/lib/boto/management_ui/setup.rb +103 -0
- data/lib/boto/management_ui/spas.rb +73 -0
- data/lib/boto/management_ui/tabs.rb +40 -0
- data/lib/boto/management_ui/version.rb +7 -0
- data/lib/boto/management_ui.rb +15 -0
- metadata +203 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// ---------- Charts ----------
|
|
2
|
+
|
|
3
|
+
// ---------- Spa (frontend telemetry) ----------
|
|
4
|
+
|
|
5
|
+
function isSpa(service) { return service.kind === "spa"; }
|
|
6
|
+
|
|
7
|
+
function kindBadge(service) {
|
|
8
|
+
return isSpa(service) ? el("span", { className: "badge badge--spa" }, "spa") : null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// The number and its unit, as the stat cards show a time: "1,9 s" or "140 ms".
|
|
12
|
+
function timeParts(milliseconds) {
|
|
13
|
+
return milliseconds >= MS_PER_SECOND ? [fmt(milliseconds / MS_PER_SECOND, 1), "s"] : [fmt(milliseconds, 0), "ms"];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// CLS has no unit; the other vitals are times. Missing data is "—".
|
|
17
|
+
function vitalParts(name, metric) {
|
|
18
|
+
if (!metric || metric.p75 == null) return ["—", null];
|
|
19
|
+
return name === "CLS" ? [fmt(metric.p75, 2), null] : timeParts(metric.p75);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function vitalText(name, metric) {
|
|
23
|
+
return vitalParts(name, metric).filter(Boolean).join(" ");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function vitalBadge(name, metric) {
|
|
27
|
+
if (!metric || metric.p75 == null) return el("span", { className: "muted" }, "—");
|
|
28
|
+
return el("span", { className: "vital " + (VITAL_CLASSES[metric.rating] || "") }, vitalText(name, metric));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The rating says where the p75 stands; the good limit is the one the tip gives.
|
|
32
|
+
function vitalDelta(name, metric) {
|
|
33
|
+
var rating = RATING_TEXT[metric && metric.rating];
|
|
34
|
+
return rating ? rating + " · limite " + VITAL_GOOD[name] : "sem dados";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The ⓘ button and its tooltip. CSS shows the tip on hover and on focus; aria-describedby links them.
|
|
38
|
+
function info(key) {
|
|
39
|
+
var entry = INFO[key];
|
|
40
|
+
var id = "tip-" + key.toLowerCase();
|
|
41
|
+
return el("span", { className: "info" }, [
|
|
42
|
+
el("button", { type: "button", className: "info__btn", "aria-label": "O que é " + entry.label, "aria-describedby": id }, "i"),
|
|
43
|
+
el("span", { className: "info__tip", role: "tooltip", id: id }, [
|
|
44
|
+
el("strong", null, entry.title), ": " + entry.text,
|
|
45
|
+
entry.limits ? el("span", { className: "limits" }, entry.limits) : null
|
|
46
|
+
])
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function labelWithInfo(key) { return [INFO[key].label, " ", info(key)]; }
|
|
51
|
+
|
|
52
|
+
function vitalStat(name, metric) {
|
|
53
|
+
var parts = vitalParts(name, metric);
|
|
54
|
+
return stat(labelWithInfo(name), parts[0], parts[1], vitalDelta(name, metric), metric && VITAL_TONES[metric.rating]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function pagesSummary(summary) {
|
|
58
|
+
var rate = summary.error_rate;
|
|
59
|
+
return el("section", { className: "summary", "aria-label": "Resumo das páginas" }, [
|
|
60
|
+
stat(labelWithInfo("views"), fmt(summary.views_per_second, 1), "/s", fmt(summary.views, 0) + " no período"),
|
|
61
|
+
vitalStat("LCP", summary.vitals.LCP),
|
|
62
|
+
vitalStat("INP", summary.vitals.INP),
|
|
63
|
+
vitalStat("CLS", summary.vitals.CLS),
|
|
64
|
+
stat(labelWithInfo("errors"), percent(rate), null, "das visualizações", rate > 0 ? "failing" : null)
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function pagesPane() {
|
|
69
|
+
return load(servicePath() + "/pages.json").then(function (data) {
|
|
70
|
+
return [pagesSummary(data.summary), pagesCharts(data.charts), vitalsLegend(),
|
|
71
|
+
data.routes.length ? grid(PAGE_HEADERS, data.routes.map(pageRow), null) : note(MESSAGES.noRequests)];
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function pageRow(route) {
|
|
76
|
+
return row([cell(route.route, "route-path"), cell(fmt(route.views, 0), "num")].concat(
|
|
77
|
+
PAGE_VITALS.map(function (name) { return cell(vitalBadge(name, route.vitals[name]), "num"); })));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function pagesCharts(charts) {
|
|
81
|
+
return chartsRow([viewsChart(charts), vitalChart("LCP", charts.lcp, charts.step), vitalChart("INP", charts.inp, charts.step)]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function viewsChart(charts) {
|
|
85
|
+
return chartConfig({
|
|
86
|
+
title: "Visualizações", step: charts.step, times: column(charts.views, "at"),
|
|
87
|
+
series: [line("visualizações", COLORS.total, column(charts.views, "per_second"), { fill: "#fdf2f1" })],
|
|
88
|
+
format: function (value) { return fmt(value, 1) + " /s"; },
|
|
89
|
+
tick: function (value) { return fmt(value, 1); }
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// The p75 of a vital over time, with its good limit drawn as the dashed line.
|
|
94
|
+
function vitalChart(name, rows, step) {
|
|
95
|
+
return chartConfig({
|
|
96
|
+
title: name + " p75", step: step, times: column(rows, "at"),
|
|
97
|
+
series: [line("p75", COLORS.p95, column(rows, "p75"))],
|
|
98
|
+
limit: VITAL_LIMITS[name],
|
|
99
|
+
format: function (value) { return timeParts(value).join(" "); },
|
|
100
|
+
tick: function (value) { return fmt(value, 0); }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function vitalsLegend() {
|
|
105
|
+
return el("div", { className: "legend", "aria-label": "Legenda dos selos" }, [
|
|
106
|
+
el("span", null, "Selos pelos limites oficiais dos Web Vitals:"),
|
|
107
|
+
Object.keys(RATING_TEXT).map(function (rating) {
|
|
108
|
+
return el("span", null, el("span", { className: "vital " + VITAL_CLASSES[rating] }, RATING_TEXT[rating]));
|
|
109
|
+
})
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function jsErrorsPane() {
|
|
114
|
+
return load(servicePath() + "/browser_errors.json").then(function (data) {
|
|
115
|
+
return data.errors.length ? [data.errors.map(browserErrorRow), note(MESSAGES.jsErrors)] : note(MESSAGES.noJsErrors);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function browserErrorRow(error) {
|
|
120
|
+
return el("div", { className: "error-row" }, [
|
|
121
|
+
el("div", null, [
|
|
122
|
+
el("span", { className: "error-class" }, error.class),
|
|
123
|
+
el("div", { className: "error-msg" }, error.message),
|
|
124
|
+
el("div", { className: "error-meta" }, [
|
|
125
|
+
error.location || "—", " · página ", el("span", { className: "route-path" }, error.route || "—"),
|
|
126
|
+
" · primeira vez ", ago(error.first_at), " · última ", ago(error.last_at)
|
|
127
|
+
]),
|
|
128
|
+
browsersChips(error.browsers)
|
|
129
|
+
]),
|
|
130
|
+
occurrences(error.count),
|
|
131
|
+
error.backtrace.length ? el("pre", { className: "backtrace" }, error.backtrace.join("\n")) : null
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Browser family and major version, with how many errors each had: "Chrome 131 · 24".
|
|
136
|
+
function browsersChips(browsers) {
|
|
137
|
+
return el("div", { className: "chips", "aria-label": "Navegadores" }, Object.keys(browsers).map(function (name) {
|
|
138
|
+
return el("span", { className: "chip" }, name + " · " + fmt(browsers[name], 0));
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function apisPane() {
|
|
143
|
+
return load(servicePath() + "/browser_calls.json").then(function (data) {
|
|
144
|
+
return data.browser_calls.length
|
|
145
|
+
? [splitLegend(), grid(API_HEADERS, data.browser_calls.map(callRow), null), note(MESSAGES.calls)]
|
|
146
|
+
: note(MESSAGES.noCalls);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Without a value, the service has not sent this operationId yet: it runs a Boto older than the spa's.
|
|
151
|
+
function serviceP95Cell(seconds) {
|
|
152
|
+
var td = cell(ms(seconds), "num");
|
|
153
|
+
if (seconds == null) td.title = "Sem dados do serviço para esta operação no período. O serviço precisa rodar a mesma versão do Boto que o spa, que grava o operationId nas rotas.";
|
|
154
|
+
return td;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function callRow(call) {
|
|
158
|
+
return row([
|
|
159
|
+
cell(call.ref),
|
|
160
|
+
cell(call.operation, "route-path"),
|
|
161
|
+
cell(fmt(call.calls, 0), "num"),
|
|
162
|
+
cell(ms(call.p50), "num"),
|
|
163
|
+
cell(ms(call.p95), "num"),
|
|
164
|
+
cell(ms(call.p99), "num"),
|
|
165
|
+
serviceP95Cell(call.service_p95),
|
|
166
|
+
cell(latencySplit(call.p95, call.service_p95)),
|
|
167
|
+
cell(percent(call.error_rate), errorClass(call.error_rate, "num"))
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// The browser's p95, split into the service's share and the rest (network, ingress, queue).
|
|
172
|
+
// Without the service's number, the bar is only the browser's time.
|
|
173
|
+
function latencySplit(total, service) {
|
|
174
|
+
if (total == null) return "—";
|
|
175
|
+
if (service == null) {
|
|
176
|
+
return el("span", { className: "split", role: "img", "aria-label": ms(total) + " no navegador" },
|
|
177
|
+
el("i", { className: "browser", style: "width:100%" }));
|
|
178
|
+
}
|
|
179
|
+
var local = Math.min(service, total);
|
|
180
|
+
var network = total - local;
|
|
181
|
+
return [el("span", { className: "split", role: "img", "aria-label": ms(local) + " no serviço, " + ms(network) + " de rede" }, [
|
|
182
|
+
el("i", { className: "svc", style: "width:" + share(local, total) }),
|
|
183
|
+
el("i", { className: "net", style: "width:" + share(network, total) })
|
|
184
|
+
]), el("span", { className: "muted" }, "+" + ms(network))];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function splitLegend() {
|
|
188
|
+
return el("div", { className: "legend", "aria-label": "Legenda da barra" }, [
|
|
189
|
+
el("span", null, "p95 no navegador, dividido em"),
|
|
190
|
+
el("span", null, [el("i", { className: "svc" }), "tempo no serviço (p95 do :telemetry)"]),
|
|
191
|
+
el("span", null, [el("i", { className: "net" }), "rede, ingress e fila"])
|
|
192
|
+
]);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function spaSummaryText(pages) {
|
|
196
|
+
return [
|
|
197
|
+
fmt(pages.views_per_second, 1) + " visualizações/s",
|
|
198
|
+
"LCP p75 " + vitalText("LCP", pages.vitals.LCP),
|
|
199
|
+
"INP p75 " + vitalText("INP", pages.vitals.INP),
|
|
200
|
+
"erros de JS em " + percent(pages.error_rate) + " das visualizações"
|
|
201
|
+
].join(" · ");
|
|
202
|
+
}
|
|
203
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function tracesPane() {
|
|
2
|
+
return Promise.all([load(servicePath() + "/traces.json"), detailOf(state.traceId)]).then(function (pair) {
|
|
3
|
+
var traces = pair[0].traces;
|
|
4
|
+
return [traces.length ? tracesGrid(traces) : note(MESSAGES.noTraces), pair[1]];
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function detailOf(traceId) {
|
|
9
|
+
if (!traceId) return Promise.resolve(null);
|
|
10
|
+
var trace = load(servicePath() + "/traces/" + encodeURIComponent(traceId) + ".json").catch(function () { return null; });
|
|
11
|
+
return Promise.all([trace, load(servicePath() + "/n_plus_ones.json")]).then(function (pair) {
|
|
12
|
+
return pair[0] ? traceDetail(pair[0], pair[1].n_plus_ones) : note(MESSAGES.traceMissing);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function tracesGrid(traces) {
|
|
17
|
+
return grid(TRACE_HEADERS, traces.map(function (trace) {
|
|
18
|
+
return row([
|
|
19
|
+
cell(ago(trace.started_at), "muted"),
|
|
20
|
+
cell([verbBadge(trace.verb), " ", el("span", { className: "route-path" }, trace.route || trace.path)]),
|
|
21
|
+
cell(statusBadge(trace.status), "num"),
|
|
22
|
+
cell(ms(trace.duration), "num"),
|
|
23
|
+
cell(reasonBadge(trace.reason))
|
|
24
|
+
], function () { openTrace(trace.trace_id); }, trace.trace_id === state.traceId);
|
|
25
|
+
}), null);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function traceDetail(trace, groups) {
|
|
29
|
+
var head = el("div", { className: "trace__head" }, [
|
|
30
|
+
el("span", null, [verbBadge(trace.verb), " ", el("span", { className: "route-path" }, trace.route || trace.path),
|
|
31
|
+
" · ", statusBadge(trace.status), " · ", el("strong", null, ms(trace.duration))]),
|
|
32
|
+
el("span", { className: "muted" }, "trace " + shortId(trace.trace_id))
|
|
33
|
+
]);
|
|
34
|
+
var repeats = repeatedQueries(trace, groups).map(repeatedQueryNote);
|
|
35
|
+
return [el("div", { className: "trace" }, [head, traceLines(trace, 0)])].concat(repeats, [note(MESSAGES.sql)]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The N+1 groups of this route that ran at least MIN_REPEATS times as sql spans of this trace.
|
|
39
|
+
function repeatedQueries(trace, groups) {
|
|
40
|
+
return groups.filter(function (group) {
|
|
41
|
+
return group.verb === trace.verb && group.route === trace.route;
|
|
42
|
+
}).map(function (group) {
|
|
43
|
+
return { sql: group.sql, times: countSql(trace, group.sql) };
|
|
44
|
+
}).filter(function (entry) { return entry.times >= MIN_REPEATS; });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function countSql(trace, sql) {
|
|
48
|
+
return trace.spans.filter(function (span) { return span.kind === "sql" && span.name === sql; }).length;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function repeatedQueryNote(entry) {
|
|
52
|
+
return el("div", { className: "n1-note" }, [
|
|
53
|
+
el("strong", null, "Possível N+1: "), el("span", { className: "sql" }, entry.sql),
|
|
54
|
+
" rodou " + entry.times + " vezes neste request."
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// The waterfall of a trace. Under each http span, the trace of the service it called, one level deeper.
|
|
59
|
+
// The children come from the server, already nested, so each level only looks at its own http spans.
|
|
60
|
+
function traceLines(trace, depth) {
|
|
61
|
+
var lines = [spanLine(requestName(trace, depth), "span__bar--request", 0, trace.duration, trace.duration, depth * INDENT)];
|
|
62
|
+
trace.spans.slice().sort(function (a, b) { return a.start - b.start; }).forEach(function (span) {
|
|
63
|
+
lines.push(spanLine(span.name, SPAN_CLASSES[span.kind], span.start, span.duration, trace.duration, (depth + 1) * INDENT));
|
|
64
|
+
trace.children.filter(function (child) { return child.parent_id === span.id; }).forEach(function (child) {
|
|
65
|
+
lines.push(traceLines(child, depth + 1));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return lines;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// A called service's request gets its name as a tag, as the design shows.
|
|
72
|
+
function requestName(trace, depth) {
|
|
73
|
+
var request = trace.verb + " " + (trace.route || trace.path);
|
|
74
|
+
return depth === 0 ? request : [el("span", { className: "span__svc" }, trace.service), request];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function spanLine(name, barClass, start, duration, total, indent) {
|
|
78
|
+
return el("div", { className: "span" }, [
|
|
79
|
+
el("span", { className: "span__name", style: "padding-left:" + indent + "px" }, name),
|
|
80
|
+
el("span", { className: "span__track" }, el("span", {
|
|
81
|
+
className: "span__bar " + barClass, style: "left:" + share(start, total) + ";width:" + share(duration, total)
|
|
82
|
+
})),
|
|
83
|
+
el("span", { className: "span__ms" }, ms(duration))
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function share(part, total) { return total > 0 ? (part / total * 100).toFixed(2) + "%" : "0%"; }
|
|
88
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* Panel styles, served once from /_boto/panel.css. Colours follow the approved design. */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--ink: #1f1f24;
|
|
5
|
+
--muted: #52525b;
|
|
6
|
+
--line: #e4e4e7;
|
|
7
|
+
--line-soft: #f0f0f1;
|
|
8
|
+
--surface: #ffffff;
|
|
9
|
+
--page: #f6f6f7;
|
|
10
|
+
--mono: ui-monospace, "SF Mono", Menlo, monospace;
|
|
11
|
+
--sans: "Avenir Next", Avenir, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
* { box-sizing: border-box; }
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
background: var(--page);
|
|
19
|
+
color: var(--ink);
|
|
20
|
+
font-family: var(--sans);
|
|
21
|
+
font-size: 15px;
|
|
22
|
+
line-height: 1.5;
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
a { color: var(--ink); }
|
|
27
|
+
a:hover { color: #cc342d; }
|
|
28
|
+
|
|
29
|
+
h1, h2 { margin: 0; }
|
|
30
|
+
|
|
31
|
+
.muted { color: var(--muted); font-size: 13px; }
|
|
32
|
+
|
|
33
|
+
/* Top bar */
|
|
34
|
+
|
|
35
|
+
.topbar { background: var(--ink); color: #ffffff; }
|
|
36
|
+
|
|
37
|
+
.topbar__inner,
|
|
38
|
+
.topbar__brand,
|
|
39
|
+
.topbar__nav,
|
|
40
|
+
.service__head,
|
|
41
|
+
.service__identity,
|
|
42
|
+
.service__status,
|
|
43
|
+
.section-head,
|
|
44
|
+
.card__summary,
|
|
45
|
+
.footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-wrap: wrap;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.topbar__inner {
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
gap: 12px;
|
|
54
|
+
max-width: 1120px;
|
|
55
|
+
margin: 0 auto;
|
|
56
|
+
padding: 14px 24px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.topbar__brand { gap: 12px; }
|
|
60
|
+
|
|
61
|
+
.topbar__nav {
|
|
62
|
+
gap: 20px;
|
|
63
|
+
font-size: 14px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.topbar a { color: #ffffff; }
|
|
67
|
+
|
|
68
|
+
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
|
|
69
|
+
|
|
70
|
+
.gateway-name { font-size: 16px; font-weight: 600; }
|
|
71
|
+
|
|
72
|
+
.topbar .muted { color: #a1a1aa; }
|
|
73
|
+
|
|
74
|
+
.env-badge {
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
padding: 2px 10px;
|
|
78
|
+
border-radius: 999px;
|
|
79
|
+
background: #3f3f46;
|
|
80
|
+
color: #fde68a;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.host {
|
|
84
|
+
font-family: var(--mono);
|
|
85
|
+
color: #d4d4d8;
|
|
86
|
+
}
|
|
87
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* Monitor: errors */
|
|
2
|
+
|
|
3
|
+
.error-row {
|
|
4
|
+
padding: 14px 22px;
|
|
5
|
+
border-top: 1px solid var(--line-soft);
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 1fr auto;
|
|
8
|
+
gap: 4px 16px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.error-row:first-child { border-top: 0; }
|
|
12
|
+
|
|
13
|
+
.error-class { font-family: var(--mono); font-weight: 700; color: #b42318; }
|
|
14
|
+
|
|
15
|
+
.error-msg { font-family: var(--mono); font-size: 14px; word-break: break-word; }
|
|
16
|
+
|
|
17
|
+
.error-meta { font-size: 13px; color: var(--muted); }
|
|
18
|
+
|
|
19
|
+
.error-count { text-align: right; font-size: 22px; font-weight: 700; }
|
|
20
|
+
|
|
21
|
+
.error-count small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
|
|
22
|
+
|
|
23
|
+
.backtrace {
|
|
24
|
+
grid-column: 1 / -1;
|
|
25
|
+
margin: 6px 0 0;
|
|
26
|
+
padding: 10px 14px;
|
|
27
|
+
background: #fafafa;
|
|
28
|
+
border: 1px solid var(--line-soft);
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
font-family: var(--mono);
|
|
31
|
+
font-size: 12.5px;
|
|
32
|
+
color: var(--muted);
|
|
33
|
+
white-space: pre;
|
|
34
|
+
overflow-x: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* Layout */
|
|
2
|
+
|
|
3
|
+
.panel {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 28px;
|
|
7
|
+
max-width: 1120px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 32px 24px 48px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.summary {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
15
|
+
gap: 16px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.stat {
|
|
19
|
+
background: var(--surface);
|
|
20
|
+
border: 1px solid var(--line);
|
|
21
|
+
border-radius: 12px;
|
|
22
|
+
padding: 16px 20px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.stat__label { font-size: 13px; color: var(--muted); }
|
|
26
|
+
|
|
27
|
+
.stat__value { font-size: 28px; font-weight: 700; }
|
|
28
|
+
|
|
29
|
+
.stat__value--ready { color: #166534; }
|
|
30
|
+
|
|
31
|
+
.stat__value--failing { color: #b42318; }
|
|
32
|
+
|
|
33
|
+
.card,
|
|
34
|
+
.service {
|
|
35
|
+
background: var(--surface);
|
|
36
|
+
border: 1px solid var(--line);
|
|
37
|
+
border-radius: 14px;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.card__summary,
|
|
42
|
+
.service__env-summary {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.card__summary {
|
|
47
|
+
gap: 12px;
|
|
48
|
+
padding: 16px 22px;
|
|
49
|
+
align-items: baseline;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.card__title { display: inline; font-size: 19px; font-weight: 700; }
|
|
53
|
+
|
|
54
|
+
.services { display: flex; flex-direction: column; gap: 20px; }
|
|
55
|
+
|
|
56
|
+
.section-head {
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
align-items: baseline;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.section-title { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
|
|
63
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* Monitor: layout, source strip and range */
|
|
2
|
+
|
|
3
|
+
.monitor { display: flex; flex-direction: column; gap: 16px; }
|
|
4
|
+
|
|
5
|
+
.monitor__head { margin-bottom: 4px; }
|
|
6
|
+
|
|
7
|
+
.source {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: 8px 20px;
|
|
11
|
+
align-items: center;
|
|
12
|
+
font-size: 13px;
|
|
13
|
+
color: var(--muted);
|
|
14
|
+
padding: 10px 16px;
|
|
15
|
+
background: var(--surface);
|
|
16
|
+
border: 1px solid var(--line);
|
|
17
|
+
border-radius: 10px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.source strong { color: var(--ink); font-weight: 600; }
|
|
21
|
+
|
|
22
|
+
.dot {
|
|
23
|
+
width: 8px;
|
|
24
|
+
height: 8px;
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
background: #16a34a;
|
|
28
|
+
margin-right: 6px;
|
|
29
|
+
box-shadow: 0 0 0 3px #dcfce7;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.segmented {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
border: 1px solid var(--line);
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
background: var(--surface);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.segmented button {
|
|
41
|
+
font: inherit;
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
border: 0;
|
|
44
|
+
background: none;
|
|
45
|
+
padding: 5px 12px;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
color: var(--muted);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.segmented button + button { border-left: 1px solid var(--line); }
|
|
51
|
+
|
|
52
|
+
.segmented button[aria-pressed="true"] { background: var(--ink); color: #ffffff; }
|
|
53
|
+
|
|
54
|
+
.monitor .section-title { font-size: 24px; }
|
|
55
|
+
|
|
56
|
+
.monitor .card__head {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
gap: 12px;
|
|
62
|
+
padding: 16px 22px;
|
|
63
|
+
border-bottom: 1px solid var(--line-soft);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.monitor .summary { margin: 0; }
|
|
67
|
+
|
|
68
|
+
.monitor .stat__value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; }
|
|
69
|
+
|
|
70
|
+
.monitor .stat__delta { font-size: 12px; color: var(--muted); }
|
|
71
|
+
|
|
72
|
+
.monitor .stat__value--failing { color: #b42318; }
|
|
73
|
+
|
|
74
|
+
.monitor .note { font-size: 13px; color: var(--muted); padding: 0 22px 16px; margin: 0; }
|
|
75
|
+
|
|
76
|
+
.monitor .card__head .card__title { display: inline; }
|
|
77
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* Monitor: tables (scoped so the services tab keeps its own) */
|
|
2
|
+
|
|
3
|
+
.monitor .table-wrap { overflow-x: auto; padding: 0 22px 16px; }
|
|
4
|
+
|
|
5
|
+
.monitor table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
6
|
+
|
|
7
|
+
.monitor thead { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
|
|
8
|
+
|
|
9
|
+
.monitor th { text-align: left; font-weight: 600; padding: 10px 12px 6px 0; }
|
|
10
|
+
|
|
11
|
+
.monitor td {
|
|
12
|
+
padding: 9px 12px 9px 0;
|
|
13
|
+
border-top: 1px solid var(--line-soft);
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.monitor table.compact td,
|
|
18
|
+
.monitor table.compact th { padding-right: 10px; }
|
|
19
|
+
|
|
20
|
+
.monitor th.num,
|
|
21
|
+
.monitor td.num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
22
|
+
|
|
23
|
+
.monitor tr.clickable { cursor: pointer; }
|
|
24
|
+
|
|
25
|
+
.monitor tr.clickable:hover td { background: #fafafa; }
|
|
26
|
+
|
|
27
|
+
.monitor tr.selected td { background: #fdf2f1; }
|
|
28
|
+
|
|
29
|
+
.monitor .route-path { font-family: var(--mono); }
|
|
30
|
+
|
|
31
|
+
.monitor .err { color: #b42318; font-weight: 600; }
|
|
32
|
+
|
|
33
|
+
.monitor .slow { color: #9a3412; font-weight: 600; }
|
|
34
|
+
|
|
35
|
+
.link {
|
|
36
|
+
font: inherit;
|
|
37
|
+
font-size: 13px;
|
|
38
|
+
color: #1e40af;
|
|
39
|
+
background: none;
|
|
40
|
+
border: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
text-decoration: underline;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.verb { display: inline-block; min-width: 58px; text-align: center; }
|
|
47
|
+
|
|
48
|
+
.verb--query { background: #ede9fe; color: #5b21b6; }
|
|
49
|
+
|
|
50
|
+
.status { font-family: var(--mono); font-weight: 700; }
|
|
51
|
+
|
|
52
|
+
.status--5 { color: #b42318; }
|
|
53
|
+
|
|
54
|
+
.status--4 { color: #9a3412; }
|
|
55
|
+
|
|
56
|
+
.status--2 { color: #166534; }
|
|
57
|
+
|
|
58
|
+
.badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
|
|
59
|
+
|
|
60
|
+
.badge--error { background: #fee2e2; color: #b42318; }
|
|
61
|
+
|
|
62
|
+
.badge--slow { background: #ffedd5; color: #9a3412; }
|
|
63
|
+
|
|
64
|
+
.badge--sample { background: #f4f4f5; color: var(--muted); }
|
|
65
|
+
|
|
66
|
+
.badge--n1 { background: #ede9fe; color: #5b21b6; }
|
|
67
|
+
|
|
68
|
+
.badge--stream { background: #e0f2fe; color: #075985; }
|
|
69
|
+
|
|
70
|
+
.streams__title { margin: 22px 0 4px; font-size: 14px; }
|
|
71
|
+
|
|
72
|
+
.badge--parent { background: #e4e4e7; color: #3f3f46; }
|
|
73
|
+
|
|
74
|
+
/* Monitor: sparklines and meters */
|
|
75
|
+
|
|
76
|
+
.spark { width: 90px; height: 22px; vertical-align: middle; }
|
|
77
|
+
|
|
78
|
+
.sql { font-family: var(--mono); font-size: 13px; }
|
|
79
|
+
|
|
80
|
+
/* Long SQL wraps inside its cell, so the table keeps the card width and the "ver trace" column stays visible */
|
|
81
|
+
.monitor table .sql { white-space: normal; overflow-wrap: anywhere; }
|
|
82
|
+
|
|
83
|
+
.meter {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
width: 90px;
|
|
86
|
+
height: 8px;
|
|
87
|
+
border-radius: 999px;
|
|
88
|
+
background: #f4f4f5;
|
|
89
|
+
vertical-align: middle;
|
|
90
|
+
margin-right: 8px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.meter i { display: block; height: 100%; background: #1e40af; }
|
|
95
|
+
|
|
96
|
+
.meter--warn i { background: #9a3412; }
|
|
97
|
+
|