Skip to main content

Apitally logo

API monitoring & analytics made simple

Metrics, logs, and alerts for your serverless APIs — with just a few lines of code.


Apitally dashboard


Apitally SDK for Cloudflare Python Workers

Tests Codecov PyPI

Apitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues. Get started in minutes by just adding a few lines of code and a Logpush job.

Learn more about Apitally on our 🌎 website or check out the 📚 documentation.

This SDK is for APIs running on Cloudflare Python Workers and relies on Logpush to send data to Apitally.

Key features

API analytics

Track traffic, error and performance metrics for your API, each endpoint and individual API consumers, allowing you to make informed, data-driven engineering and product decisions.

Request logs

Drill down from insights to individual API requests or use powerful search and filters to find specific requests. View correlated application logs for a complete picture of each request, making troubleshooting faster and easier.

Error tracking

Understand which validation rules in your endpoints cause client errors. Capture error details and stack traces for 500 error responses.

API monitoring & alerts

Get notified immediately if something isn't right using custom alerts and synthetic uptime checks. Alert notifications can be delivered via email, Slack and Microsoft Teams.

Supported frameworks

Framework Supported versions Setup guide
FastAPI >=0.116.1 Link

Apitally also supports many other web frameworks in Python, JavaScript, Go and .NET via our other SDKs.

Getting started

If you don't have an Apitally account yet, first sign up here.

1. Create app in Apitally

Create an app in the Apitally dashboard and select FastAPI (Cloudflare Workers) as your framework. You'll see detailed setup instructions, which also include your client ID.

2. Create Logpush job

Log in to the Cloudflare dashboard and navigate to Analytics & Logs > Logpush. Create a Logpush job with the following settings:

Setting Value
Destination HTTP destination
HTTP endpoint https://hub.apitally.io/v2/{client-id}/{env}/logpush
Dataset Workers trace events
If logs match... Filtered logs: EventType equals fetch and ScriptName equals {your-worker-name}
Send the following fields... General: Event, EventTimestampMs, Logs

In the HTTP endpoint, replace {client-id} with your app's client ID and {env} with the environment (e.g. prod or dev). In the filter criteria, replace {your-worker-name} with the name of your Worker, as specified in your Wrangler config.

3. Configure Worker

Enable Workers Logs and Logpush in your wrangler.toml configuration file:

logpush = true

[observability]
enabled = true
head_sampling_rate = 1

[observability.logs]
invocation_logs = true

4. Add middleware

Install the SDK:

uv add apitally-serverless

Then add the Apitally middleware to your FastAPI application:

from fastapi import FastAPI
from apitally_serverless.fastapi import ApitallyMiddleware

app = FastAPI()
app.add_middleware(
    ApitallyMiddleware,
    log_request_headers=True,
    log_request_body=True,
    log_response_body=True,
)

For further instructions, see our setup guide for FastAPI on Cloudflare Workers.

See the SDK reference for all available configuration options, including how to mask sensitive data, customize request logging, and more.

Getting help

If you need help please create a new discussion on GitHub or email us at support@apitally.io. We'll get back to you as soon as possible.

License

This library is licensed under the terms of the MIT license.

Metadata

Release files for apitally-serverless 0.2.2

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

Source distribution (sdist)

Source distribution for apitally-serverless 0.2.2
File Size Uploaded Provenance Actions
apitally_serverless-0.2.2.tar.gz 72.9 kB Without provenance Details for apitally_serverless-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apitally-serverless 0.2.2
File Interpreter ABI Platform Actions
apitally_serverless-0.2.2-py3-none-any.whl Python 3 none any Details for apitally_serverless-0.2.2-py3-none-any.whl

Total release size: 86.3 kB

Release files / apitally_serverless-0.2.2.tar.gz

Download URL apitally_serverless-0.2.2.tar.gz
Size 72.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f1fd8d70bf2461baddb40d1f69edc7fe10583bfbccf3b3013b396d5677e58956
BLAKE2b-256 checksum
How to use checksums
b253d77043c9ab3db63ce9afd13e6df7e9c4bc966275499fac006dc575a06d77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / apitally_serverless-0.2.2-py3-none-any.whl

Download URL apitally_serverless-0.2.2-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa703086f5ec3cdefbf827fbf1a121d43445594c0047d747c027e640dd1f7c3d
BLAKE2b-256 checksum
How to use checksums
807c97cfc5cbe921045938bec8bd6aaf294956ca52084946098c4f7703ab6caa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for apitally-serverless 0.2.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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