diff --git a/redirects.mjs b/redirects.mjs index 0a4b629b..acf2b886 100644 --- a/redirects.mjs +++ b/redirects.mjs @@ -56,8 +56,9 @@ export const redirects = { '/llm-observability/ai-trace-observability': '/ai-observability/agent-traces/', '/llm-observability/what-is-openllmetry': '/guides/ai-observability/instrument-python-app-with-openllmetry/', - '/logs-list-panel': '/visualize-data/dashboards/adding-a-panel/logs-list-panel/', + '/logs-list-panel': '/visualize-data/dashboards/adding-a-panel/table-panel/', '/logs-management': '/kloudmate-agent/log-monitoring/', + '/logs/log-explorer/syntax-for-log-querying': '/visualize-data/kmql/', '/managing-dashboards': '/visualize-data/dashboards/managing-dashboards/', '/managing-kloudmate-agents': '/kloudmate-agent/management/', '/managing-panels': '/visualize-data/dashboards/managing-panels/', @@ -71,5 +72,9 @@ export const redirects = { '/tcp-monitor-test-tcp-port-connectivity': '/synthetic/monitors/tcp-monitor/', '/udp-monitor-monitor-udp-port-availability': '/synthetic/monitors/udp-monitor/', '/usage': '/kloudmate-assistant/usage/', + '/visualize-data/dashboards/adding-a-panel/logs-list-panel': + '/visualize-data/dashboards/adding-a-panel/table-panel/', + '/visualize-data/dashboards/adding-a-panel/spans-list-panel': + '/visualize-data/dashboards/adding-a-panel/table-panel/', '/websocket-monitor-monitor-websocket-connections': '/synthetic/monitors/websocket-monitor/', }; diff --git a/scripts/gen-aggregation-diagrams.py b/scripts/gen-aggregation-diagrams.py new file mode 100644 index 00000000..46830a40 --- /dev/null +++ b/scripts/gen-aggregation-diagrams.py @@ -0,0 +1,255 @@ +"""Generate the aggregation diagrams on the Metrics Aggregations page. + +Run: python3 scripts/gen-aggregation-diagrams.py +Writes one SVG per diagram into the page's images/ folder. +""" +import os, sys +from html import escape + +OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(os.path.dirname(__file__), "..", "src/content/docs/docs/visualize-data/explore/metrics-aggregations/images") +FONT_MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" +FONT_SANS = "ui-sans-serif, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" +INK, MUTED, LINE, HEAD_BG, CARD = "#1f2937", "#6b7280", "#e5e7eb", "#f3f4f6", "#ffffff" +FAINT = "#b6bcc6" +ACCENT, ACCENT_TINT, ACCENT_DARK = "#f45b26", "#fde7dd", "#c2410c" +C = {"blue": ("#2563eb", "#e8f0fe"), "green": ("#15803d", "#e6f4ea"), + "purple": ("#7c3aed", "#f1ebfe"), "amber": ("#b45309", "#fdf3e1"), + "sky": ("#0891b2", "#e0f5fa"), "lime": ("#4d7c0f", "#eef6e0")} +BUCKETS = ["10:00", "10:05", "10:10", "10:15"] + +# active_connections{service, region}: a raw point every minute, 5 per 5-minute interval +SERIES = [ # (service, region, color, dashed, raw points per interval) + ("checkout", "us-east", "blue", False, [[6, 7, 7, 8, 7], [7, 8, 9, 8, 8], [8, 9, 8, 7, 8]]), + ("checkout", "eu-west", "blue", True, [[3, 4, 5, 4, 4], [4, 5, 6, 5, 5], [5, 6, 7, 6, 6]]), + ("payments", "us-east", "green", False, [[1, 2, 3, 2, 2], [2, 3, 4, 3, 3], [3, 2, 1, 2, 2]]), + ("payments", "eu-west", "green", True, [[1, 1, 2, 1, 0], [0, 1, 1, 2, 1], [0, 0, 0, 0, 0]]), +] +AVG = [[sum(b) // len(b) for b in r] for *_, r in SERIES] +for (*_, r), a in zip(SERIES, AVG): + assert all(sum(b) == len(b) * v for b, v in zip(r, a)) +TOTAL = [sum(a[i] for a in AVG) for i in range(3)] +BY_SERVICE = {svc: [sum(a[i] for (sv, *_), a in zip(SERIES, AVG) if sv == svc) for i in range(3)] + for svc in ("checkout", "payments")} + +def t(x, y, s, size=12, fill=INK, anchor="start", weight="400", font=FONT_SANS, extra=""): + return (f'{escape(str(s))}') + +def label(x, y, text): + return t(x, y, text.upper(), 11, MUTED, weight="600", extra='letter-spacing="0.06em"') + +def chip(cx, cy, name, detail=None): + w = max(len(name) * 7.4, len(detail) * 6.3 if detail else 0) + 24 + h = 44 if detail else 28 + s = [f'', + t(cx, cy + 4 - (8 if detail else 0), name, 12.5, ACCENT_DARK, "middle", "700")] + if detail: + s.append(t(cx, cy + 13, detail, 10.5, "#9a3412", "middle", font=FONT_MONO)) + return "\n".join(s), w + +def harrow(x, cy, w, name, detail=None): + c, cw = chip(x + w / 2, cy, name, detail) + return "\n".join([ + f'', + f'', c]) + +def varrow(cx, y, h, name, detail=None, note=None, note_x=None): + c, cw = chip(cx, y + h / 2, name, detail) + s = [f'', + f'', c] + if note: + nx = note_x if note_x is not None else cx + cw / 2 + 16 + for i, line in enumerate(note): + s.append(t(nx, y + h / 2 - 2 + i * 15 - (len(note) - 1) * 7, line, 12, MUTED)) + return "\n".join(s) + +def card(W, H, title, body, caption=None): + s = [f'', + f'', + t(24, 36, title, 14, INK, weight="700"), body] + if caption: + s.append(t(24, H - 20, caption, 12, MUTED)) + s.append("") + return "\n".join(s) + +def save(name, svg): + with open(os.path.join(OUT, name), "w") as f: + f.write(svg) + print(name) + +# ---------------------------------------------------------------- chart +def chart(x, y, w, h, ymax, ticks, series, raw=None, ghost=None, hl_bucket=None, + value_labels=False, end_labels=True): + """series: list of (name, color, [v per interval], dashed).""" + PL, PB = 30, 22 + px, pw, ph = x + PL, w - PL - (62 if end_labels else 22), h - PB + bw = pw / 3 + sy = lambda v: y + ph - v / ymax * ph + s = [] + for i in range(3): + fill = ACCENT_TINT if hl_bucket == i else (HEAD_BG if i % 2 == 0 else CARD) + s.append(f'') + for v in ticks: + yy = sy(v) + s.append(f'') + s.append(t(px - 6, yy + 4, v, 10.5, MUTED, "end", font=FONT_MONO)) + for i, b in enumerate(BUCKETS): + s.append(f'') + s.append(t(px + i * bw, y + ph + 16, b, 10.5, MUTED, "middle", font=FONT_MONO)) + def pts_raw(vals): + return [(px + bi * bw + (j + 0.5) / len(b) * bw, sy(v)) for bi, b in enumerate(vals) for j, v in enumerate(b)] + for vals in (ghost or []): + for (cx, cy) in pts_raw(vals): + s.append(f'') + for col, vals in (raw or []): + P = pts_raw(vals) + s.append(f'') + for (cx, cy) in P: + s.append(f'') + for name, col, vals, dashed in series: + solid = ACCENT if col == "accent" else C[col][0] + P = [(px + (i + 0.5) * bw, sy(v)) for i, v in enumerate(vals)] + dash = ' stroke-dasharray="6 4"' if dashed else "" + s.append(f'') + for i, (cx, cy) in enumerate(P): + s.append(f'') + if value_labels or hl_bucket == i: + s.append(t(cx, cy - 9, vals[i], 11, solid, "middle", "700", FONT_MONO, extra='stroke="#fafafa" stroke-width="3" paint-order="stroke"')) + if end_labels: + s.append(t(px + pw + 6, P[-1][1] + 4, name, 11, solid, weight="600", font=FONT_MONO)) + return "\n".join(s) + +def legend(x, y, items, colw=158): + """items: (text, color, dashed); laid out two per row.""" + s = [] + for i, (text, col, dashed) in enumerate(items): + lx, ly = x + (i % 2) * colw, y + (i // 2) * 17 + dash = ' stroke-dasharray="5 3"' if dashed else "" + s.append(f'') + s.append(t(lx + 22, ly, text, 11, MUTED, font=FONT_MONO)) + return "\n".join(s) + +SERIES_LEGEND = [(f"{sv}, {rg}", col, d) for sv, rg, col, d, _ in SERIES] + +# ---------------------------------------------------------------- 1. overview grid +def grid(x, y, labcols, rows, cols, cellw, labws, hl=None, hl_col=None, raw=False, outline=None): + """labcols: header for each label column. rows: (labels tuple, color, cells).""" + RH = 30 + labw = sum(labws) + w, h = labw + cellw * len(cols), RH * (len(rows) + 1) + s = [f'', + f'', + f''] + for ri in range(len(rows)): + for ci in range(len(cols)): + if (hl and hl == (ri, ci)) or hl_col == ci: + s.append(f'') + if outline: + ri, ci = outline + s.append(f'') + for ri in range(1, len(rows) + 1): + s.append(f'') + xs, acc = [], 0 + for lw in labws: + xs.append(acc); acc += lw + for i in range(1, len(labws)): + s.append(f'') + for ci in range(len(cols)): + s.append(f'') + for i, lc in enumerate(labcols): + s.append(t(xs[i] + 10, RH / 2 + 4, lc, 11.5, MUTED, "start", "600", FONT_MONO)) + for ci, c in enumerate(cols): + s.append(t(labw + ci * cellw + cellw / 2, RH / 2 + 4, c, 11.5, MUTED, "middle", "600", FONT_MONO)) + for ri, (labs, col, cells) in enumerate(rows): + cy = RH * (ri + 1) + RH / 2 + 4 + if col: + s.append(f'') + for i, lab in enumerate(labs): + s.append(t(xs[i] + (22 if i == 0 and col else 10), cy, lab, 12, INK, weight="600", font=FONT_MONO)) + for ci, v in enumerate(cells): + cx = labw + ci * cellw + cellw / 2 + if raw: + s.append(t(cx, cy, " ".join(map(str, v)), 11.5, INK, "middle", font=FONT_MONO)) + else: + s.append(t(cx, cy, v, 12.5, INK, "middle", "700", FONT_MONO)) + s.append("") + return "\n".join(s), w, h + +def overview(): + W = 740 + labws, cellw = [100, 84], 112 + gw = sum(labws) + cellw * 3 + gx = (W - gw) / 2 + cols = ["10:00", "10:05", "10:10"] + body, y = [], 64 + body.append(label(gx, y, "Raw points every minute · active_connections")) + g, _, gh = grid(gx, y + 10, ["service", "region"], [((sv, rg), col, r) for sv, rg, col, _, r in SERIES], + cols, cellw, labws, outline=(0, 0), raw=True) + body.append(g); y += 10 + gh + body.append(varrow(gx + sum(labws) + cellw / 2, y + 4, 76, "Within series", "Avg · Interval 5m", + note=["Combines the points in one series", "and one interval into one value."], + note_x=gx + sum(labws) + cellw + 56)) + y += 84 + body.append(label(gx, y + 12, "Four series · one value per interval")) + g, _, gh = grid(gx, y + 22, ["service", "region"], [((sv, rg), col, a) for (sv, rg, col, _, _), a in zip(SERIES, AVG)], + cols, cellw, labws, hl_col=1, outline=(0, 0)) + body.append(g); y += 22 + gh + body.append(varrow(gx + sum(labws) + cellw * 1.5, y + 4, 76, "Across series", "Sum by service", + note=["Adds up the series that share", "a service, in each interval."], + note_x=gx + sum(labws) + cellw * 2 + 40)) + y += 84 + body.append(label(gx, y + 12, "Two series · one per service")) + g, _, gh = grid(gx, y + 22, ["service"], [((svc,), col, BY_SERVICE[svc]) for svc, col in (("checkout", "blue"), ("payments", "green"))], + cols, cellw, [sum(labws)], hl_col=1) + body.append(g); y += 22 + gh + H = int(y + 56) + save("aggregation-overview.svg", card(W, H, "Aggregation within series, then across series", "\n".join(body), + caption="Grouping by service drops region, so the four series become two.")) + +# ---------------------------------------------------------------- 2. within series +def within(): + W, cw, ch, aw = 740, 262, 190, 172 + x0, y0 = 24, 74 + sv, rg, col, _, raw = SERIES[0] + body = [label(x0, y0 - 10, f"Input · {sv}, {rg}")] + body.append(chart(x0, y0, cw, ch, 10, [0, 5, 10], [], raw=[(col, raw)], end_labels=False, hl_bucket=0)) + body.append(harrow(x0 + cw + 4, y0 + ch / 2 - 10, aw, "Within series", "Avg · Interval 5m")) + ox = x0 + cw + aw + 10 + body.append(label(ox, y0 - 10, "Output · one point per interval")) + body.append(chart(ox, y0, cw, ch, 10, [0, 5, 10], [(sv, col, AVG[0], False)], + ghost=[raw], value_labels=True, end_labels=False, hl_bucket=0)) + H = y0 + ch + 52 + a = raw[0] + save("aggregation-within-series.svg", card(W, H, "Aggregation within series (temporal)", "\n".join(body), + caption=f"A point every minute. The five points from 10:00 to 10:05 add up to {sum(a)}, so Avg gives {AVG[0][0]}.")) + +# ---------------------------------------------------------------- 3 & 4. across series +def across(fname, title, detail, outputs, ymax, ticks, out_label, caption): + W, cw, ch, aw = 740, 262, 190, 172 + x0, y0 = 24, 74 + body = [label(x0, y0 - 10, "Input · four series")] + body.append(chart(x0, y0, cw, ch, 10, [0, 5, 10], + [(f"{sv}, {rg}", col, a, d) for (sv, rg, col, d, _), a in zip(SERIES, AVG)], + hl_bucket=1, end_labels=False)) + body.append(legend(x0 + 4, y0 + ch + 18, SERIES_LEGEND)) + body.append(harrow(x0 + cw + 4, y0 + ch / 2 - 10, aw, "Across series", detail)) + ox = x0 + cw + aw + 10 + body.append(label(ox, y0 - 10, out_label)) + body.append(chart(ox, y0, cw, ch, ymax, ticks, outputs, hl_bucket=1, value_labels=True)) + H = y0 + ch + 82 + save(fname, card(W, H, title, "\n".join(body), caption=caption)) + +def across_all(): + a = [v[1] for v in AVG] + across("aggregation-across-series.svg", "Aggregation across series (spatial)", "Sum", + [("total", "accent", TOTAL, False)], 20, [0, 10, 20], "Output · one series", + f"No Group by, so every series is added together. At 10:05: {' + '.join(map(str, a))} = {TOTAL[1]}.") + +def across_by_service(): + c, p = [AVG[i][1] for i in (0, 1)], [AVG[i][1] for i in (2, 3)] + across("aggregation-group-by.svg", "Across series with Group by", "Sum by service", + [("checkout", "blue", BY_SERVICE["checkout"], False), ("payments", "green", BY_SERVICE["payments"], False)], + 15, [0, 5, 10, 15], "Output · one series per service", + f"Group by service drops region. At 10:05, checkout is {c[0]} + {c[1]} = {sum(c)} and payments is {p[0]} + {p[1]} = {sum(p)}.") + +overview(); within(); across_all(); across_by_service() diff --git a/scripts/gen-transform-diagrams.py b/scripts/gen-transform-diagrams.py new file mode 100644 index 00000000..ad9ee8b3 --- /dev/null +++ b/scripts/gen-transform-diagrams.py @@ -0,0 +1,286 @@ +"""Generate the input -> output diagrams on the dashboard Transformations page. + +Run: python3 scripts/gen-transform-diagrams.py +Writes one SVG per transformation into the page's images/ folder. +""" +import os, sys +from html import escape + +OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(os.path.dirname(__file__), "..", "src/content/docs/docs/visualize-data/dashboards/panel-options/images") +CW = 7.25 # mono char width at 12px +ROW_H = 26 +PAD_X = 10 +FONT_MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" +FONT_SANS = "ui-sans-serif, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" + +INK, MUTED, LINE, HEAD_BG, CARD = "#1f2937", "#6b7280", "#e5e7eb", "#f3f4f6", "#ffffff" +ACCENT = "#f45b26" +# series colors: (solid, tint) +C = { + "blue": ("#2563eb", "#e8f0fe"), + "green": ("#15803d", "#e6f4ea"), + "purple": ("#7c3aed", "#f1ebfe"), + "amber": ("#b45309", "#fdf3e1"), +} + +def is_num(s): + try: + float(str(s).replace(",", "").replace("%", "").replace(" MiB", "")); return True + except ValueError: + return False + +def table(x, y, cols, rows, col_color=None, row_color=None, dropped=(), hl_col=None, dropped_cols=()): + """Return (svg, w, h). col_color: {col_idx: color}, row_color: {row_idx: color}.""" + col_color, row_color = col_color or {}, row_color or {} + widths = [] + for i, c in enumerate(cols): + n = max([len(c)] + [len(str(r[i])) for r in rows]) + extra = 14 if i in col_color else 0 # room for the dot + widths.append(round(n * CW + 2 * PAD_X + extra)) + w, h = sum(widths), ROW_H * (len(rows) + 1) + s = [f''] + s.append(f'') + s.append(f'') + # cell tints + for ri, r in enumerate(rows): + cy = ROW_H * (ri + 1) + cx = 0 + for ci, wd in enumerate(widths): + tint = None + if ri in dropped: tint = None + elif ri in row_color: tint = C[row_color[ri]][1] + elif ci in col_color: tint = C[col_color[ci]][1] + if hl_col == ci and ri not in dropped: tint = "#fde7dd" + if ci in dropped_cols: tint = None + if tint: + last = ri == len(rows) - 1 + if last and (ci == 0 or ci == len(widths) - 1): + # keep rounded bottom corners clean + s.append(f'') + s.append(f'') + s.append(f'') + else: + s.append(f'') + cx += wd + # grid + for ri in range(1, len(rows) + 1): + s.append(f'') + cx = 0 + for wd in widths[:-1]: + cx += wd + s.append(f'') + s.append(f'') + # text + def cell(ci, cx, cy, text, header=False, faded=False): + wd = widths[ci] + color = MUTED if header else INK + if faded or ci in dropped_cols: color = "#b6bcc6" + weight = "600" if header else "400" + num = not header and is_num(text) + tx = cx + PAD_X + out = [] + if header and ci in col_color: + out.append(f'') + tx += 14 + if header and hl_col == ci: + color = ACCENT + anchor = "start" + if num: + tx, anchor = cx + wd - PAD_X, "end" + out.append(f'{escape(str(text))}') + if faded: + tl = len(str(text)) * CW + x1 = tx - tl if anchor == "end" else tx + out.append(f'') + return out + cx = 0 + for ci, c in enumerate(cols): + s += cell(ci, cx, 0, c, header=True); cx += widths[ci] + for ri, r in enumerate(rows): + cx = 0 + for ci, v in enumerate(r): + s += cell(ci, cx, ROW_H * (ri + 1), v, faded=ri in dropped); cx += widths[ci] + # row dots for row-colored rows + s.append('') + return "\n".join(s), w, h + +def label(x, y, text, color=MUTED, chip=None): + out = [] + tx = x + if chip: + out.append(f'') + tx += 13 + out.append(f'{escape(text.upper())}') + return "\n".join(out) + +def arrow(x, cy, w, name, detail): + s = [] + s.append(f'') + s.append(f'') + cw = max(len(name) * 7.4, len(detail) * 6.3 if detail else 0) + 24 + bx = x + (w - cw) / 2 + bh = 44 if detail else 28 + s.append(f'') + ny = cy + 4 - (8 if detail else 0) + s.append(f'{escape(name)}') + if detail: + s.append(f'{escape(detail)}') + return "\n".join(s), cw + +def render(fname, title, inputs, output, step, detail=None, caption=None): + """inputs: list of (label, chip, table_kwargs); output: table_kwargs.""" + M, GAP_LABEL, STACK_GAP = 24, 20, 22 + # measure + ins = [] + for lab, chip, kw in inputs: + _, w, h = table(0, 0, **kw); ins.append((lab, chip, kw, w, h)) + _, ow, oh = table(0, 0, **output) + in_w = max(i[3] for i in ins) + in_h = sum(GAP_LABEL + i[4] for i in ins) + STACK_GAP * (len(ins) - 1) + out_h = GAP_LABEL + oh + _, chip_w = arrow(0, 0, 10, step, detail) + arrow_w = max(170, chip_w + 72) + top = M + 30 + body_h = max(in_h, out_h) + W = round(M + in_w + arrow_w + ow + M) + H = round(top + body_h + M + (22 if caption else 0)) + s = [f''] + s.append(f'') + s.append(f'{escape(title)}') + # inputs + y = top + (body_h - in_h) / 2 + for lab, chip, kw, w, h in ins: + s.append(label(M, y + 12, lab, chip=chip)) + t, _, _ = table(M, y + GAP_LABEL, **kw); s.append(t) + y += GAP_LABEL + h + STACK_GAP + # arrow + ax = M + in_w + a, _ = arrow(ax, top + body_h / 2 + GAP_LABEL / 2, arrow_w, step, detail); s.append(a) + # output + ox = ax + arrow_w + oy = top + (body_h - out_h) / 2 + s.append(label(ox, oy + 12, "Output")) + t, _, _ = table(ox, oy + GAP_LABEL, **output); s.append(t) + if caption: + s.append(f'{escape(caption)}') + s.append('') + with open(os.path.join(OUT, "transform-" + fname), "w") as f: + f.write("\n".join(s)) + print(fname, W, H) + +# ---------- Reduce ---------- +render("reduce.svg", "Reduce", + [("Input · CPU % per host", None, dict( + cols=["time", "web-1", "web-2", "db-1"], + rows=[["10:00", 42, 61, 77], ["10:01", 48, 83, 79], ["10:02", 45, 92, 81], ["10:03", 51, 74, 86]], + col_color={1: "blue", 2: "green", 3: "purple"}))], + dict(cols=["host", "Last", "Max", "Mean"], + rows=[["web-1", 51, 51, 46.5], ["web-2", 74, 92, 77.5], ["db-1", 86, 86, 80.8]], + row_color={0: "blue", 1: "green", 2: "purple"}), + "Reduce", "Last · Max · Mean", + caption="Each series over time becomes one row, with a column per calculation.") + +# ---------- Filter rows ---------- +render("filter-rows.svg", "Filter rows", + [("Input", None, dict( + cols=["host", "Last", "Max", "Mean"], + rows=[["web-1", 51, 51, 46.5], ["web-2", 74, 92, 77.5], ["db-1", 86, 86, 80.8], ["db-2", 60, 64, 58.2]], + dropped={0, 3}, hl_col=2))], + dict(cols=["host", "Last", "Max", "Mean"], + rows=[["web-2", 74, 92, 77.5], ["db-1", 86, 86, 80.8]], hl_col=2), + "Filter rows", "Max greater than 80", + caption="Rows that fail the condition are removed.") + +# ---------- Group by ---------- +render("group-by.svg", "Group by", + [("Input", None, dict( + cols=["k8s.namespace.name", "k8s.pod.name", "memory"], + rows=[["checkout", "checkout-7f9c", "412 MiB"], ["checkout", "checkout-b21d", "388 MiB"], + ["payments", "payments-4k2p", "256 MiB"], ["payments", "payments-9xq1", "301 MiB"], + ["search", "search-0", "1024 MiB"]], + row_color={0: "blue", 1: "blue", 2: "green", 3: "green", 4: "purple"}, dropped_cols={1}))], + dict(cols=["k8s.namespace.name", "memory (Total)"], + rows=[["checkout", "800 MiB"], ["payments", "557 MiB"], ["search", "1024 MiB"]], + row_color={0: "blue", 1: "green", 2: "purple"}), + "Group by", "namespace · Total", + caption="Rows with the same namespace collapse into one. k8s.pod.name isn't grouped, so it's dropped.") + +# ---------- Join by field ---------- +render("join-by-field.svg", "Join by field", + [("Query A · requests", "blue", dict( + cols=["service", "requests"], + rows=[["checkout", "1,240"], ["payments", "860"], ["search", "3,410"]], + col_color={1: "blue"})), + ("Query B · errors", "purple", dict( + cols=["service", "errors"], + rows=[["checkout", 12], ["payments", 31], ["search", 4]], + col_color={1: "purple"}))], + dict(cols=["service", "requests", "errors"], + rows=[["checkout", "1,240", 12], ["payments", "860", 31], ["search", "3,410", 4]], + col_color={1: "blue", 2: "purple"}), + "Join by field", None, + caption="Rows from each query are matched on service, with one column per query.") + +# ---------- Series to rows ---------- +render("series-to-rows.svg", "Series to rows", + [("Input · a column per host", None, dict( + cols=["time", "web-1", "web-2"], + rows=[["10:00", 42, 61], ["10:01", 48, 83]], + col_color={1: "blue", 2: "green"}))], + dict(cols=["time", "host", "cpu"], + rows=[["10:00", "web-1", 42], ["10:00", "web-2", 61], ["10:01", "web-1", 48], ["10:01", "web-2", 83]], + row_color={0: "blue", 1: "green", 2: "blue", 3: "green"}), + "Series to rows", None, + caption="Each series becomes rows, with its label in a host column beside one value column.") + +# ---------- Organize fields ---------- +render("organize-fields.svg", "Organize fields", + [("Input", None, dict( + cols=["service.namespace", "host.name", "cpu"], + rows=[["shop", "web-1", 51], ["shop", "web-2", 74], ["shop", "db-1", 86]], + dropped_cols={0}, col_color={1: "blue"}))], + dict(cols=["Host", "cpu"], + rows=[["web-1", 51], ["web-2", 74], ["db-1", 86]], + col_color={0: "blue"}), + "Organize fields", "move · hide · rename", + caption="host.name moves first and is renamed to Host. service.namespace is hidden.") + +# ---------- Sort by ---------- +render("sort-by.svg", "Sort by", + [("Input", None, dict( + cols=["host", "Max"], + rows=[["web-1", 51], ["web-2", 92], ["db-1", 86], ["db-2", 64]], + hl_col=1, row_color={1: "blue"}))], + dict(cols=["host", "Max"], + rows=[["web-2", 92], ["db-1", 86], ["db-2", 64], ["web-1", 51]], + hl_col=1, row_color={0: "blue"}), + "Sort by", "Max · Descending", + caption="Rows are reordered by one column. The busiest host comes first.") + +# ---------- Extract fields ---------- +render("extract-fields.svg", "Extract fields", + [("Input", None, dict( + cols=["time", "attributes"], + rows=[["10:00", '{"method":"GET","status":200}'], ["10:01", '{"method":"POST","status":502}']], + col_color={1: "purple"}))], + dict(cols=["time", "method", "status"], + rows=[["10:00", "GET", 200], ["10:01", "POST", 502]], + col_color={1: "purple", 2: "purple"}), + "Extract fields", "Column: attributes", + caption="Each key in the JSON column becomes its own column.") + +# ---------- Filter by query ---------- +render("filter-by-query.svg", "Filter by query", + [("Query A · requests", "blue", dict( + cols=["time", "requests"], + rows=[["10:00", "1,240"], ["10:01", "1,310"]], + col_color={1: "blue"})), + ("Query B · helper", "purple", dict( + cols=["time", "total"], + rows=[["10:00", "5,510"], ["10:01", "5,620"]], + dropped_cols={0, 1}))], + dict(cols=["time", "requests"], + rows=[["10:00", "1,240"], ["10:01", "1,310"]], + col_color={1: "blue"}), + "Filter by query", "Draw everything else · B", + caption="Query B still runs, so an expression can use it, but the panel doesn't draw it.") diff --git a/src/content/docs/docs/alerts/create-alerts.mdx b/src/content/docs/docs/alerts/create-alerts.mdx index c7885c9b..b7c2ba32 100644 --- a/src/content/docs/docs/alerts/create-alerts.mdx +++ b/src/content/docs/docs/alerts/create-alerts.mdx @@ -79,7 +79,7 @@ Select **From Scratch** in the **Create Alert** dialog and click **Create Alert* - **Simple mode** builds the rule from one query and one condition, on a single page. It's the only mode with the **Detection method** toggle for Anomaly and Forecast alerts. See [Build an alert in Simple mode](#build-an-alert-in-simple-mode). - **Advanced mode** lets you add more queries and combine them with math, reduce, and condition expressions. It's also the only mode with custom annotations. See [Build an alert in Advanced mode](#build-an-alert-in-advanced-mode). -To switch, click **Advanced mode**. You can't switch back to Simple mode afterward. Editing or duplicating an existing rule always opens it in Advanced mode. +To switch, click **Advanced mode**. You can't switch back to Simple mode afterward. Editing or duplicating an existing rule always opens it in Advanced mode, and so does an alert you [create from a dashboard panel](#create-an-alert-from-a-dashboard-panel). ## Build an alert in Simple mode @@ -124,31 +124,43 @@ Advanced mode is for rules that need more than one query, or expressions that tr ### 1. Setup query conditions and expressions -Create more queries and expressions with the **Add Query** and **Add Expression** buttons. KloudMate assigns each one a letter, such as **A**, **B**, or **C**, and you can duplicate any block with its copy icon. +Create more queries and expressions with the **Add Query** and **Add Expression** buttons. Each one gets an ID, such as **A**, **B**, or **C**, which you can rename. See [Nodes](../expressions/#nodes). Duplicate a block with its copy icon. -#### Setting up query conditions for OpenTelemetry / KloudMate +To remove a block, click its delete icon. If other steps read that block, you're asked to confirm first, and the rule can't be saved until those steps read a different one. -![OpenTelemetry / KloudMate query setup](./images/setting-up-kloudmate-alarms-2.png) +#### Choose a data source -- **Data Set:** select the dataset you want to retrieve from your data source. -- **Metric to Aggregate:** select the metric you want to monitor from that dataset. -- **Aggregation:** choose the function applied to the metric, such as `Avg` or `Rate`. Click **Customize aggregation** for temporal and spatial aggregation controls. See [Metrics Aggregations](../../visualize-data/explore/metrics-aggregations/). -- **Group By:** enter the attributes used to group the data points. -- **Filters:** add filters to narrow the retrieved data points. -- **Ranking:** control how the series are ordered. +Each query starts with a data source picker, the same one the panel editor and Explore use. Pick **KloudMate** for the telemetry your workspace collects, or an AWS account, listed by its account name, to query CloudWatch. **Add a data source**, at the bottom of the list, opens **Settings → Connections** in a new tab. An alert rule reads from **KloudMate** or an AWS account (CloudWatch) only. HTTP endpoint connections aren't offered, and the **Logs** and **Traces** data sets have the **Builder** tab only, with no **Records**. For the query fields, see [Queries and data sources](../../visualize-data/dashboards/adding-a-panel/queries-and-data-sources/). -OpenTelemetry users can also use **Prometheus query language** to retrieve data and configure alerts. +Next to the picker, set how far back the query reads with the **Time Range** dropdown, or enter a custom value in seconds. -#### Setting up query conditions for AWS (CloudWatch) +#### KloudMate queries + +![KloudMate query setup](./images/setting-up-kloudmate-alarms-2.png) + +- **Data Set:** select **Metrics**, **Logs**, or **Traces**. +- **Metric:** select the metric you want to monitor. +- **Filter:** add filter chips to narrow the data. An **OR group** matches when any one of its conditions matches. See [KMQL](../../visualize-data/kmql/) for every operator. +- **Aggregate:** choose the statistic applied to the metric, such as **Avg** or **Rate**. Click **customize** to set **Within series** and **Across series** separately. To keep every series apart, choose **Each series** under **Group by**. See [Metrics Aggregations](../../visualize-data/explore/metrics-aggregations/). +- **Where value:** keep only the values that match a condition, such as `= 2`. +- **Group by:** pick the labels used to split the result into series. +- **Rank:** keep only the top or bottom K series. +- **Then:** combine the grouped results again, by fewer labels. + +See [Queries and data sources](../../visualize-data/dashboards/adding-a-panel/queries-and-data-sources/#build-the-query-step-by-step) for each step. To move a query between alert rules, dashboards, and Explore as text, use **Copy as KMQL** and **Paste KMQL** in the query's menu. + +To write the query in Prometheus query language instead, select the **Metrics** data set and open the **PromQL** tab. In an alert rule, a PromQL query always runs as a range query. A query that uses `or vector(N)` can't be switched to the **Builder** tab in an alert rule, because alert rules have no no-data value. Use **Alert state if No data** to decide what happens when the query returns nothing. + +#### CloudWatch queries ![AWS CloudWatch query setup](./images/setting-up-kloudmate-alarms-3.png) -- **Time Range:** set how far back to fetch data with the dropdown, or enter a custom value in seconds. - **Region:** select the AWS region of the service you want to monitor. - **Namespace:** select the AWS service namespace you want to alert on. -- **Metric:** select the metric from that namespace. -- **Statistic:** select the statistical function to apply when calculating data points. -- **Dimensions:** optionally scope the alert to grouped resources within the namespace. For EC2, for example, you can filter by autoscaling group name, image ID, instance type, and more. +- **Select metric:** select the metric from that namespace. +- **Statistic:** select **Maximum**, **Minimum**, **Average**, or **Sum**. It starts on **Average**. +- **Dimensions:** optionally scope the alert to resources within the namespace. Click **Add dimension**, pick a key, then pick one or more values, or **All** to match every value. For EC2, for example, you can filter by autoscaling group name, image ID, instance type, and more. +- **Legend Format:** optionally set how each series is named in the chart. Click **Run Query** to fetch data. @@ -242,6 +254,26 @@ If you're migrating a rule that used notification tags, it keeps working; routin Click **Save** to save the alert, or **Save & Close** to save it and return to the **Rules** tab. +If a field is missing or invalid, its message appears on the field, and the first one scrolls into view. Each message clears as soon as you fix the field. Problems with the rule as a whole, such as a rule with no condition expression or a step that reads a step that doesn't exist, appear as a toast. + +## Create an alert from a dashboard panel + +You can start an alert from a panel on a saved dashboard, with the panel's query already filled in. You need permission to create alerts. + +- From the panel menu (⋯), click **Create alert**. This works on any panel type. +- On a TimeSeries panel, click a point to pin the tooltip, then click **Create alert at this value**. + +The alert editor opens in Advanced mode with: + +- Query **A**: the panel's first query. +- Condition expression **B**: the `last` value of **A** **IS ABOVE** a threshold. From the tooltip, the threshold is the value you clicked. From the panel menu, it's empty, so enter one before you save. +- **Alert name**: the panel title. From the tooltip, the series name is added, for example `CPU utilization: web-1`. +- **Dashboard** and **Panel** in **Responder context**: the dashboard and panel you started from. + +Because the alert is linked to the panel, it appears on that panel's chart while it's firing. See [Annotations](../../visualize-data/dashboards/annotations/). + +The pre-filled values aren't kept if you reload the editor before saving. + ## Viewing an alert To open an alert, select its name on the **Rules** tab. The detail page has these tabs: @@ -256,3 +288,5 @@ To open an alert, select its name on the **Rules** tab. The detail page has thes To see which resources the firing alerts affect, and what else is alerting around them, open their [alert group](../alert-groups/#affected-resources). The instance tables on **Overview** and **Instances** also show each instance's last evaluated value and when it was **Last seen**. + +The condition's threshold and each instance's value are shown in the unit of the query result, for example `14.13GB > 13B`. When the query result has no single unit, such as when its series use different units, the raw number is shown. diff --git a/src/content/docs/docs/alerts/expressions.mdx b/src/content/docs/docs/alerts/expressions.mdx index 8ed9a827..bf21ff69 100644 --- a/src/content/docs/docs/alerts/expressions.mdx +++ b/src/content/docs/docs/alerts/expressions.mdx @@ -130,18 +130,18 @@ Add more conditions with the **Add condition** button, and choose how they combi ## Nodes -Nodes represent the individual queries or expressions used to build alerts and dashboards. KloudMate assigns each node a letter by default (for example, A, B, or C), based on the order it was created. +Nodes represent the individual queries or expressions used to build alerts and dashboards. A node's ID is its name. KloudMate names nodes with a letter by default (for example, A, B, or C), based on the order they were created. ![image](./images/expressions-8.png) -You reference a node by its letter in other queries and expressions. +You reference a node by its name in other queries and expressions. ![image](./images/expressions-9.png) -KloudMate names nodes alphabetically by default, but you can rename them for clarity. +To rename a node, edit its name in the node header. A name can contain letters, numbers, underscores, and spaces, and it must be unique within the alert or panel. Renaming a node updates every reference to it, including math expressions, the **Input** of a Reduce, the **OF** of a condition, and the alert condition. ![image](./images/expressions-10.png) -If a custom node name includes spaces, enclose it in **${}**. For example: `${CPU usage}` +If a node name includes spaces, enclose it in **${}** when you reference it. For example: `${CPU usage}` ![image](./images/expressions-11.png) diff --git a/src/content/docs/docs/apm-and-tracing/trace-explorer.mdx b/src/content/docs/docs/apm-and-tracing/trace-explorer.mdx index b9fd991c..f39006a6 100644 --- a/src/content/docs/docs/apm-and-tracing/trace-explorer.mdx +++ b/src/content/docs/docs/apm-and-tracing/trace-explorer.mdx @@ -7,7 +7,7 @@ sidebar: Click **Traces** in the left navigation menu to open the section. It opens on the **Trace Summary** view by default. -At the top of the page, the **span volume graph** visualizes trace activity over the selected time range. This gives you a quick pulse check on traffic patterns before you inspect individual traces. +To see trace activity over the selected time range, click the chart icon next to the time picker. The **Span count** chart stacks spans with errors and all other spans in each interval. ![image](./images/traces-1.jpeg) @@ -19,13 +19,13 @@ At the top of the page, the **span volume graph** visualizes trace activity over ### Search Bar -Search across traces using span attributes. Click the search bar to see the list of available attributes. +Search across traces using span attributes. Click the search bar or start typing, pick an attribute, then an operator and a value. If the attribute or value you want isn't listed, type it. Each condition appears as a chip in the bar, and a trace must match every chip. To remove a condition, click the **×** on its chip. ![image](./images/traces-2.jpeg) -Click the filter icon on the right to open the full attribute picker. Active filters appear as tags in the search bar and can be removed individually. +The operators are the ones [KMQL](../../visualize-data/kmql/) uses. The `in` and `not in` operators take several values, which you can type separated by commas. On string attributes, `matches` and `not matches` compare the value against a regular expression that must match the whole value. -![image](./images/traces-3.jpeg) +The search is kept in the address as KMQL in the `q` parameter, so a copied address opens the same search. A search that doesn't parse shows the reason with **Clear filters**, runs nothing, and can't be saved. The group drawer keeps its search in `group_q`. ### Sidebar Filters @@ -44,7 +44,9 @@ Each filter section includes a search box for quick lookup. When filters are act ## Saved Queries -Click **Saved Queries** to view and apply previously saved searches. To save a new query, click the dropdown arrow next to **Saved Queries** and select **Add New**. +Open the **Saved** menu next to the search bar. Select **Save this query** to save the current search, pick a query under **Recent** to run it, or select **All saved queries** to browse every saved query. + +When you edit a saved search that has OR groups or free text, they appear in a read-only **Other filters** field and stay in the search when you save it. ![image](./images/traces-5.jpeg) @@ -76,7 +78,7 @@ Filter the groups from the left panel by **entry operation**, **service**, and * Click a group row to open its **drill-down drawer**. The drawer shows the group's metrics across the top, then the list of traces that belong to it. From here you can: -- **Filter the group's traces** by span attributes using the drawer's search bar. +- **Filter the group's traces** by span attributes using the drawer's search bar, which works the same way as the [search bar](#search-bar) on the main page. - **Scroll the list** — it pages automatically as you reach the bottom. - **Open any trace** — click a row to open its full [Trace Detail](../trace-detail/) stacked on top of the drawer. Closing it returns you to the group; closing the group returns you to the list. diff --git a/src/content/docs/docs/issues/images/issue-comments.png b/src/content/docs/docs/issues/images/issue-comments.png new file mode 100644 index 00000000..2a6f4525 Binary files /dev/null and b/src/content/docs/docs/issues/images/issue-comments.png differ diff --git a/src/content/docs/docs/issues/index.mdx b/src/content/docs/docs/issues/index.mdx index 482873bb..b5476218 100644 --- a/src/content/docs/docs/issues/index.mdx +++ b/src/content/docs/docs/issues/index.mdx @@ -105,7 +105,15 @@ The event list holds up to 100 of the latest events: from the last 14 days for a - **Ignore** stops notifications for the issue and moves it to **Ignored**, out of the unresolved list. Click it again to stop ignoring the issue. - **Ask Assistant** opens the [KloudMate Assistant](../kloudmate-assistant/) with a prompt about the issue already written. Nothing is sent until you send it. - **Create in Jira** needs a [Jira integration](../platform/settings/notification-channels/#jira). -- Team members are notified when you assign an issue to them. Everyone who comments on an issue is notified of later comments, and you can mention other users in a comment. +- Team members are notified when you assign an issue to them. + +## Comment on an issue + +Click **Comments** on an issue to discuss it with your team. Comments support Markdown, and you can type `@` to mention another user. Everyone who comments on an issue is notified of later comments. + +![Updates panel on an issue, showing comments from two team members, one of them mentioning the other, and the comment box below](./images/issue-comments.png) + +You can edit and delete only your own comments. If you delete a comment that has replies, the replies stay in the thread. ## How long issues are kept diff --git a/src/content/docs/docs/logs/index.mdx b/src/content/docs/docs/logs/index.mdx index 0d14f404..43e08dc6 100644 --- a/src/content/docs/docs/logs/index.mdx +++ b/src/content/docs/docs/logs/index.mdx @@ -17,7 +17,7 @@ KloudMate centralizes logs from your applications, infrastructure, and cloud ser ## Explore Logs - [Log Explorer](./log-explorer/) -- [Log Query Syntax](./log-explorer/syntax-for-log-querying/) +- [KMQL query language](../visualize-data/kmql/) ## Ingest Logs diff --git a/src/content/docs/docs/logs/log-explorer/index.mdx b/src/content/docs/docs/logs/log-explorer/index.mdx index 1da7faff..aa08ed8e 100644 --- a/src/content/docs/docs/logs/log-explorer/index.mdx +++ b/src/content/docs/docs/logs/log-explorer/index.mdx @@ -11,23 +11,39 @@ Log Explorer indexes logs from all connected services and applications. Use it t ## Log Explorer Walkthrough -The main view combines a log volume graph with a result list. Each row in the list represents a single log entry and shows the most useful attributes for quick triage. - -The graph shows log volume over time. The x-axis represents time and the y-axis represents the number of ingested log entries. +The main view lists log entries in a table. Each row represents a single log entry and shows the most useful attributes for quick triage. ![The Log Explorer main view, with the log volume graph above the field filters and a list of log entries showing time, service, and message.](./images/log-explorer-1.jpeg) +To see log volume over time, click the chart icon next to **Saved**. The **Log volume** chart stacks errors, warnings, and all other logs in each interval. + Select any log entry to inspect its full payload, labels, and metadata. ## Search and Filter Logs ### Search -Use the search bar at the top of Log Explorer to find matching log entries across your environment. +The search bar at the top of Log Explorer shows your search as chips. Each chip is one condition, and a log entry must match every chip to appear. ![The Log Explorer search bar highlighted at the top of the page.](./images/log-explorer-2.jpeg) -Refine results further by adjusting the selected time range from the time scale menu. +To search for text anywhere in a log entry, type it in the bar and press Enter. The text becomes a free-text chip that searches every string field, so `timeout` finds entries with that word in the message or in any text attribute. + +To filter on a field, click the bar and pick a field, then an operator, then a value. For example, pick `severity`, then `=`, then `ERROR`. If the field or value you want isn't listed, type it. + +The `in` and `not in` operators take several values. Select them from the list, or type them separated by commas, such as `ERROR, WARN`, and press Enter. + +On string fields, `matches` and `not matches` compare the value against a regular expression. The expression must match the whole value, so `http.route matches "/api/v[0-9]+/.*"` matches `/api/v2/users` but not `/internal/api/v2/users`. + +To remove a condition, click the **×** on its chip. + +### Edit the search as KMQL + +Click the `` icon at the end of the search bar to see and edit the search as [KMQL](../../visualize-data/kmql/) text. In the text view, put free text in double quotes. For example, `severity = ERROR "timeout"` finds error logs that contain the word `timeout`. Press Enter to run the search, and click `` again to go back to chips. + +Use the text view to build an OR group, such as `(k8s.namespace.name = default or service.name = checkout)`. An OR group shows as a single chip, and you can only change it in the text view. A search that can't be shown as chips stays in the text view. + +If the text doesn't parse, Log Explorer shows the reason and doesn't run the search until you fix it. The search is kept in the address as KMQL in the `q` parameter. Links that use the old `filter` or `query` parameters aren't read, so they open Log Explorer with no search applied. Rewrite the search as KMQL in `q`. ### Filter @@ -35,16 +51,24 @@ Use the sidebar filters to narrow the result set by relevant dimensions. Combine ![The field filters highlighted in the Log Explorer sidebar, grouped into categories such as Common, Kubernetes, Host, and Container.](./images/log-explorer-3.jpeg) +You can also filter from a log entry. In the log detail panel, click **Filter by value** (the filter icon) next to a field to add that field and value to the search. A filter added from the sidebar or the detail panel is combined with the current search using AND. + +Refine results further by adjusting the selected time range from the time picker. + ## Saved Queries -To save a query, click the dropdown arrow next to **Saved Queries** in the top-right area of Log Explorer. Enter a query name, description, and folder, then click **Save**. +Save, reuse, and browse queries from the **Saved** menu next to the search bar: -![The Saved queries dialog, with a folder on the left and a list of saved queries showing each name and description.](./images/log-explorer-4.jpeg) +- **Save this query** saves the current search. Enter a name, description, and folder, then click **Save**. +- **Recent** lists the most recently saved queries. Click one to run it. +- **All saved queries** opens every saved query, organized in folders. -Saved queries remain available from the **Saved Queries** section for quick reuse. +![The Saved queries dialog, with a folder on the left and a list of saved queries showing each name and description.](./images/log-explorer-4.jpeg) Use folders to keep saved queries organized by service, team, or use case. +When you edit a saved query, you write its **Filters** as KMQL text. If a saved query's filters can't be written as KMQL, Log Explorer shows the reason and doesn't run the query. Edit the query and rewrite its filters in KMQL to use it again. + ## Inspect Log Entries Select any log entry to view detailed information and analysis. @@ -57,6 +81,12 @@ Select any log entry to view detailed information and analysis. Refer to the [KloudMate Assistant](../../kloudmate-assistant/) documentation for more details. +### Open one log from a link + +A link with `?logId=&ts=