Foam's shared server-side OpenTelemetry package for Python. One core, adapters as optional extras, per-customer behavior via configuration.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file foam_otel_core-0.2.0.tar.gz.
File metadata
- Download URL: foam_otel_core-0.2.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d5cab426475495ce02642eb88a239996e113c540bfb666bdb10f9c7a3af377
|
|
| MD5 |
90eb5c0dc3e5f04661c30da970539f6c
|
|
| BLAKE2b-256 |
21e3dd6f8f309356c52d01ca6d718310537c55a4398c638475b031e291db54ac
|
Provenance
The following attestation bundles were made for foam_otel_core-0.2.0.tar.gz:
Publisher:
release.yml on foam-ai/packages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foam_otel_core-0.2.0.tar.gz -
Subject digest:
f6d5cab426475495ce02642eb88a239996e113c540bfb666bdb10f9c7a3af377 - Sigstore transparency entry: 2192292303
- Sigstore integration time:
-
Permalink:
foam-ai/packages@5f4c62c64c649ee88d69f5c9c59a5c43b349a931 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/foam-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5f4c62c64c649ee88d69f5c9c59a5c43b349a931 -
Trigger Event:
push
-
Statement type:
File details
Details for the file foam_otel_core-0.2.0-py3-none-any.whl.
File metadata
- Download URL: foam_otel_core-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9aac1c0c55887969bcb7d37f6d8a3552a7b8b149924451890bfdf188642bb9e
|
|
| MD5 |
a378bb5110adcec9c04a1829baefb8e0
|
|
| BLAKE2b-256 |
8bb8c40c939222cd8b22d471b24fd143c5b4149a7a0e448bdd46f319c234b1b6
|
Provenance
The following attestation bundles were made for foam_otel_core-0.2.0-py3-none-any.whl:
Publisher:
release.yml on foam-ai/packages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foam_otel_core-0.2.0-py3-none-any.whl -
Subject digest:
a9aac1c0c55887969bcb7d37f6d8a3552a7b8b149924451890bfdf188642bb9e - Sigstore transparency entry: 2192292373
- Sigstore integration time:
-
Permalink:
foam-ai/packages@5f4c62c64c649ee88d69f5c9c59a5c43b349a931 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/foam-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5f4c62c64c649ee88d69f5c9c59a5c43b349a931 -
Trigger Event:
push
-
Statement type: