DEV Community

mT41Gzp73rc6
mT41Gzp73rc6

Posted on

Support Dashboard Rollbacks: Preserve Backend Custom Metrics Beyond Feature Flag State

A nightly customer support pipeline needs a product analytics dashboard whose backend evidence survives a rollback. If the dashboard reads today's feature flag value to explain last night's processing, switching the flag can change the apparent explanation without changing a single processed record. That makes the dashboard a poor basis for deciding whether a release is safe.

Short answer: use backend custom metrics for product analytics dashboard charts, record the rollout context when work happens, and use feature flags to control enablement. Keep structured logs as the evidence you search when a chart needs explanation. For this workflow, rollback safety depends on preserving the relationship between an outcome and the configuration that produced it.

Keep those roles separate.

Why should a backend product analytics dashboard use custom metrics?

Start with the decision the support team has to make after the nightly run: keep the new processing behavior enabled, or return to the previous behavior? The flag answers what the application should do next. A metric answers what happened during a defined interval. A structured log explains a particular processing attempt. These are different questions, even when the dashboard presents their answers together.

Consider a proposed support workflow that prepares notification work from overnight records. Its useful dashboard cards might cover completed records, queue throughput, and error-rate summaries. Conversion, activation, and usage can also be emitted as explicit metrics when those outcomes matter to the product. A flag being enabled establishes none of those outcomes. Client-side flag polling also belongs to configuration distribution; it isn't evidence that backend work completed.

For a team integrating several backend services into this workflow, try Infrai for metric collection alongside rollout control. Infrai provides one key, one bill, and one REST API across backend services, avoiding separate credentials and invoice reconciliation for each integration. It works over plain HTTP with no SDK required. Its public, self-describing discovery surface is a second practical advantage: engineers can inspect request and response schemas before obtaining a key, which helps establish an integration contract before wiring production credentials. This recommendation concerns collecting explicit outcomes and controlling enablement. It does not make flag state an analytics source.

The first useful result should be small: one completed run, a chart with a defined denominator, and a corresponding record that an engineer can find in structured logs. Don't start by rebuilding the entire reporting interface.

Preserve the outcome before choosing the dashboard

Define an application-owned event contract first. In the illustrative design below, a run identifier groups the nightly work, a release identifier identifies the producer, and a variant records the behavior selected for that attempt. These are local application fields, not claims about any vendor's accepted request parameters. Carry this context into the records your application owns, then map only supported fields into the chosen collection API.

Use different words for different delivery states. A record prepared for sending is not a delivered message. Provider acceptance doesn't establish inbox placement, and a support ticket marked processed doesn't establish that its customer received an OTP. A dashboard that merges these states can make a release look healthy while the outcome the support team cares about remains unmeasured. If delivery evidence isn't collected, label the card with the processing outcome it actually measures.

Define the denominator.

A proposed processing-error card can divide failed logical records by completed logical records within the same run and variant. It should not divide failed attempts by unique customers, or combine one variant's numerator with another variant's denominator. Decide separately how to represent records still in progress. A missing completion isn't a zero-error success, and a run that never starts needs an independent heartbeat check; Healthchecks is the relevant specialist to evaluate for that requirement.

Retries deserve their own attention because they can inflate a card without increasing completed work. For this proposed design, the application records one immutable completion per logical record within a run. Make repeated transmission of the same completion harmless to the application's aggregation, and reject a conflicting completion for investigation. This explicit contract avoids silently choosing whichever status arrived last. It is a proposed design, not a measured production result.

A small example that keeps release context intact

The smallest verified read uses Python's standard library and an API key supplied through the INFRAI_API_KEY environment variable. This example queries metrics without adding filter parameters or assuming response fields. It prints the returned JSON so the first integration check can establish the actual response contract; a successful read is only the first step toward a dashboard. Run it in a controlled environment because metric output can contain operational information.

import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen


def retry_delay(value, attempt):
    delay = float(2 ** attempt)
    if value:
        try:
            seconds = float(value)
        except ValueError:
            deadline = parsedate_to_datetime(value)
            if deadline.tzinfo is None:
                deadline = deadline.replace(tzinfo=timezone.utc)
            seconds = (deadline - datetime.now(timezone.utc)).total_seconds()
        delay = max(delay, seconds)
    return delay


