Skip to content

Technical guide · Overview

Page status: Active

NutsNews Worker-Uplift Telemetry Scope

Status: approved for ramideltoro/nutsnews-worker#144 on 2026-07-23.

Visual overview

Primary diagram

System map

Status: approved for ramideltoro/nutsnews-worker#144 on 2026-07-23.

Render the repository-owned system map when you need it.

Diagram is not rendered yet.

View as text
NutsNews Worker-Uplift Telemetry Scope

Status: approved for ramideltoro/nutsnews-worker#144 on 2026-07-23.

flowchart TD
  accTitle: NutsNews Worker-Uplift Telemetry Scope
  accDescr {
    Status: approved for ramideltoro/nutsnews-worker#144 on 2026-07-23.
  }
  A["Decision: Worker-uplift telemetry scope"] --> B["Required metrics"]
  A --> C["Required structured logs"]
  A --> D["Traces disabled"]
  A --> E["Exemplars deferred"]
  A --> F["Profiles forbidden"]

  B --> G["RabbitMQ + service metrics only"]
  G --> H["Private Alloy scrape / metrics remote_write"]
  C --> I["Docker journald + worker logs"]
  I --> J["Loki process label allowlist and redaction"]

  H --> K["Credentials: metrics URL/user/policy token"]
  J --> L["Credentials: logs URL/user/policy token"]

  K --> M["Apply usage and quota guardrails from grafanacloud-usage"]
  L --> M

  M --> N["70% freeze optional telemetry"]
  M --> O["85% reduce debug / verbosity"]
  M --> P["95% disable offending signal"]
  M --> Q["Over budget hold production uplift"]

  B --> R["Allowed labels only: environment, host, service, version, queue, outcome"]
  C --> S["Forbidden payload fields excluded"]

  T["Rollback switches"] --> U["Disable metrics / logs / traces / exemplars"]
  R --> T
  S --> T

  N --> V["Backend Worker-Uplift Logs Check workflow"]
  O --> V
  P --> V
  Q --> V

NutsNews Worker-Uplift Telemetry Scope

Fullscreen diagram view.

Status: approved for ramideltoro/nutsnews-worker#144 on 2026-07-23.

Canonical infra policy:

ramideltoro/nutsnews-infra/terraform/grafana-cloud/catalog/worker-uplift-telemetry-scope.json

This decision approves the telemetry the worker-uplift pipeline may emit before runtime telemetry work begins. It does not enable the uplift production path.

Telemetry classDecisionDestinationNotes
RabbitMQ metricsRequiredGrafana Cloud MetricsQueue depth, ready/unacked messages, publish/deliver/ack/retry/DLQ rates, consumers, and broker health.
Worker service metricsRequiredGrafana Cloud MetricsPer-service counters, gauges, and bounded histograms for throughput, latency, retries, failures, and backpressure.
Structured logsRequiredGrafana Cloud LogsJSON service logs and RabbitMQ service logs after redaction, size limits, rate limits, and buffering.
TracesDeferredNoneNo Tempo export, OTLP endpoint, or traces credential is provisioned now.
ExemplarsDeferredNoneNo exemplars until traces are separately approved.
ProfilesForbiddenNoneNo profiling signal is approved for worker uplift.
Article/model payload telemetryForbiddenNoneArticle bodies, summaries, model prompts, model outputs, secrets, and production token material must not enter telemetry.

Full trace export is not a runtime dependency. The envelope still carries W3C trace context, and services may include traceparent, tracestate, correlationId, causationId, messageId, and idempotencyKey as structured log fields. Those fields must not become metric labels or Loki stream labels.

Allowed metric labels and Loki stream labels for worker-uplift telemetry:

environment
host
service
version
queue
outcome

Forbidden in metric labels and Loki stream labels:

article, feed, message, idempotency, trace, span, correlation, causation,
payload, url, path, user, ip, token, secret, prompt, model_output

The queue value is bounded to the contract-defined RabbitMQ queue names. The service value is bounded to the eight worker-uplift services. The outcome value is bounded to success, retry, dlq, dropped, timeout, validation_error, dependency_error, and canceled.

The telemetry policy covers every worker-uplift stage route from the contracts package:

StageProducerConsumerMain queueRetry queuesDLQ
fetchschedulerfetchernutsnews.worker.fetch.v1retry-30s, retry-5m, retry-30mnutsnews.worker.fetch.v1.dlq
canonicalizationfetchercanonicalizernutsnews.worker.canonicalization.v1retry-30s, retry-5m, retry-30mnutsnews.worker.canonicalization.v1.dlq
enrichmentcanonicalizerenrichmentnutsnews.worker.enrichment.v1retry-30s, retry-5m, retry-30mnutsnews.worker.enrichment.v1.dlq
approvalenrichmentapprovalnutsnews.worker.approval.v1retry-30s, retry-5m, retry-30mnutsnews.worker.approval.v1.dlq
translationapprovaltranslationnutsnews.worker.translation.v1retry-30s, retry-5m, retry-30mnutsnews.worker.translation.v1.dlq
persistencetranslationpersistencenutsnews.worker.persistence.v1retry-30s, retry-5m, retry-30mnutsnews.worker.persistence.v1.dlq
publicationpersistencepublicationnutsnews.worker.publication.v1retry-30s, retry-5m, retry-30mnutsnews.worker.publication.v1.dlq

Total queue coverage:

Queue classCount
Stage queues7
Retry queues21
Terminal DLQs7
Total RabbitMQ queues35

Service coverage:

scheduler, fetcher, canonicalizer, enrichment, approval, translation, persistence, publication

Host coverage:

backend.nutsnews.com
vps.nutsnews.com

These are source-controlled ceilings, not measured production values.

