Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ RUN if [ "$INSTALL_DDTRACE" = "true" ]; then \
# Optional: OpenTelemetry tracing (enabled via OTEL_TRACING_ENABLED=true at runtime).
# Parallel to ddtrace — deployer picks one at runtime; both can be installed.
#
# Auto-instrumentation packages match the libraries primitivemail uses so the
# OTel path produces the same span graph ddtrace's auto-instrumentation does:
# urllib3 — outbound HTTP (webhook + HTTP-style storage uploads)
# botocore — boto3 (S3 native uploads)
# logging — adds otelTraceID/otelSpanID to LogRecord for log-trace correlation
# dnspython — DNS lookups during SPF/DKIM/DMARC checks
# Auto-instrumentation packages match the libraries primitivemail uses
# so the OTel path produces the same span graph ddtrace's
# auto-instrumentation does for those libraries:
# urllib3 — outbound HTTP (webhook + HTTP-style storage uploads)
# botocore — boto3 (S3 native uploads)
# logging — adds otelTraceID/otelSpanID to LogRecord for log-trace
# correlation
# The opentelemetry-distro package supplies the `opentelemetry-instrument`
# CLI wrapper used by entrypoint.sh to activate everything at startup.
#
# Note: there's no upstream OTel auto-instrumentation for `dnspython`,
# so DNS lookups during SPF/DKIM/DMARC checks don't get their own
# spans. The manual milter.process_email parent span still wraps them
# — we lose per-call breakdown, not trace context.
#
# Auto-instrumentations can be disabled per-library via
# OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=urllib3,botocore,... if a deployer
# wants only the manual spans.
# OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=urllib3,botocore,logging if a
# deployer wants only the manual spans.
ARG INSTALL_OTEL=false
RUN if [ "$INSTALL_OTEL" = "true" ]; then \
pip3 install --no-cache-dir \
Expand All @@ -49,8 +55,7 @@ RUN if [ "$INSTALL_OTEL" = "true" ]; then \
'opentelemetry-distro>=0.48b0,<1' \
'opentelemetry-instrumentation-urllib3>=0.48b0,<1' \
'opentelemetry-instrumentation-botocore>=0.48b0,<1' \
'opentelemetry-instrumentation-logging>=0.48b0,<1' \
'opentelemetry-instrumentation-dnspython>=0.48b0,<1'; \
'opentelemetry-instrumentation-logging>=0.48b0,<1'; \
fi

# Work dir for our scripts/config
Expand Down