Skip to main content

Analytics read side

Decision record: ADR 0017. Two optional binaries, off by default in the chart, turn this context's own events into a per-day report. They read no sibling's topic and call no sibling.

BinaryRolePort
cmd/si-projectorthe only writer of a separate analytical Postgres; consumes retailnetwork.seller-inbound.events and retailnetwork.seller-inbound.analytics under ANALYTICS_CONSUMER_GROUP (default seller-inbound-analytics):8091 (/healthz, /readyz)
cmd/si-reportsread-only HTTP over the analytical database, no auth:8092

What is projected​

Event (com.retailnetwork.partner.seller-inbound.<entity>.<Name>)TopicUsed for
inboundplan.InboundPlanConfirmedanalyticsinbound_plans_confirmed (confirmedAt)
placementplan.PlacementPlanSuggestedeventsplacement_advisories_issued (createdAt), the advisory side of the latency
inboundshipment.InboundShipmentReceivedeventsshipments_received (receivedAt), received stock per item, the receipt side of the latency

The seven other published types are acknowledged and not projected. A message that is not CloudEvents 1.0, or of an unknown type, is skipped with a sampled WARN; deterministic poison goes to retailnetwork.seller-inbound.analytics.dlq; a transient failure is retried forever.

GET /reports/seller-inbound-performance?from=&to=​

from and to are UTC dates, both inclusive; neither means the 30 days ending today, and at most 366 days. A bad range is a 400 invalid-report-range problem. The body is snake_case: from, to and days, one row per UTC day that has any fact (a day without facts has no row, an empty range is "days": []):

FieldMeaning
daythe UTC day of each fact's own business instant
inbound_plans_confirmedplans confirmed (creation publishes no event)
placement_advisories_issuedplacement advisories recorded
shipments_receivedshipment receipts published
received_eaches, received_item_counteaches and distinct GTINs over every received line of the day
received_by_itemat most 10 items, most eaches first: gtin, catalog_item_id (when resolved), publications, qty_eaches
advisory_to_receipt_samples, ..._p50_seconds, ..._p95_secondsseconds from the seller's latest preceding advisory for the same item to a received line of that item; null percentiles without a sample

The advisory-to-receipt figure is the time since the seller's latest advice about the item, not a causal lead time: no own fact links an advisory to a shipment.

GET /reports/freshness answers {"as_of": ..., "lag_seconds": ...}, both null until the first event. The REST reference is generated from apis/openapi.yaml (tag Reports).

Not reported​

Inbound capacity allocations granted or refused, and a Pareto of refusal reasons: the capacity gate answers inbound-capacity-exceeded over REST and publishes no event, so there is no own fact to project. A new analytics-only event would be needed first (ADR 0017, section 3).

Chart and environment​

analytics.enabled (default false) renders the analytics-projector Deployment (no Service) and the analytics-reports Deployment and ClusterIP Service on port 80; analytics.reports.route.enabled adds the /api/seller-inbound/reports route. Enabling it needs analytics.database.projectorUrl or analytics.database.existingSecret, kafka.brokers and analytics.projector.consumerGroup; the chart refuses to render without them. The projector never gets the OLTP DATABASE_URL; the reports pod gets only ANALYTICS_READER_DATABASE_URL.

VariableBinaryDefault
ANALYTICS_DATABASE_URLprojector (required, direct DSN: it runs the migrations)
KAFKA_BROKERSprojector (required)
ANALYTICS_CONSUMER_GROUPprojectorseller-inbound-analytics
ADMIN_ADDRprojector:8091
ANALYTICS_READER_DATABASE_URLreports (falls back to ANALYTICS_DATABASE_URL for local runs)
HTTP_ADDRreports:8092
LOG_LEVEL, OTEL_SERVICE_NAME (seller-inbound-projector / seller-inbound-reports), OTEL_EXPORTER_OTLP_ENDPOINT, SERVICE_VERSION, ENVIRONMENTbothas the other binaries