AreaCeiling
RabbitMQ queue metrics700 active series
Worker service metrics600 active series
Worker histogram metrics700 active series
Backend host series headroom2,000 active series
VPS host series headroom1,000 active series
Worker-uplift plus host ceiling5,000 active series

Monthly log ceilings:

AreaCeiling
Worker services normal JSON logs2.0 GB/month
RabbitMQ and broker logs1.0 GB/month
Backend host total including worker uplift5.0 GB/month
Existing VPS host baseline2.0 GB/month

Assumptions:

  • every main queue, retry queue, and terminal DLQ is represented by the bounded queue label;
  • every deployable worker service is represented by the bounded service label;
  • normal service logging stays at or below 120 JSON lines per service-hour;
  • emergency burst logging is capped at 600 lines per service-hour;
  • log lines above 8192 bytes are dropped or truncated before export;
  • debug and trace logs are dropped in production.

Grafana Cloud quota guardrails in ramideltoro/nutsnews-infra use the grafanacloud-usage datasource and live usage/limit metrics. They must not use committed metrics or logs free-plan constants for alert thresholds.

Required ratios:

GuardrailLive ratio
Metrics active seriesgrafanacloud_instance_metrics_usage / grafanacloud_instance_metrics_limits{limit_name="max_global_series_per_user"}
Logs active streamsgrafanacloud_logs_instance_active_streams / grafanacloud_logs_instance_limits{limit_name="max_global_streams_per_user"}
Logs ingestion rategrafanacloud_logs_instance_bytes_received_per_second / (grafanacloud_logs_instance_limits{limit_name="ingestion_rate_mb"} * 1024 * 1024)
Traces ingestion rategrafanacloud_traces_instance_bytes_received_per_second / grafanacloud_traces_instance_limits{limit_name="ingestion_rate_limit_bytes"}

Alert thresholds are 70%, 85%, and 95%.

No-surprise-spend response:

ThresholdResponse
70%Freeze new telemetry classes, review the Usage / Quota dashboard, and confirm worker uplift remains inside the approved $0 incremental paid telemetry budget.
85%Disable optional debug fields, lower worker log verbosity, reduce scrape cardinality, and keep traces/exemplars disabled.
95%Stop or roll back the offending telemetry signal before adding production traffic.
Over budgetKeep production uplift disabled until owner approval changes the budget or telemetry volume is reduced.

Metrics:

  • worker services expose private Prometheus metrics endpoints;
  • RabbitMQ metrics come from a private scrape/exporter path on the backend host;
  • Alloy scrapes and writes through prometheus.remote_write;
  • credentials are NUTSNEWS_GRAFANA_CLOUD_METRICS_URL, NUTSNEWS_GRAFANA_CLOUD_METRICS_USERNAME, and NUTSNEWS_GRAFANA_CLOUD_ACCESS_POLICY_TOKEN.

Logs:

  • service JSON logs and RabbitMQ logs flow through Alloy loki.source;
  • loki.process applies redaction, label allow-listing, size limits, and rate limits;
  • loki.write sends to Grafana Cloud Logs;
  • credentials are NUTSNEWS_GRAFANA_CLOUD_LOGS_URL, NUTSNEWS_GRAFANA_CLOUD_LOGS_USERNAME, and NUTSNEWS_GRAFANA_CLOUD_ACCESS_POLICY_TOKEN.

Backend issue ramideltoro/nutsnews-worker#88 implements the approved log scope by collecting only explicitly tagged Docker journald streams on backend.nutsnews.com. RabbitMQ uses the nutsnews-worker-uplift-rabbitmq tag. Worker services use one stable tag per service: nutsnews-worker-uplift-scheduler, nutsnews-worker-uplift-fetcher, nutsnews-worker-uplift-canonicalizer, nutsnews-worker-uplift-enrichment, nutsnews-worker-uplift-approval, nutsnews-worker-uplift-translation, nutsnews-worker-uplift-persistence, and nutsnews-worker-uplift-publication. Backend verification is through the protected Backend Worker-Uplift Logs Check workflow, which reports only safe metadata: Alloy health, bounded source count, trace export absence, and Loki query result counts.

Traces and exemplars:

  • no Tempo, OTLP, traces, or exemplar write credentials are approved now;
  • future trace enablement requires a new reviewed infra PR, green quota alerts for seven consecutive days, WORKER_TELEMETRY_TRACES_ENABLED=true, WORKER_TELEMETRY_TRACE_SAMPLE_RATIO<=0.01, and a scoped traces:write credential.

Retention follows the live Grafana Cloud retention_period limits reported by grafanacloud_logs_instance_limits and grafanacloud_traces_instance_limits. Do not request custom retention or Cloud Logs Export for worker uplift.

SignalSwitch
MetricsWORKER_TELEMETRY_METRICS_ENABLED=false or enable_grafana_alloy=false
LogsWORKER_TELEMETRY_LOG_LEVEL=warn, WORKER_TELEMETRY_LOGS_ENABLED=false, or enable_grafana_alloy=false
TracesWORKER_TELEMETRY_TRACES_ENABLED=false and WORKER_TELEMETRY_TRACE_SAMPLE_RATIO=0
ExemplarsWORKER_TELEMETRY_EXEMPLARS_ENABLED=false

Telemetry loss alerts are required for Alloy Loki dropped entries, Alloy Loki write retries, worker metrics scrape absence, and RabbitMQ queue depth metric absence. During shadow qualification, missing required worker metrics or structured logs blocks production traffic.

No production secret, article body, summary body, raw feed XML, raw article HTML, model prompt, model response, database URL, service-role token, access token, cookie, authorization header, or API key may be included in metrics, logs, traces, or exemplars.

Payload references remain in service-owned durable storage. Telemetry may report counts, outcomes, durations, bounded queue names, bounded service names, and sanitized error classes.