Skip to content

Observability

The storefront and Magento can send OpenTelemetry traces, metrics and logs to the observability profile of the magenxcommerce-docker stack: an OpenTelemetry Collector and OpenObserve (open-source edition), which stores all three and shows them in one UI.

OTLP/HTTP :4318traceparentOTLP/HTTP :4318filelogOTLP/HTTP, spanmetrics

Storefront
(@vercel/otel)

OTel Collector

Magento
(Magenx_OpenTelemetry)

nginx + Magento
log files

OpenObserve
traces, metrics, logs

  • Traces: full request waterfalls, from the Next.js render through the /api/graphql proxy into Magento, plus the server components’ own catalog fetches. The storefront sends the W3C traceparent header to Magento only, so the Magento GraphQL <operation> span joins the same trace.
  • RED metrics: request rate, error rate and p50/p95/p99 latency per service and per GraphQL operation, computed by the collector from the spans. There is no metric code in the apps.
  • Logs: storefront server errors, Magento var/log/*.log and the nginx /graphql timing log. Entries that carry a trace id link to their trace.
  • Cache report: with the shared caches on (SF_CACHE_NEXT=1), each storefront process writes one [cache-stats] line a minute, to stdout and as an OTel log record. It counts the outcomes of the "use cache" handler, page shells and the guest GraphQL cache (hit, stale, miss, purged, bypass, fallback), Magento purges, and Valkey errors and circuit-breaker trips. A quiet minute writes nothing.

One dashboard ships in openobserve/dashboards/ of magenxcommerce-docker: MagenX Storefront — RED. Its Caches tab charts the cache report. Real-user Core Web Vitals are not in OpenObserve: they go to GA4 (see Analytics) or come from Cloudflare Web Analytics.

MetricTypeLabels
storefront_callscounterservice_name, span_name, status_code, graphql_operation_name, http_route, http_response_status_code
storefront_duration_*histogramas above
  1. In the magenxcommerce-docker .env, set COMPOSE_PROFILES="observability". scripts/random_generator.sh writes ZO_ROOT_USER_* and the collector’s OPENOBSERVE_AUTH to .env.secrets. Start the stack: it runs otel-collector and openobserve next to the storefront and Magento.

  2. In the same .env, set OTEL_EXPORTER_OTLP_ENDPOINT="http://otel-collector:4318" for the storefront. For Magento, install magenxcommerce/module-open-telemetry and set MAGENTO_OTEL_ENABLED="true". The compose file already puts both on the observability network.

  3. OpenObserve has no public or host port (the observability network is internal). It is at /logs/ on the private admin hostname.

  4. Import the dashboards on the server, from the magenxcommerce-docker folder. The script reads the root login from .env.secrets, and each run adds new copies:

    Terminal window
    bash openobserve/import-dashboards.sh

With OTEL_EXPORTER_OTLP_ENDPOINT unset, OpenTelemetry is fully off, with no overhead. Under heavy traffic, sample traces with OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG on the storefront; Magento follows its decision, so traces stay complete.

SignalWhere it showsOn by default
OpenTelemetry traces, metrics and logsCollector, OpenObserve. Never in the browser.When OTEL_EXPORTER_OTLP_ENDPOINT is set
Server-Timing on /api/graphql (Magento time, proxy upstream time, operation)Browser DevToolsNo: GRAPHQL_PROFILE=1
[graphql profile] log linesServer log; the browser console with NEXT_PUBLIC_GRAPHQL_PROFILE=1No
[server-error] structured logsServer log; OpenObserve when OTel is onYes
nginx graphql_timing log (JSON)/var/log/nginx/graphql-timing.log; OpenObserve when the collector tails itYes
Magento dispatch timeGraphQL Timing module headerYes, surfaced only with profiling on
GA4 eventsGoogle, consent-gatedWhen NEXT_PUBLIC_GTM_ID is set

No trace id or OpenTelemetry data appears in any browser-facing header.

For the Magento side, the Platform Overview module shows the health of MariaDB, Redis, RabbitMQ, OpenSearch, PHP-FPM and Nginx in the admin.