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.
What you get
Section titled “What you get”- Traces: full request waterfalls, from the Next.js render through the
/api/graphqlproxy into Magento, plus the server components’ own catalog fetches. The storefront sends the W3Ctraceparentheader to Magento only, so the MagentoGraphQL <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/*.logand the nginx/graphqltiming 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.
| Metric | Type | Labels |
|---|---|---|
storefront_calls | counter | service_name, span_name, status_code, graphql_operation_name, http_route, http_response_status_code |
storefront_duration_* | histogram | as above |
Run it
Section titled “Run it”-
In the magenxcommerce-docker
.env, setCOMPOSE_PROFILES="observability".scripts/random_generator.shwritesZO_ROOT_USER_*and the collector’sOPENOBSERVE_AUTHto.env.secrets. Start the stack: it runsotel-collectorandopenobservenext to the storefront and Magento. -
In the same
.env, setOTEL_EXPORTER_OTLP_ENDPOINT="http://otel-collector:4318"for the storefront. For Magento, installmagenxcommerce/module-open-telemetryand setMAGENTO_OTEL_ENABLED="true". The compose file already puts both on theobservabilitynetwork. -
OpenObserve has no public or host port (the
observabilitynetwork is internal). It is at/logs/on the private admin hostname. -
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.
Every timing signal
Section titled “Every timing signal”| Signal | Where it shows | On by default |
|---|---|---|
| OpenTelemetry traces, metrics and logs | Collector, OpenObserve. Never in the browser. | When OTEL_EXPORTER_OTLP_ENDPOINT is set |
Server-Timing on /api/graphql (Magento time, proxy upstream time, operation) | Browser DevTools | No: GRAPHQL_PROFILE=1 |
[graphql profile] log lines | Server log; the browser console with NEXT_PUBLIC_GRAPHQL_PROFILE=1 | No |
[server-error] structured logs | Server log; OpenObserve when OTel is on | Yes |
nginx graphql_timing log (JSON) | /var/log/nginx/graphql-timing.log; OpenObserve when the collector tails it | Yes |
| Magento dispatch time | GraphQL Timing module header | Yes, surfaced only with profiling on |
| GA4 events | Google, consent-gated | When 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.