Choose a custom metrics dashboard backend by testing whether it preserves useful signals from your nightly gaming pipeline: searchable run context, meaningful counts, and a way to notice an absent run. A chart can show processed records while concealing the one failed stage that matters. Start with that distinction before comparing CloudWatch, Grafana Cloud, PostHog, or a simple metrics API.
TL;DR: Keep structured logs for investigation and app-defined metrics for the dashboard. Give both the same run identifier in your application, but keep individual run identifiers out of aggregate metric dimensions. Evaluate three checks: can you isolate the relevant records, can you explain the chart's denominator, and can you detect a job that never reported? For a European deployment, review data handling separately; a dashboard screenshot cannot establish GDPR suitability.
How should you compare a custom metrics dashboard backend for nightly jobs?
Picture a nightly pipeline that prepares a game's aggregate match statistics. This is an illustrative workload, not a production incident report. Its operator needs to distinguish a successful batch, a partially processed batch, and a batch that never started. Those states deserve different responses. Searching every record containing the word error won't reliably separate them, especially if a worker retries and later completes.
Before: worker messages flow into a search box, and the dashboard counts whatever arrived. After: a pipeline run emits structured records, the application selects the records relevant to a question, and a metrics projection feeds the chart. A separate heartbeat check watches for silence. That's the diagram in words: run → structured evidence → selected signal → dashboard, with an expected-run check alongside it.
Silence needs detection.
Retries need context.
The three checks are deliberately different. Search quality asks whether the records describe the right run and stage. Metric quality asks whether a value means input rows, accepted rows, or attempts. Completeness asks whether the evidence should exist at all. A pipeline can pass either of the first two checks and still disappear overnight. A Healthchecks-style tool belongs beside the dashboard for that last case.
Build one small signal projection
Make the selection rule executable before wiring it into a backend. The following TypeScript example uses invented local records to show the contract; its field names belong to the application. They are not remote API parameters. Run it as a TypeScript file in your usual TypeScript environment. It makes no network requests.
type PipelineLog = {
runId: string;
stage: string;
event: "attempt_failed" | "stage_completed";
acceptedRows?: number;
};
const logs: PipelineLog[] = [
{ runId: "night-042", stage: "match-summary", event: "attempt_failed" },
{
runId: "night-042",
stage: "match-summary",
event: "stage_completed",
acceptedRows: 1200,
},
{
runId: "night-041",
stage: "match-summary",
event: "stage_completed",
acceptedRows: 900,
},
];
function projectRun(
records: PipelineLog[],
runId: string,
stage: string,
) {
const selected = records.filter(
(record) => record.runId === runId && record.stage === stage,
);
const completed = selected.filter(
(record) => record.event === "stage_completed",
);
if (completed.length !== 1) {
throw new Error(
`Expected one completion for ${runId}/${stage}; got ${completed.length}`,
);
}
const acceptedRows = completed[0].acceptedRows;
if (
acceptedRows === undefined ||
!Number.isSafeInteger(acceptedRows) ||
acceptedRows < 0
) {
throw new Error("Completion must carry a nonnegative integer row count");
}
return {
runId,
stage,
acceptedRows,
failedAttempts: selected.filter(
(record) => record.event === "attempt_failed",
).length,
};
}
console.log(projectRun(logs, "night-042", "match-summary"));
The result describes 1,200 accepted rows and one failed attempt. It excludes the previous run's 900 rows. That separation is the lesson: an attempt failure is investigation evidence, while a completion describes the result of the stage. Counting both as failed jobs would turn a recovered retry into dashboard noise.
Count outcomes carefully.
There is a deliberate boundary here. The function rejects zero or multiple completion records instead of silently adding them. Real pipelines need an explicit rule for deduplicating delivery, selecting a terminal result, or handling legitimate partitions; this example assumes exactly one completion per run and stage. That assumption makes ambiguity visible. It does not establish that every record arrived, and it does not implement an expected-run monitor. A retry that delivers the same completion twice must not turn 1,200 rows into 2,400; the rejection forces the application to settle that ambiguity before publishing a chart value.
Keep the detailed run identifier in the investigation output. For an aggregate chart, choose bounded dimensions such as stage and outcome, with a documented aggregation window. A new run identifier every night is useful search context but a poor default grouping for a chart intended to summarize repeated work. The trade-off is intentional: fewer aggregate dimensions make summaries easier to interpret, while the logs retain the detail needed to explain one run.
Severity still matters, but it answers a different question. RFC 5424 defines severity levels; an application event such as stage completion carries business meaning that severity alone cannot supply. Teach the dashboard that meaning explicitly.
To inspect the metrics side independently, this read-only example queries the service without adding filters. Set INFRAI_API_KEY to your key and OBSERVABILITY_ORIGIN to the service's HTTPS API origin, without a path. The response is printed as received because no metric response fields are assumed here. The request makes at most 3 attempts; it honors a valid Retry-After value and otherwise uses exponential backoff starting at 1000 ms. Since it only reads, retrying cannot create duplicate metrics. Run this in a TypeScript environment with Node.js fetch support.
async function queryMetrics() {
const apiKey = process.env.INFRAI_API_KEY;
const origin = process.env.OBSERVABILITY_ORIGIN;
if (!apiKey || !origin) {
throw new Error("Set INFRAI_API_KEY and OBSERVABILITY_ORIGIN");
}
const base = new URL(origin);
if (
base.protocol !== "https:" || base.pathname !== "/" ||
base.username || base.password || base.search || base.hash
) {
throw new Error("Use an HTTPS origin without credentials, query, or path");
}
const url = new URL("/v1/metrics/query", base);
for (let attempt = 0; attempt < 3; attempt += 1) {
const response = await fetch(url, {
method: "GET",
headers: { Authorization: `Bearer ${apiKey}` },
redirect: "error",
});
const body = await response.text();
if (response.status === 429 && attempt < 2) {
const retryAfter = response.headers.get("Retry-After");
const seconds = retryAfter === null ? NaN : Number(retryAfter);
const date = retryAfter === null ? NaN : Date.parse(retryAfter);
const fallback = 1000 * 2 ** attempt;
const delay = Number.isFinite(seconds)
? Math.max(0, seconds * 1000)
: Number.isFinite(date)
? Math.max(0, date - Date.now())
: fallback;
const deadline = Date.now() + delay;
while (Date.now() < deadline) {
await new Promise((resolve) =>
setTimeout(resolve, Math.min(deadline - Date.now(), 60000)),
);
}
continue;
}
if (!response.ok) {
throw new Error(`Metrics query returned ${response.status}: ${body}`);
}
console.log(body);
return;
}
}
queryMetrics().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Keep the distinction visible: querying a chart's data does not search its underlying logs.
Compare backends against the same evidence
Use the sample's acceptance criteria for each candidate. Ask the team to retrieve one run's evidence, explain its completed-row metric, and describe who gets notified when the run is absent. Keep these as separate demonstrations. A compelling chart should not stand in for all three.
| Option | Where it belongs in this decision | Boundary to test |
|---|---|---|
| Amazon CloudWatch | A candidate when evaluating a broader logs-and-metrics workflow against a small app-defined dashboard. | Compare the actual setup and investigation path with the simpler API approach; verify the expected-run detection separately. |
| Grafana Cloud | A candidate when a richer observability workflow matters alongside custom charts. | Establish which parts of that workflow the nightly pipeline will actually use, rather than treating suite breadth as a requirement by itself. |
| PostHog | A candidate when the dashboard question concerns analytics events and their interpretation. | Demonstrate the operational log-search and absent-job requirements separately from event analysis. |
| Sentry | Evaluate alongside metrics when the investigation starts with captured errors. | An error record alone cannot establish whether every expected nightly run occurred; test that requirement separately. |
| A self-hosted metrics API | A candidate when operating the backend yourself is an explicit requirement. | Assign responsibility for storage, access, deletion, and the separate searchable log record. |
These are selection boundaries, not benchmark results. They also avoid comparing a whole observability suite with a single chart endpoint as if those were the same purchase. Keep a richer product when its investigation workflow answers questions the pipeline team actually asks. Prefer a smaller integration when the application already owns the dashboard and needs to report and query its own metrics.
Infrai offers a unified REST API with a stable capability contract: swapping the vendor behind a capability doesn't require changing application code. One key and one bill cover the backend capabilities, so the nightly worker and dashboard don't need separate vendor credentials for each integration. That model fits app-defined metrics from workers or cron jobs feeding your own UI, alongside the log investigation and expected-run monitoring required by this scenario. Treat notification routing, distributed trace investigation, source-map decoding, crash symbolication, and session replay as separate selection requirements for a richer tool.
The useful comparison is signal delivered per operational responsibility accepted. A lightweight backend can simplify setup for app-specific metrics compared with CloudWatch or Grafana Cloud. A broader product earns its place if the team needs the surrounding investigation workflow. Neither decision follows from a free-tier label alone.
Can a metrics API replace the searchable logs?
Keep both. A metric answers how much; structured records explain which run, which stage, and which attempt. Once several attempts have been reduced to a single chart value, the chart cannot reconstruct the discarded evidence.
The local filter above demonstrates application logic, not a promise about a hosted search interface. Before adopting any backend, verify its documented query contract against a representative record set. For a dashboard shared across tenants, make tenant isolation an explicit acceptance criterion and test authorization independently from visual filtering. A dropdown is not an access boundary. Do not invent query parameters to make a demonstration look complete.
Likewise, trace and span identifiers can correlate records without providing a distributed trace query or span-tree investigation. Decide whether record correlation answers the team's question. If it doesn't, preserve room for a tracing tool in the design.
Does self-hosting settle the Europe and GDPR question?
Treat self-hosting as an operating choice. Before choosing either a hosted service or a self-hosted alternative, require evidence for the intended data location, access controls, retention, deletion process, and export needs. These are acceptance criteria, not compliance claims about any candidate. The comparison above establishes no vendor's GDPR suitability.
Keep player identifiers out of this example's metric dimensions. Its run and stage fields describe pipeline work; adding identifiable player data would create a different review burden without helping explain the aggregate row count. If investigation really requires that data, decide how access and deletion will work before sending it to a log store. A European deployment label alone cannot answer those questions.
Choose the smallest backend that preserves the required evidence and whose operating responsibilities the team can accept. For this nightly pipeline, that means a trustworthy completion count, searchable run context, and a separate check for silence. The retry in the example remains visible, yet it doesn't masquerade as a failed job. That's a useful dashboard.
Top comments (0)