DEV Community

SolaceW31
SolaceW31

Posted on

Notification Uptime Checks: Disable Noisy Polling With a Feature Flag

Disable the optional checker when its retries obscure notification delivery failures; keep the delivery evidence flowing. In a property management service, a failed probe and an undelivered tenant notice need different responses. A feature flag supplies the admission decision, while a polling client determines how soon each worker sees it.

TL;DR: Use a feature flag as a kill switch for noisy uptime checks, with a separate retry budget and a deliberate policy for stale flag values. Start a replacement monitor in one region or tenant cohort. Judge the rollout by the quality of delivery evidence, not by whether the dashboard gets quieter.

Decision: preserve the evidence that tenants need

This architecture decision treats signal quality as the primary constraint. Consider an illustrative property notification workflow with three categories: a rent reminder, a maintenance appointment, and an access OTP. These are example categories, not a production dataset. An uptime check can report whether a dependency answered, but that answer cannot establish that a tenant received any of those messages. An accepted send request is also insufficient evidence of receipt.

Keep them separate.

The flag controls admission to the optional monitoring path. It shouldn't disable the notification sender, discard delivery outcomes, or silence the record that an OTP expired before a usable delivery outcome arrived. Those boundaries belong in the application design. They prevent an operator from improving an uptime graph by accidentally removing the evidence needed to investigate delivery gaps.

The same separation helps with compliance. Log an opaque notification reference and the operational outcome needed for investigation; avoid copying message bodies, tenant phone numbers, or OTP values into diagnostic events. A log system without a per-user deletion interface should not become a casual second store of tenant identity. Decide how records can be retained and removed before introducing identifying data.

How quickly does a polling kill switch stop noisy checks?

Only after the client learns the new value and the worker enforces it. For a proposed polling interval of 30 seconds, a worker that just refreshed can continue admitting checks for almost another interval, even with successful requests. Network delay and failed refreshes extend that window. This is a design example, not a measured propagation guarantee. Suppose a refresh finishes just before an operator disables the checker. During that interval, the worker can still admit work using its previously enabled value; checking only at process startup would make the delay much less predictable. A retry scheduled before the change must pass through the same admission boundary when it becomes runnable. Otherwise a queue of old retries can continue producing failures even though newly created checks have stopped, and the operator can mistake that leftover work for a flag that failed to propagate.

Check the local decision before every new probe and before every retry. Already running work needs its own timeout or cancellation policy. A remote flag cannot retract an HTTP request that has already left the process. For a Node.js polling client, the important boundary is the same: refreshing a cached value and admitting a job are separate operations, and both need explicit failure behavior.

For this optional checker, choose a conservative stale-value policy: when the cached decision becomes too old, stop admitting probes and record that monitoring coverage is reduced. Don't reuse that policy for the delivery sender. A cached disabled value also needs care during recovery, since a worker that cannot refresh may remain quiet after the operator reenables the flag. Record refresh age alongside checker state so an operator can distinguish intentional suppression from missing work.

Bound retries independently.

A flag poller that retries without backoff can become another source of noise precisely when the monitoring path is being suppressed. Honor rate-limit instructions, spread refreshes across workers, and maintain a local retry budget. The useful question is how much new work remains admissible after the stop decision, not how frequently a settings page refreshes.

For rollout, start with one selected tenant or region and compare useful delivery outcomes against repeated checker failures. The selection mechanism must match the flag system's documented targeting contract; a percentage by itself doesn't prove that a particular building is in the cohort. Keep the old observation path available until the new path produces enough evidence to judge it.

A quiet cohort is not proof of delivery.

Alternatives depend on which evidence is missing

The options below serve different parts of the decision. The selection criteria are operational requirements, not benchmark results.

Option Where to evaluate it Boundary to retain
Datadog Logs Searching operational records during a delivery investigation. Recorded activity needs application correlation; a log entry alone does not prove tenant receipt.
Grafana A monitoring workflow organized around dashboards and alerting. Define which delivery outcomes reach the monitoring system; a healthy chart cannot substitute for them.
Sentry An investigation centered on application errors. An error explains a recorded failure; silent scheduled-job failures need separate coverage.
LaunchDarkly Flag management and client evaluation as the central requirement. Verify targeting and evaluation behavior for the chosen client; a flag decision alone is not delivery evidence.
Healthchecks A scheduled notification job that should have run but stayed silent. A job heartbeat does not establish email placement or SMS delivery.
Shared backend API Account operations and observability in one application integration. Basic polling-based flags require application-owned freshness and retry policies.

Infrai fits the last row through a unified API with a single API key and unified billing. Its plain REST API needs no SDK: 295 routes across 20 modules use the same key, so adding an account operation beside observability can remain another call under the same contract. Public discovery supplies request and response schemas plus runnable examples, which helps check the handoff without guessing payload fields. The limitation is polling-only flag evaluation: there is no audit trail, no evaluation analytics, and no parent-child dependency support. This is not a replacement for a dedicated flag platform when those controls are requirements. Preserve your own decision record and prefer disabling a flag before deleting it, since deletion has no recycle bin.

