Observe the API and worker
The API and standalone worker write JSON application logs to stderr. Logs
emitted with an active trace context include trace_id and span_id.
By default these processes start without a collector or a profiling port.
Export OTLP
Set OTEL_EXPORTER_OTLP_ENDPOINT to the HTTP(S) base URL of a trusted OpenTelemetry
Collector in both process environments. The SDK sends HTTP/protobuf to
/v1/traces and /v1/metrics. Put collector credentials in
OTEL_EXPORTER_OTLP_HEADERS through the deployment secret store. Use TLS for
traffic crossing a host boundary. The service names are potik-api and
potik-worker. Embedded worker measurements belong to the API service.
Span export runs on a bounded batch queue. A full queue drops spans. Metrics
are collected periodically in the background. Set OTEL_TRACES_SAMPLER to
parentbased_traceidratio and OTEL_TRACES_SAMPLER_ARG to a fraction such as
0.1 for 10% sampling, then adjust for the application's traffic and budget.
With export enabled and no sampler configured the SDK samples every local root.
An unavailable collector can cause telemetry loss while application requests
continue to run.
| Signal | Meaning |
|---|---|
graphql.request.duration, graphql.request.errors | Time in seconds for a GraphQL HTTP request and count of failed requests, including GraphQL errors returned with HTTP 200. Operation type is query, mutation, subscription or unknown. |
db.client.operation.duration | Seconds per pgx query and a boolean success label. PostgreSQL spans nest under instrumented GraphQL operations and jobs. |
db.client.connections | In-use, idle and maximum pool connections. Divide in-use by limit to measure utilization. |
jobs.processing.duration, jobs.processing.failures | Handler execution time in seconds and failed attempts, including retries. |
jobs.queue.pending, jobs.queue.oldest_pending.age | Ready-to-run jobs and age in seconds of the oldest pending job for each of the three configured queues. Each worker observes shared queue state. Use max across worker replicas. |
realtime.connections.active, realtime.publications | Current local authenticated connections and attempts to publish a notification hint, grouped by success for publication attempts. |
Instrument labels exclude IDs, channel names, job contents, SQL, GraphQL documents, arguments and credential material. PostgreSQL remains the source of notification history. A publication count is an attempt count and can include redelivery.
Profile a process
Enable profiling on the target process by setting PPROF_ADDR to a numeric
loopback address such as 127.0.0.1:6060, and set PPROF_TOKEN to an
operator-only random secret of at least 32 characters. Leave this port
unpublished. Run the client in the process's network namespace. For example,
on a trusted shell or through an operator tunnel:
curl --fail --silent --show-error \
--config - \
'http://127.0.0.1:6060/debug/pprof/profile?seconds=10' \
--output cpu.pprof <<EOF_AUTH
header = "Authorization: Bearer ${PPROF_TOKEN}"
EOF_AUTH
go tool pprof -top cpu.pprofKeep profiles in operator-controlled storage. Remove the profiling variables and restart the diagnostic process when finished.