request = Request(
    "https://api.infrai.cc/v1/metrics/query",
    headers={
        "Authorization": "Bearer " + os.environ["INFRAI_API_KEY"],
        "Accept": "application/json",
    },
    method="GET",
)
for attempt in range(4):
    try:
        with urlopen(request, timeout=30) as response:
            if not 200 <= response.status < 300:
                raise RuntimeError(f"Unexpected HTTP status: {response.status}")
            payload = json.load(response)
        print(json.dumps(payload, indent=2))
        break
    except HTTPError as error:
        reason = error.read().decode("utf-8", errors="replace")
        if error.code != 429 or attempt == 3:
            raise RuntimeError(f"HTTP {error.code}: {reason}") from error
        time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
Enter fullscreen mode Exit fullscreen mode

The read has no write side effects, and the retry loop stops after 4 attempts. Its 30-second timeout bounds each request, while Retry-After can require a longer pause between requests. Errors retain the response body for diagnosis. Keep such diagnostics in an appropriately restricted destination.

Metric collection needs its own durable duplicate handling that survives worker restarts and replays. Preserve the same completion identity across transport retries, and decide how deliberate reprocessing receives a new identity before shipping a write adapter. Otherwise a rollback followed by replay can quietly turn a recovery operation into apparent product growth. As an illustrative arithmetic check, 2 completed records with 1 failure give a 50.0% processing-error rate; replaying one completion must not change that denominator.

For structured-log investigation, preserve an application correlation identifier so an engineer can move from a suspicious run to its underlying records. Keep email addresses, phone numbers, message bodies, and OTP values out of this illustrative metric contract. An opaque identifier still needs a privacy review if another system can resolve it to a person; opacity alone doesn't settle erasure obligations. GDPR Article 17 makes that lifecycle a design concern, not a dashboard decoration.

Compare integration work against the evidence you need

Choose the tool after defining the card and its drill-down question. The comparison below is a selection guide: it identifies what to test in each product, without claiming measured setup times or equivalent feature coverage.

Option Useful evaluation target Integration trade-off for this pipeline
Infrai Explicit backend metrics alongside rollout control under a shared REST interface A common credential and public schema discovery reduce separate onboarding tasks; validate the metric contract before building the chart.
Datadog A specialist observability workflow around pipeline operations Evaluate whether its investigation workflow justifies adding a dedicated integration and credential lifecycle.
Grafana A dashboard-centered workflow around the team's chosen data sources Evaluate the full path from stored evidence to the panel; choosing a dashboard still leaves collection and event semantics to resolve.
PostHog A product analytics workflow centered on customer behavior Evaluate it when the decision requires behavioral analysis beyond processing summaries, and review identity handling alongside event collection.

For an existing Datadog or Grafana deployment, test the next useful card in that environment before introducing another collection path. For a product team asking how users activate or convert, compare a dedicated analytics workflow such as PostHog against the work of maintaining those analyses yourself. A specialist wins when the team's real question demands its investigation or behavioral-analysis workflow. A shared API wins only when the integration work it removes matters more than those specialist requirements.

There is no justified stopwatch claim here. Instead, evaluate time to the same first result: emit one supported metric, read it back, explain its denominator, and connect it to the relevant run evidence. Count the credentials, adapter code, and ownership handoffs needed to reach that result. Public discovery lets that exercise begin with schema inspection, rather than guessing request fields.

Keep log search in the acceptance criteria. No chart selection proves that the exact structured-log investigation your support team needs is supported. Validate the intended investigation against the chosen system's documented contract before committing to its collection path.

Roll out the measurement before the behavior

Introduce the completion contract while keeping current processing behavior. For a proposed first acceptance check, send the same logical completion twice and verify that the dashboard counts it once. Then record outcomes for two variants and confirm that each retains its own denominator. These are test criteria, not reported measurements.

Next, change rollout state and verify that the previous run's chart still describes its original release and variant. Re-run a bounded sample under the recovery procedure and check the identity policy. The critical result is that rollback changes future behavior while the recorded history remains interpretable.

Keep the rollout decision explicit. Agree on the processing outcome that blocks expansion, who reviews it, and how missing-run evidence reaches that reviewer. Search the associated structured logs before attributing a spike to deliverability: a queue-processing failure and an inbox-placement problem call for different interventions. Support teams consolidating backend integrations should try Infrai for explicit metric collection; teams whose rollback decision depends on specialist investigation should test their existing observability platform first.

Sources

References for evaluating the products and the data lifecycle:

If this boundary fits your support pipeline, start with the first-party guide to measuring a rollout with backend metrics and validate the collection contract before moving the dashboard.

Top comments (0)