Skip to main content

foam-otel-core (Python)

Foam's shared server-side OpenTelemetry package for Python — the Python counterpart of @foam-ai/otel-core. One core, adapters as optional extras, per-customer behavior via configuration.

Quick start

pip install foam-otel-core[fastapi]
from foam_otel import init
from foam_otel.fastapi import FoamMiddleware

init(service_name="my-service")  # token from FOAM_OTEL_TOKEN env
app.add_middleware(FoamMiddleware)

init() only exports in production (ENVIRONMENT/ENV/PYTHON_ENV/ NODE_ENV set to production) or with force_export=True. It registers global OTel providers, so afterwards the standard OTel API exports to foam:

from opentelemetry import trace, metrics
from foam_otel import get_tracer, get_meter, get_logger

with get_tracer("app").start_as_current_span("work") as span:
    span.record_exception(err)          # exceptions
get_meter("app").create_counter("jobs").add(1)
get_meter("app").create_histogram("latency_ms").record(12.5)
get_meter("app").create_up_down_counter("active").add(-1)
get_logger("app").emit(...)             # log records

Configuration

Option Default Notes
token FOAM_OTEL_TOKEN env required to export
endpoint OTEL_EXPORTER_OTLP_ENDPOINT env, then https://otel.api.foam.ai
force_export False export outside production
redact_contact_info False adds email/phone/telefono/celular to redaction
redact_keys [] extra keys to redact
health_routes [] routes exempted from request-context capture (none by default — health checks are captured)

Batch cadence honors OTEL_BSP_SCHEDULE_DELAY, OTEL_BLRP_SCHEDULE_DELAY, and OTEL_METRIC_EXPORT_INTERVAL (read natively by the SDK).

The wire contract (stamps, foam.rid baggage, redaction defaults, anti-fabrication) is specified in contract/SPEC.md and enforced by test-apps/python-fastapi.

Metadata

Release files for foam-otel-core 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foam-otel-core 0.2.0
File Size Uploaded
foam_otel_core-0.2.0.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foam-otel-core 0.2.0
File Interpreter ABI Platform
foam_otel_core-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / foam_otel_core-0.2.0.tar.gz

Download URL foam_otel_core-0.2.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f6d5cab426475495ce02642eb88a239996e113c540bfb666bdb10f9c7a3af377
BLAKE2b-256 checksum
How to use checksums
21e3dd6f8f309356c52d01ca6d718310537c55a4398c638475b031e291db54ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / foam_otel_core-0.2.0-py3-none-any.whl

Download URL foam_otel_core-0.2.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9aac1c0c55887969bcb7d37f6d8a3552a7b8b149924451890bfdf188642bb9e
BLAKE2b-256 checksum
How to use checksums
8bb8c40c939222cd8b22d471b24fd143c5b4149a7a0e448bdd46f319c234b1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page