logbrew-flask 0.1.4 or newer for one-call Flask initialization,
background HTTPS delivery, request spans, typed unhandled-exception issues,
and optional request-duration metrics. It requires Python 3.10 or newer and
Flask 3.1 or newer.
Use a project-scoped server ingest key in the application. Do not use the
account credential that authorizes the CLI.
Send the first request
1
Create or select a project key
Sign in with the CLI first. For a new project, store its one-time key in a
new owner-only file:For an existing project, read its ID and create a separate server key:The CLI stores the one-time key with owner-only permissions. It does not
print the key or its file path. Use your deployment platform’s secret
manager instead of this local file in production.
2
Install the released integration
Create or activate the application’s virtual environment, then install the
framework package. It installs the compatible core SDK dependency.
3
Configure deployment identity
Load the project key locally without printing it. Set a stable service,
environment, and release so every signal has useful deployment context.
init_logbrew() checks explicit arguments first, then Flask application
configuration, then these environment variables. If no service name is
configured, it uses the Flask import name.4
Initialize Flask once
Add the initializer after creating the Flask application. The logging
handler is optional, but it lets application logs share the active request
trace and span.Repeated
init_logbrew(app) calls return the same Flask extension. They do
not install duplicate request or exception hooks. Configure the app-owned
logger once; the initializer does not add or deduplicate logging handlers.5
Run one request
Start the app and call the route from another terminal.Delivery runs in the background and does not wait on the Flask response.
The first accepted event wakes the delivery worker immediately.
6
Verify hosted evidence
Read the exact project and deployment scope. A successful first request
returns at least one trace; the optional logging handler also creates a
correlated log.Copy the returned trace ID into the bounded investigation command:The authenticated read is the end-to-end proof that the hosted product
accepted, stored, and indexed the event. A local
200 response from
/health proves only that Flask handled the request.What the integration captures
Inspect a captured exception and request metric without guessing their IDs or
meaning:
logbrew-flask package guide.
Privacy and process lifecycle
Automatic Flask capture omits concrete request paths, query strings, request and response bodies, cookies, arbitrary headers, rawtraceparent values,
baggage, and tracestate. Named routes use the Flask route template. Unmatched
routes use the fixed <unmatched> label.
Create the app and LogBrew client inside each worker process. Gunicorn’s
default per-worker app loading is compatible. Do not use Gunicorn --preload
with a client created in the parent process. For uWSGI, use per-worker app
loading such as --lazy-apps. The Python client deliberately rejects reuse
after a process fork.
Register logbrew.client.shutdown() in the process manager’s normal
per-worker shutdown hook. It flushes the retained tail before closing. Do not
call it after every request.
Recover from setup problems
See Troubleshooting for account access, key-role,
readback, and typed-error recovery. See Send SDK telemetry
for the shared event and privacy contract.