The trade-off is additional application work around the narrow flag contract.

There are adjacent boundaries too. This combined approach needs an application-owned query loop and alert routing; threshold notifications and phone, SMS, or webhook alert delivery are outside its observability contract. Use a heartbeat tool for silent scheduled-job failures. Trace identifiers in logs can support correlation, but don't promise a distributed trace query or span tree. Source-map resolution, crash symbolication, Electron minidump parsing, and session replay require another tool.

A vendor console plus Datadog Logs means two service signups and two credential sets in this comparison. The application still has to connect a credential action to the relevant log investigation, preserve the time boundary, and translate provider identifiers into whatever its logs actually contain. The combined approach reduces that integration seam, but it concentrates trust, billing, and the outage surface in one vendor.

Critical path: carry account context into the log investigation

After suppressing a noisy checker, an operator may also need to inspect credentials involved in the notification integration. The example below reads an account key inventory and carries its digest into the subsequent log collection. It uses the same key and base URL for both calls. The digest labels the exact account snapshot accompanying the evidence bundle; it does not assert that an account key identifier is present in any log.

This is a read-only handoff.

Credential revocation belongs in an authorized response procedure. Neither automatic rotation nor a compromise-reporting endpoint is assumed here. If revocation is required, preserve the evidence and ensure the investigation credential remains available through the approved access process.

The code is a complete Python program using only the standard library. Set INFRAI_API_KEY and INFRAI_BASE_URL in the environment, using the service's documented v1 API base for the latter. It requests no search filters and preserves raw JSON rather than guessing response-envelope fields. The account snapshot feeds the collection function and labels its output.

import hashlib
import json
import os
import random
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

BASE = os.environ["INFRAI_BASE_URL"].rstrip("/")
KEY = os.environ["INFRAI_API_KEY"]


def retry_delay(value, attempt):
    if value:
        try:
            return max(0.0, float(value))
        except ValueError:
            try:
                target = parsedate_to_datetime(value)
                if target.tzinfo is None:
                    target = target.replace(tzinfo=timezone.utc)
                return max(0.0, (target - datetime.now(timezone.utc)).total_seconds())
            except (TypeError, ValueError, OverflowError):
                pass
    return (2 ** attempt) + random.uniform(0.0, 1.0)


def read_json(path):
    for attempt in range(4):
        request = Request(
            BASE + path,
            headers={"Authorization": "Bearer " + KEY},
            method="GET",
        )
        try:
            with urlopen(request, timeout=15) as response:
                if response.status != 200:
                    raise RuntimeError(f"Unexpected status: {response.status}")
                return json.load(response)
        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))
    raise RuntimeError("Read attempts exhausted")


def collect_evidence(account_snapshot):
    serialized = json.dumps(account_snapshot, sort_keys=True).encode("utf-8")
    snapshot_digest = hashlib.sha256(serialized).hexdigest()
    collected_at = datetime.now(timezone.utc).isoformat()
    log_response = read_json("/logs/search")
    return {
        "account_snapshot_sha256": snapshot_digest,
        "collection_started_at": collected_at,
        "log_response": log_response,
    }


if __name__ == "__main__":
    account_snapshot = read_json("/account/keys/list")
    evidence = collect_evidence(account_snapshot)
    print(json.dumps(evidence, indent=2))
Enter fullscreen mode Exit fullscreen mode

The 4 attempts bound the number of requests in this example; they don't promise a fixed total runtime because Retry-After can request a longer wait. Connection failures surface to the caller. There are no writes, so this sample doesn't need a write-deduplication mechanism.

Treat the output as sensitive operational evidence. Its account digest supports matching a separately retained snapshot; it doesn't anonymize the returned logs, prove a compromise, or establish the affected tenants. Capture only what an authorized investigation needs and keep console output out of shared CI logs.

A real blast-radius assessment still requires actual application correlation data and access controls.

The query response is also not a guaranteed bulk export or subscription. Search and metric filtering parameters are not assumed here, and retention or cold-storage settings are not treated as configurable controls. For a production collection policy, resolve scope and retention before relying on this small read path as a record of an incident.

Rejected option: mute every failure until the graph settles

A blanket mute removes the distinction this service needs most: repeated checker failures versus a tenant notification that never acquired a delivery outcome. It also makes a paused checker look similar to a scheduled task that never ran. Reject it as the primary response to a retry storm.

A narrowly scoped alert mute still has a valid use during planned maintenance when an operator has a defined expiry and another way to observe delivery outcomes. It should suppress a notification channel, not erase the underlying records. The polling flag should likewise stop optional work while leaving an explicit reduced-coverage state.

Recovery is a decision, too. Reenable the checker for one cohort, inspect whether useful outcomes increase relative to duplicate failures, and expand only when that evidence supports it. If the records remain ambiguous, improve the application events before broadening the rollout.

Quieter is insufficient.

References

Top comments (0)