Production observability via OTLP export to Plain Cloud.
Project description
plain.cloud
Production observability via OTLP export to Plain Cloud.
Overview
You can use plain.cloud to export traces and metrics from your Plain app to Plain Cloud. The framework already instruments itself with OpenTelemetry spans and histograms — plain.cloud activates them by providing the OTLP exporters.
Set two environment variables and your app starts pushing telemetry:
PLAIN_CLOUD_EXPORT_URL=https://ingest.plaincloud.com
PLAIN_CLOUD_EXPORT_TOKEN=your-token
If CLOUD_EXPORT_URL is not set, the package is a no-op — safe to install without configuration.
Settings
| Setting | Default | Description |
|---|---|---|
CLOUD_EXPORT_URL |
"" |
OTLP ingest endpoint (e.g. https://ingest.plaincloud.com) |
CLOUD_EXPORT_TOKEN |
"" |
Auth token for the export endpoint |
CLOUD_TRACE_SAMPLE_RATE |
1.0 |
Probability of exporting a trace (0.0–1.0) |
All settings can be set via PLAIN_-prefixed environment variables or in app/settings.py.
Sampling
By default, all traces are exported. To reduce volume, set a sample rate:
CLOUD_TRACE_SAMPLE_RATE = 0.1 # Export 10% of traces
Metrics are not affected by sampling — histograms aggregate in-process and export periodically regardless of the trace sample rate.
What gets exported
Traces — HTTP request spans and database query spans instrumented by the framework.
Metrics — OTel histograms like db.client.query.duration, aggregated and pushed every 60 seconds.
Observer coexistence
If plain.observer is also installed, both work simultaneously. plain.cloud handles production export while observer provides the local dev toolbar and admin trace viewer. Observer detects the existing TracerProvider and layers its sampler and span processor on top.
FAQs
Do I need plain.observer to use plain.cloud?
No. plain.cloud works independently. Observer is for local dev tooling; plain.cloud is for production export.
What happens if the export endpoint is unreachable?
The OTLP exporters batch and retry automatically. If the endpoint is down, telemetry is dropped after retries — it does not block your application.
Does this add latency to requests?
No. Trace spans are exported in a background thread via BatchSpanProcessor. Metrics are flushed periodically by a background thread. Neither blocks request handling.
Installation
# app/settings.py
INSTALLED_PACKAGES = [
"plain.cloud",
# ...
]
Place plain.cloud before plain.observer in INSTALLED_PACKAGES so it sets up the TracerProvider first.
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 plain_cloud-0.1.0.tar.gz.
File metadata
- Download URL: plain_cloud-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9a9e89e74be6d5d0902cc0a18c664588b09912ae48bd8905e26698a0cf5a193
|
|
| MD5 |
6e2685143fe530ec38caa806b1da22dc
|
|
| BLAKE2b-256 |
a223198e5e9342a8741a620e54b347d228704fb947f1be5b67c42e042df6d61f
|
File details
Details for the file plain_cloud-0.1.0-py3-none-any.whl.
File metadata
- Download URL: plain_cloud-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e56e6cad4d2fce79e8520a1a9dde67f6d43dc21734fbe7520b702828c885aa7
|
|
| MD5 |
f6e89bb9310144e6a1f68e05469d30ca
|
|
| BLAKE2b-256 |
d9fc59410469029c34f185514d8320b2fe599239286d31c0a0516fd488b8e24e
|