Changelog¶
All notable changes to the packages in this repository (redline-core, django-redline,
fastapi-redline, flask-redline and litestar-redline) are documented here. They are
versioned and released in lockstep.
The format follows Keep a Changelog, and the
project adheres to Semantic Versioning. While the
version is below 1.0 the public API may change between minor versions.
0.5.0b2 (2026-11-26)¶
Added¶
redline load initends a TOML scenario with a commented-out example of the optional keys ([auth],[[flows]],extract,expect,max_ms,think_s,own_connection). Uncomment a line to use that key.redline instrumentationlists each loaded raw DB-API driver asdbapi:<driver>and shows whetherinstrument_dbapiwraps it, so raw-cursor SQL that is not recorded shows up as a blind spot. These rows never trigger the auto-instrument warning.instrument_client_method(and its context-manager formclient_span) wraps one method of any client as a client span, recording kind, operation, target, duration, payload size and error. New opt-in integrations built on it: pymongo, Kafka (kafka), pika, Google Cloud Storage and Azure Blob Storage.auto_instrumentcovers them.- An
unattributed_timedetector flags a web request when no span covers at leastunattributed_time_ms(100 ms) and at leastunattributed_time_ratio(half) of its time. On a load run, that uncovered time appears as anotherrow in the bottleneck table. redline_core.contrib.threads.instrument_threads()runsThreadPoolExecutor.submit(somapandrun_in_executor) andThread.startin a copy of the request's context. Their SQL and outbound calls stay under the request, and each span carries the thread name inspan.data["thread"]. Opt-in only;uninstrument_threads()undoes it.- Load runs can span several generator hosts.
redline load agentruns workers for a controller (redline load ... --agents https://gen1:7700,https://gen2:7700); the controller sends each agent its share of one global step plan and a shared start time (clock offsets are measured), merges the agents' per-second histograms exactly like local workers', and reports generator CPU per step, marking a stepgenerator_limitedwhen a worker was above 90% of a core. Agents need a token, support TLS and target allow-lists, and never run a token command. - A flow can model a user:
think_s(a number or[min, max]range) pauses between its steps andown_connectiongives each session its own connection. Each step reports the peak number of sessions in flight, so 20 arrivals per second with 5 s of think time shows about 100. - Load requests are timed to the first byte as well as the last (
ttfb_p50_ms/ttfb_p95_msper step and in the summary).type = "stream"holds a server-sent-events or chunked response open forhold_sand counts events;type = "websocket"(extraredline-core[load-websocket]) connects, sends scripted messages, times the replies and holds the connection. Each step reports how many were open at once. Browser traffic can be grouped per page load with apage=<id>part inX-Redline-Run(GET api/runs/{id}/pages). - The MCP server (
redline mcp) now covers the whole package, so an agent can run a full performance investigation. New tools:list_load_runs,get_load_run,load_run_summary(flows, recovery, drift, identities, limiting resource, resources),load_run_bottlenecks,load_run_metrics;validate_scenarioandgenerate_scenario_from_openapi/_traces/_stages(scenarios are parsed or built, never run);analyze_sql_plan(a pasted SQL Server plan),database_capabilities,lint_sql,scan_sql_source,scan_sql_project,analyze_source,analyze_project,doctor,check_report,check_findings,fix_prompt,diagnose_preview; andlist_traces,list_endpoints,compare_traces,search_sql,index_advice,cache_summary,external_summary,job_summary,history,compare_periods,list_releases. - Tools that change state are opt-in:
start_load_runandstop_load_runneedredline mcp --allow-load --load-target URL(the target is fixed by the operator and one run at a time is allowed),delete_load_runneeds--allow-delete-runs. Without the flags they are neither listed nor callable. - MCP tool arguments are checked against each tool's JSON schema (types, enums, ranges, lengths); results are bounded, and credentials in URLs, token-like values, header, cookie and identity values are masked.
- A load run reports which resource ran out. While a registered run sends it traffic, each app
worker samples its own CPU, memory, GC pauses, threads and connection pool once a second
(
run_metrics, off in theproductionpreset); the run summary carriesresourcesper step and alimiting_resourceverdict ("connection pool exhausted (5/5 checked out), wait time 40x"), printed by the CLI and served byGET api/runs/{id}/metrics.metric_sources(package.module:function) pull in numbers from a database or host monitor per step. - A
stagesload profile (--stages 10:1m,200:30s,10:3m) describes spikes, soaks and any custom shape. A step where the rate falls no longer decides the knee; the run summary reports how long p95 took to return to its pre-spike level (recovery) and checks long steps for slow growth in p95 and error rate (drift,drift_verdictofstableordegrading). - SQL Server plan and index tools check their permissions first. A one-time probe reports
estimated_plan,actual_plan,index_usageandobject_definitionsas granted, missing (with the exactGRANT) or unknown (GET api/database/capabilities,redline doctor); a plan request that hits a missing permission answers403 explain_permissionwith the grant instead of a raw driver error. The newexplain_urlsetting runs plans on a separate login,POST api/explain/plananalyses a pasted XML plan without touching a database, and index suggestions list their evidence and lose a confidence level when catalog visibility is partial. Managed-instance differences are documented. - N+1 findings in raw SQL (
text()or driver SQL) get a real rewrite instead of a hint: a diff at the callsite that replaces the per-row SELECT with oneINquery over all the keys, chunked to the database's parameter limit (stated per vendor) and grouped back by the key, with the join alternative named when the parent query is in the trace. Dynamic statements get the batched statement as a code block. - Load scenarios can run journeys and check responses.
[[flows]]chain requests: a stepextracts a value (a JSON path, a header or a regular expression) and later steps use it as{var:name}; one arrival starts one flow, a failed step ends it and counts once, and the run summary and CLI report each flow and step (traces carryflowandfsteptags).expectrules andmax_mson any request turn a200with an error body, an empty list or a slow success into anassertionfailure instead of a success. GET api/runs/{id}/bottlenecks?identity=NAMEsplits the bottleneck table per load identity.- Load scenarios can vary the offered load.
identities/identities_filegive many users (round_robin,randomorsticky,${VAR}for secrets, only the name is recorded as theidentitytrace tag and in the run summary);[[data]]files fill{data:source.column}in paths, headers and bodies (sequential,randomorzipf);[auth]gets a token from a command, a request or a Python callable and refreshes it before it expires, stopping the run with a clear error when a refresh fails. Every key is optional, so existing scenarios run unchanged, andredline load initwrites them (--data-dir,--identities-file). redline load --store-url postgresql://...writes the run to the shared PostgreSQL store, and the project'sstorage_urlsetting is used when--storeis not given, so a load generator on another host fills the same bottleneck table as the application. The URL's password is never printed.- Requests tagged with a registered, running load run are kept even when
sample_ratewould drop them (sampled_by="run"), so low-rate steps still fill the bottleneck table. A made-up run id keeps nothing. redline loadcan check, before the first step, that the application records the run: one taggedGET(step=probe) and a lookup of its trace, with the likely causes when nothing appears. On by default with--store-url/--register-url(warns), opt-in with--probefor a file store so existing runs send no extra request;--require-recordingstops the run,--no-probeskips it.- Load runs started from the UI work on the shared PostgreSQL store. The background process
gets the URL through the environment, and stopping a run whose process is gone closes it
as
failed. - A generator with no shared store registers its run over HTTP:
redline load --register-url https://app/_redline(token fromREDLINE_TOKENor--token-file). The application accepts it only with the newaccept_remote_runssetting (off by default and in every preset) throughPOST api/runs/register,.../stepsand.../finish; it re-masks the config, validates every field, and only a run registered this way can be changed this way (never a run written by a local process). - SQL sent through a raw driver cursor is recorded.
engine.raw_connection().cursor()on an instrumented SQLAlchemy engine returns a recording proxy, andredline_core.contrib.dbapi.instrument_dbapi(module)does the same for a driver used with no engine (sqlite3,psycopg2,pymysql...). Spans carrysource="raw_cursor"; anexecutemanyis one span with abatch_size. SQLAlchemy's own use ofraw_connectionis not double-counted.
Security¶
Findings of the security review of this release, all fixed in the same branch with regression tests:
- MCP
start_load_runnow accepts only an allow-list of scenario keys. It previously refused only some local-only keys, soauth(a command or Python token provider),identitiesandflowscould reach the detached load process. - A remote agent no longer trusts a worker config beyond what it documents: unknown keys are
refused; data must be inline rows (no file read); identities must be resolved (no
${VAR}environment expansion on the agent); the token endpoint is checked like the target; sizes are bounded. - Agent target checks resolve names and check every address (decimal and hex IPs, trailing
dots, IPv4-mapped IPv6,
fd00:ec2::/32, DNS names pointing at metadata services), and--allow-targetmatches scheme, host and port exactly on a path boundary (nohttp://app.internal.evil.comorhttp://app.internal@evil.com). Agent tokens need 16 characters, connections time out, and a hostile body is a 400, not a crash. - Histogram decoding is bounded (a small zlib bomb sent to
POST api/runs/{id}/stepscould inflate to hundreds of MB and spin for seconds); buckets must be strictly increasing. - An invented
X-Redline-Runid is no longer queued as a provisional trace nor looked up in the store: the recorder asks a cached known-runs set. - Remote registration is bounded: at most 50 running registered runs, step numbers up to 1000, and metrics only for a run that is still running.
- Secrets:
explain_urland other URLs maskodbc_connect,pwd,uidandpasswordquery values; the stored run config masks the token endpoint URL and WebSocket messages; generator errors and the "open the run" line hide URL credentials; the CLI warns about plainhttpto a non-loopback agent or registration URL. - MCP report tools read only files inside the working directory, and scenario validation errors no longer echo the offending value.
GET api/database/capabilitiesfollows theexplainfeature switch, validates the alias and bounds its cache.- A run registered over HTTP is no longer marked failed by the dead-process check on stores that once launched a UI run.
- Check-run cleanup removes the private configuration containing raw request headers before deleting the PID completion marker, so observers cannot see a finished run while its secrets remain on disk.
- A stray
.bakfile was removed from the package source.
0.5.0b1 (2026-11-12)¶
The project moves from alpha to beta.
Added¶
- Every finding explains itself:
GET api/issuesitems carrywhy(rule, observed, threshold, grouping, limits), shown as Why this fired on the Issues page. GET api/issues?sort=impactand a Fix impact (sampled) ordering rank findings by sampled observed time. Impact is labelled sampled and never additive.redline check verify REPORT --kind KINDanswers whether a fix removed a finding (gone,still_present,inconclusive), whether responses stayed equal and whether the request got faster.goneneeds enough after-change samples and complete metrics.redline check compare-live SUITE --old URL --new URLalternates requests between two running versions (order flips each round) to reduce timing drift.- Latency budgets accept
min_samples; with fewer timed calls they fail as "insufficient samples" instead of judging a meaningless p95. redline instrumentation,GET api/instrumentationand a Settings card report what redline cannot see: inactive integrations, truncated traces, traces without a profile and dropped or failed writes.-
scripts/check_metrics_loop.pyrepeats record-then-compare against the FastAPI demo to look for the intermittent "server-side metrics: unavailable" report. -
AI-agent support:
redline mcpserves read-only tools (list_issues,explain_issue,get_trace,instrumentation_report,verify_fix,llm_summary) over MCP on stdio with no new dependency and an optional audit log of tool names and argument keys. redline fix-prompt ISSUE_IDwrites a brief an agent can act on;redline check findings REPORT [--new-only]lists a report's findings with a brief each.redline agent-skill [--format skill|agents] [--write DIR]emits the Claude skill and an AGENTS.md section.docs/llms.txt,docs/llms-full.txt,docs/reference/settings.schema.jsonanddocs/reference/cli.jsonare generated byscripts/build_llms.py; CI fails when stale.- LLM-call observability:
instrument_anthropic()andinstrument_openai()recordllm_callspans (provider, model, token counts, status, a prompt hash and size; never prompt or completion text). New findingsduplicate_llm_call,serial_llm_calls,llm_in_transaction,llm_call_loopanduncached_large_prompt, settingsllm_duplicate_threshold,llm_serial_min,llm_loop_calls,llm_prompt_cache_chars, andGET api/llmfor sampled token usage per route and model. No price table is shipped. - Opt-in AI diagnosis:
redline diagnose ISSUE_IDpreviews the exact request and sends nothing.--sendneeds--send,ai_diagnosis = trueandREDLINE_AI_API_KEYtogether (settingsai_diagnosis,ai_provider,ai_model). - The FastAPI demo gains
GET /assistant(LLM-call findings without a key or network), a.mcp.jsonand anAGENTS.md. instrument_client_methodandclient_span(redline_core,redline_core.extending) record a call to any client library as a span with client, operation, target, duration, payload size and error class, so a database, queue or storage client without an integration is no longer invisible. See "Instrumenting a client" indocs/extending.md.- First-party, opt-in integrations built on it:
instrument_pymongo(),instrument_kafka()(kafka-pythonKafkaProducer.send),instrument_pika()(basic_publish),instrument_google_cloud_storage()andinstrument_azure_blob(). Each imports its library lazily, returnsFalsewhen it is missing, never records payloads, object names or error messages, and is covered byauto_instrumentandredline instrumentation. - New finding
unattributed_time: a Django, FastAPI, Flask or Litestar request with at leastunattributed_time_ratio(default 0.5) of its time, and at leastunattributed_time_ms(default 100), covered by no span. It names the profiler's project frame when the trace has a profile. Wrapper spans (view,middleware,transaction) do not count as coverage; jobs and traces with dropped spans are skipped. - Load runs:
api/runs/{id}/bottlenecksgains an item of kindother(keyother:uncovered) with the per-request time no span covers, per step. Existingsqlandrouteitems are unchanged. instrument_threads()(opt-in, reversible withuninstrument_threads(), idempotent) copies the request context intoThreadPoolExecutor.submitandThread.startwork. SQL and other spans recorded on worker threads stay under the request and carry the thread name inspan.data["thread"]; spans from concurrent threads are recorded safely. Work that outlives the request is not recorded. Listed asthreadsinredline instrumentation, never enabled byauto_instrument.
Changed¶
- Development status classifiers are now
4 - Beta.
Security¶
- Finding explanations echo only finite numbers from detector evidence, never free text, so a hostile string in evidence cannot reach the Issues page through Why this fired.
- Agent surfaces are read-only by construction. Prompt text never reaches spans, issues, the API, fix briefs, MCP output or the diagnosis preview (an end-to-end test with a secret prompt covers each). The MCP server answers oversized, malformed and unknown requests with errors and keeps serving; its audit log stores no argument values and is created with mode 0600.
- AI diagnosis sends only an allowlisted, redacted set of finding fields to a fixed provider host, reads the key from the environment only (never a setting, never printed), and reports HTTP status without the response body or key.
- Regression tests cover credential gating of
api/instrumentationandapi/issues, no redirect following incheck compare-live, and rejection of non-report files bycheck verify.
0.5.0a2¶
Added¶
redline doctor --production --strict --jsonchecks a recording-only deployment policy without changing configuration. Warnings fail strict checks; JSON remains machine-readable when configuration cannot load.- Authenticated
GET api/healthexposes process-local recorder/storage health without querying the trace database. Meta/Recording health also show queue pressure, capture failures, write/flush/shutdown failures and reason-specific dropped-item counters.
Fixed¶
- Serialize save admission with shutdown so accepted traces cannot land behind a stop marker. Bounded close returns a completion result and reports discarded queued work.
- A timed-out shutdown leaves an active writer's connection alone; the writer closes it after draining/stopping. Flush no longer reports success for abandoned queued work.
- Writer startup can retry after thread-start failure. Writer/logging failures preserve later recording attempts, and counters are protected and reset for a forked process.
- Internal API exception messages are withheld when error-detail capture is disabled.
Added (production readiness)¶
- Shared PostgreSQL trace store (
PostgresStore): setstorage_url/REDLINE_STORAGE_URLto apostgresql://URL (installredline-core[postgres]) so several workers and hosts write one store, with the same pages, aggregates, retention and background writer as SQLite; schema-versioned, serialized across processes, fork-safe. redline doctor --strictand--workers N: doctor warns (fails with--strict) when several worker processes share one SQLite file (detected fromWEB_CONCURRENCY,GUNICORN_CMD_ARGSorUVICORN_WORKERS), and checks the driver and connection of astorage_urlstore.engines="auto"for FlaskRedline, FastAPIinstalland LitestarRedlinePlugincaptures SQLAlchemy engines created at runtime (per user or per request, e.g. token-authenticated SQL Server connections); EXPLAIN works on auto-found sync engines.- Stored procedures are a query kind:
EXEC/EXECUTE,CALLand ODBC{CALL ...}spans carryquery_kind: "procedure"and the procedure name, and fingerprint per procedure. ignore_sqlsetting (regular expressions); the default skipssp_set_session_contextandSET ...session housekeeping.- Flask requests carry a
blueprinttrace tag;GET api/endpoints?group_by=blueprint(ortag:<key>) andflask redline endpoints --group-by blueprintaggregate per blueprint. - Composite GitHub Action (
uses: Pythondeveloper6/redline@<ref>) andredline check comment: job summary plus one sticky pull-request comment. install_if_devin every adapter (andredline_core.environment): refuses to attach when the environment looks like production;REDLINE_ALLOW_PRODUCTION=1overrides.redline init: detects the framework, writes a starterredline.toml(or--pyproject) and adds the store directory to.gitignore.redline check ratchetand pytest--redline-ratchet/--redline-ratchet-update: per-endpoint query-count and latency baselines that only tighten.redline_core.correlation: aredline_trace_idlogging filter and a Sentrybefore_sendhook with an "Open in Redline" link; OTLP spans carryredline.trace_id.redline export ID --html OUT: one self-contained, redacted HTML summary of a recording or load run.redline digest: posts newly seen issues to a Slack-compatible webhook, deduplicated through a state file.GET api/metrics(Prometheus text format) for recorder health;SQLiteStore.health()counts drops by reason and write failures.auto_instrumentsetting (off/warn/on, defaultwarn): warn once about, or instrument, installed httpx/requests/Redis/boto3.- RQ (
redline_core.contrib.rq) and Dramatiq (redline_core.contrib.dramatiq) job recording with trace-context propagation (rqanddramatiqextras); FastAPI/StarletteBackgroundTasks are recorded as jobs linked to the request trace. check-sqlresolves more dynamic SQL (%,.format,joinof literals,+=, straight-line local reassignments) and reportsunresolved_by_reasonand a per-itemcategory.scripts/measure_static_precision.pyand a labelled corpus measure static-analysis precision, recall and false-positive rate, also on your own reviewed findings.- Live MySQL qualification (EXPLAIN, index advice, killed connections, pre-ping) with
pymysql, aiomysql and asyncmy, a
mysqlCI job, and a SQL Server per-request engine test in the Compose suite. - Compatibility workflow: fresh-venv installs from PyPI and from built wheels
(
scripts/check_clean_install.py), and stores written by every published release opened by the current code (scripts/check_store_upgrade.py). scripts/run_tests.pyruns every package suite from the repository root;benchmarks/real_app.pymeasures p50/p95 overhead on a running application over HTTP.- Documentation pages: API stability and deprecation policy (
docs/api-stability.md), threat model (docs/threat-model.md) and operating Redline (docs/operating.md).
Changed (production readiness)¶
- Installing an adapter with httpx, requests, Redis or boto3 present but uninstrumented now
logs one warning (
auto_instrument = "off"silences it). - A stored-procedure call's fingerprint no longer includes its arguments
(
EXEC dbo.usp_x); N+1 detection groups procedure calls and duplicate procedure calls are reported asinfo. - A SQLite store on a network filesystem fails
redline doctor --strict(still a warning by default), and the message recommends the shared PostgreSQL store. - Adapters build their default store with
redline_core.storage.store_from_settings;SQLiteStore.from_settingsreturns the PostgreSQL store whenstorage_urlis set. REDLINE_ENVandREDLINE_ALLOW_PRODUCTIONare no longer reported as unknown settings.- Public API is defined in
docs/api-stability.md; the internal design contract and planning files left the public tree.
Security¶
access="framework"with no dependencies or guards attached now refuses every request in the FastAPI and Litestar adapters, as Flask and Django already did (it previously allowed everyone).- Free-text redaction (bodies, logs, error messages, locals) runs in linear time; crafted input could previously cost seconds of CPU per request. Error, header and identifier texts are cut before they are scanned.
- Redaction also masks a bare token used as a URL user name; the default secret key names now include access keys, signatures and credentials.
- The EXPLAIN safety check reads MySQL
#comments, so a quote inside one can no longer hide a second statement or a locking clause. redline check commentsends the GitHub token only over https (plain http only to loopback), never follows redirects, caps API answers and validates the repository name.- OpenAPI downloads for
redline load initare size-capped and follow redirects only to http(s). - The OTLP export redacts issue titles and the raw SQL included with
--include-sql. - The login rate limit counts IPv6 clients per /64 and keeps blocked clients when its table is full; Basic authentication takes the same time for unknown and known user names.
- Internal-error API answers redact the exception text.
- Store side files, run files and
redline export --htmlpages are created0600and are never written through a symlink. - A PostgreSQL store URL is masked correctly when the password contains
/,?or#. - CI and the GitHub Action: third-party actions pinned to full commit SHAs, checkouts do not
persist credentials, Pages/OIDC permissions limited to the deploy job, matrix values
passed through the environment, and the action's
extra-argsis never glob-expanded. - A curated set of flake8-bandit rules is enforced by ruff.
Fixed (production readiness)¶
- Tests no longer use the deprecated
starlette.middleware.wsgi(nowa2wsgi).
0.5.0a1 development baseline¶
Added¶
- Bounded project import summaries detect repeated query helpers across scanned Python modules, including explicit aliases, relative imports and stable package re-exports.
- SQLAlchemy session inference covers Optional/Annotated/string annotations and known sessionmaker/async_sessionmaker factories and context-manager bindings.
- Offline SQL checks recover stable text-clause constants, safe literal-return SQL template helpers and imported literal constants, without importing application code. ORM expressions remain explicitly unvalidated and require capture/compilation.
- Optional boto3 SDK operation spans capture service, operation, status and duration without storing SDK arguments, response bodies, bucket names or object keys.
fastapi_redline.add_background_taskrecords sync/async in-process tasks as distinct jobs with parent correlation. Argument/result capture and exception details are suppressed for these jobs; original task exceptions and execution scheduling are preserved.- Recording health reports installed/loaded/instrumented optional integrations and explains that hook status is not evidence of observed activity.
Fixed¶
- Split UI pages into lazy chunks while keeping navigation and palette destinations available.
- Disable URL-based module preloads so embedded offline snapshots can load lazy chunks from their data-URL import map; verified against a real Safari-rendered export.
0.4.0a2 development baseline¶
Fixed¶
- Source analysis respects loop evaluation order: a query producing the outer iterable no longer becomes a query-per-row warning. Queries in bodies and nested iterables remain candidates.
- SQLAlchemy
Session.getandscalarare recognized without flagging ordinary dictionary lookups. - Query-loop guidance includes SQLAlchemy batching and loader options and warns about identity-map hits, conditional queries and intentional batching.
- Event-loop samples without a project frame no longer name an outer runner as the culprit. Sampled SQLAlchemy work no longer implies a synchronous driver; confirmed driver spans keep their specific advice.
Added¶
- Same-module query helper summaries, following up to eight helper edges, expose repeated calls hidden behind local helpers. These remain syntax candidates requiring runtime review.
- Explicit
--max-filesand--max-project-bytesbudgets foranalyzeandcheck-sql, capped at 10,000 files and 64 MB. UI/default budgets stay at 200 files and 2 MB.
0.4.0a1 development baseline¶
Added¶
- SQL failure recordings and issue groups, raw rowcounts, comment-placeholder findings,
connection lifecycle evidence and observed session-state checks for SQL Server isolation,
IDENTITY_INSERT, value switches, session context and PostgreSQL/MySQL session state. A SQL retry-storm finding groups repeated attempts after a transient failure, and lifecycle gauges persist in hourly history even when sampling drops the trace. - SQL Server identity, estimated/opt-in actual XML plan collection, logical-read summaries and bounded catalog inspection. Live driver validation remains required.
- Offline
redline check-sql, explicit online compilation and schema snapshots, bounded store auditing, import checks and explicit sanitized OTLP export of SQL spans and issue log records. SQL Server online checks use server-described parameter types and result columns under NOEXEC, and flag literal row reads the described SELECT no longer returns. Snapshots include SQL Server triggers and routine parameters, and schema drift recompiles only statements that reference affected tables.redline schema-watchpolls the comparison, writes a baseline on its first run and can persist aschema_driftissue without running migrations. Unused-index analysis covers SQL Server's usage DMV, and repeated rawtext()SQL gets a batching hint when no ORM relationship matches. redline doctornow runs a real WAL self-test beside the store and warns on Linux network/virtual mounts; two independent OS processes are tested writing one SQLite file. The SQLAlchemy query path avoids repeated bounding/classification work on ordinary rows.- The overhead benchmark has an
mssqlcell driven through a fake pyodbc-shaped DBAPI. redline check-importsfollows statically visible imports inside task functions after loading each task module, andredline check compare/run --ruffincludes Ruff JSON in Markdown and JUnit without becoming a linter.- Generic jobs/stages/row outcomes, optional Celery signals, retry outcomes and commit-before-
failure evidence; Jobs, SQL checker and redaction-preview UI surfaces. Jobs record the
first failing stage and
GET api/jobs/summaryaggregates outcome, latency and stage counts for retained task recordings. - Shared-dev defaults, SQL value capture policies, privacy profiles and route rules, log filters, user/request correlation, read-only secondary trace browsing and nested Flask/FastAPI recording.
- pytest SQL-error/session-state assertions and
--redline-all.
Changed¶
- Failed SQL attempts remain visible even when application code catches the exception.
- SQL observers preserve application results and original errors when capture fails; recorder ownership isolates engines shared by several applications.
- Bounded SQL/parameters, span data, tags and complete trace payloads; production capture uses smaller budgets, value-free diagnostics and safe metadata on privacy failure.
- Duplicate trace IDs across secondary stores are marked and cannot select unrelated evidence.
- Routine CI and docs deploy only after pushes/merges to main; no PR-triggered runs.
- All five distributions move together to 0.4.0a1. See Real-world workflows for support boundaries and the local validation report before publishing.
0.3.0a1¶
The refactor check: prove a refactor is safe and measure what it gained. A 0.2 store is migrated in place to schema version 4 when 0.3 first opens it.
Added¶
- Performance workflow UI: endpoint budgets, keyed JSON arrays, numeric tolerances, environment labels and observed target runtime warnings, suite coverage, source analysis, recording health, scoped suppressions and issue-to-check verification.
- Deterministic findings for repeated writes/aggregate scans, deep OFFSET pagination, cumulative round trips, pool waits, response/cache size, ORM instance construction and explicitly measured cache decoding; sampled JSON decode hotspots and on-demand catalog checks for wide columns, covering indexes and matching generated JSON expressions.
redline analyzeand a pytest plugin, with query/outbound-call/issue assertions, explicit no-query blocks and UI-inspectable test traces. See Performance workflows in the docs.-
Real
/patternsdemo endpoints and clearly marked synthetic detector examples for UI exploration; synthetic timings are not treated as measured application traffic. -
Refactor check (
redline_core.check). A suite of read-only requests (TOML or JSON, or built in the UI) is replayed against the old code to make a baseline and against the new code to make a comparison. Per endpoint: a response verdict (same,changed,broken, with a JSON path or unified text diff that skips fields that change on every call) and a performance verdict (faster,slower,same,noisy; Mann-Whitney U test at p < 0.01 plus percentage and millisecond thresholds, interleaved requests, warmup, and a query-count rule). Server-side query counts, SQL and new or fixed issues come from the app's own traces. See Refactor check. - CLI:
redline check record,compare,run,init --from-tracesandshow;--json,--markdownand--junitoutputs;--fail-on(slower,changed,broken,noisy,faster,none); exit codes0,1,2,3(app unreachable) and130. - HTTP API:
api/checks/suites(list, create, get, update, delete, TOML export, draft from seen traffic),api/checks/runs(start, list, get, stop, delete) andapi/checks/baselines/import. New error codesinvalid_suite,invalid_baseline,checks_from_ui_disabled,suite_not_found,check_run_not_found,payload_too_large;run_activealso covers check runs. - UI: Checks pages (suites, builder, suite, report with latency, response diff, new and fixed SQL and issues, live progress, copy as Markdown).
- Settings:
checks_from_ui("auto"by default: debug mode only) and thechecksfeature switch. - Storage: schema version 4 with
check_suites,check_runsandcheck_results; the 50 newest runs per suite are kept. - The
X-Redline-Checkrequest header tags traces withcheck_run_id,check_reqandcheck_n.
Changed¶
- Refactor check: a request whose response is
brokenis no longer judged for perf (verdictn/a, reasonbroken, "perf not judged: response broken"); its fixed issues, gone SQL and query decrease are not reported as wins and it is left out of the overall speed and the query totals. - Refactor check: requests that the baseline does not have get the response verdict
missing, which fails by default (--fail-onnow defaults toslower,changed,broken,missing) and adds a warning andsummary.missingto the report. A baseline that has none of the suite's requests is an error (exit 2; in the UI the run fails with the same message). redline check initwritesbase_urlonly when--base-urlis given or the traces show a single host; otherwise a commented# base_url = ...line.- UI: a stopped run shows its partial results labelled "partial: stopped after N of M calls", or "No results were kept", never both. The suite page can import a baseline file (up to 10 MiB), which then appears in the baseline picker.
- The
productionpreset setschecks_from_ui = false. - The Django, FastAPI, Flask and Litestar adapters pass
PUTbodies to the API and accept request bodies up to 11 MiB onapi/routes (Django reads pastDATA_UPLOAD_MAX_MEMORY_SIZEafter the access check; Litestar 2.13 or later getsrequest_max_body_size), so a large baseline can be imported. - Tagged check traffic is kept when sampling would have dropped it, but only for a check run that is known to the store.
Security¶
- Starting a check from the UI is opt-in (
checks_from_ui), refused inread_onlymode and when thechecksfeature is off. Suites accept onlyGET,HEADandOPTIONS, and paths only (no absolute URLs); UI runs are capped at 200 requests, 5 000 calls and 15 minutes. ${env:NAME}placeholders in suite headers are never expanded in anything stored or exported; secret header values are masked in stored suites and API responses; baselines are redacted on write and on import.- The
X-Redline-Checktag cannot force storage: it is honoured only for a run that exists in the store and is running (or ended less than a minute ago); otherwise itscheck_*tags are stripped, and a request that sampling kept only because of the tag is dropped.
0.2.0a1 (2026-10-27)¶
Frameworks, analysis, load testing and history. Everything in 0.1 keeps working: a 0.1 store is migrated in place when 0.2 first opens it, and every new field has a default.
Added: frameworks¶
flask-redline:Redline(app, engine=...)andinit_app, Flask-SQLAlchemy engines (binds included) found automatically,flask redline clear|prune|scan|scenario.litestar-redline:RedlinePlugin(settings, engine, path, guards, store), picks upadvanced-alchemyengines.- Django Ninja routes resolved to the real operation (view name and route template).
- All adapters:
Server-Timingheader, floating badge, Server-Sent Eventsapi/stream, snapshot download,X-Frame-Options: DENYon Redline's own responses.
Added: analysis¶
- New detectors:
blocking_in_async,large_result,unbounded_query,inefficient_count,slow_serializer,long_transaction,external_in_transaction,slow_external,duplicate_external,retry_storm. - New span kinds:
serializer,resolver,transaction,blocking,pool_wait; SQL spans gainrows,has_limit,in_transaction. - An event-loop lag monitor and watchdog that name the blocking call, active only while a request is in flight.
- Log capture per request (
capture_logs,log_level,max_logs_per_trace) and exception frames with redacted locals (capture_locals). - GraphQL: Strawberry and Graphene resolver spans, with N+1 reported against the resolver path.
redline_core.contrib: SQLAlchemy (moved fromfastapi-redline, which re-exports it), httpx, requests, redis-py, asyncpg, psycopg 3 and Marshmallow integrations.- Database page: SQL search by fingerprint, a workload index advisor and unused-index
detection (
GET api/sql,GET api/indexes). - Cache page (hit rate, unread writes, stampedes) and External calls page (latency,
duplicates, retries) (
GET api/cache,GET api/external). - Static N+1 scan of templates and DRF serializers (
manage.py redline_scan,flask redline scan).
Added: load testing¶
redline load: an open-model, coordinated-omission-corrected load generator running in separate processes; constant, ramp and step profiles; Poisson arrivals;stop_on; knee detection;--fail-p95-msand--fail-error-ratefor CI.redline load init --from-openapi | --from-tracesto generate scenarios; Django and Flask scenario generators.- Runs are stored with per-step histograms and shown on the Load page with a per-step
bottleneck analysis (
GET api/runs,GET api/runs/{id}/bottlenecks). - Optional start-from-the-UI (
load_from_ui, off by default). It sends only paths, to thebase_urlsetting or a loopback /allowed_hostsaddress; capped at one hour, 5 000 rps and 200 steps; run statusesrunning,done,stopped,failed; stopping a run from any worker. redline load --ui-urlsets the Redline UI address printed after a run (default frommount_path, else/_redline).- The knee rule: the first complete step with p95 above 2x the first step's, an error rate above 1%, or an achieved rate below 90% of the target; partial steps never decide it.
Added: history¶
- Hourly rollups with mergeable latency histograms, releases, an issue index that survives
trace pruning, kept
history_retention_days(default 90). - Release stamping (
releasesetting;REDLINE_RELEASE, common CI variables, or git). - History page and
GET api/history,api/releases,api/history/comparewith regressed / improved / new / gone verdicts and new / resolved / persisting issues.
Added: UI¶
- Command palette (
Ctrl-K), keyboard shortcuts, Live mode, open-in-editor links (editorsetting), copy as cURL / HTTPie, replay, compare two requests, Logs and Exception tabs, offline snapshots.
Added: configuration and access control¶
- Presets
dev,stagingandproduction;redline.toml/[tool.redline];REDLINE_*environment variables; layered precedence. - One access policy for all adapters:
local,token,basic,framework,custom,open(needsREDLINE_ALLOW_OPEN=1);allowed_ips,allowed_hosts,trusted_proxies,read_only, per-feature switches,ui_enabled,mount_path, login with a scoped cookie and a rate limit. - Layers: defaults, adapter, preset, file, environment, framework. A native hook (Django
staff check or
PERMISSION, FastAPIdependencies=, Flaskpermission=, Litestarguards=) impliesaccess = "framework".REDLINE_*values are parsed by type (bools, JSON or comma lists,k=vtables,none); an unknown variable or file key is an error with a "did you mean" hint. - Settings:
preset,access,access_check,allowed_ips(widenslocal, restricts the other policies),allowed_hosts,trusted_proxies,token,token_file,basic_users,secret_key,read_only,features,ui_enabled,mount_path,session_ttl_s,max_login_attempts,base_url,trust_unix_socket,cookie_secure. redline config,redline doctor,redline hash-password;GET api/config,POST api/loginandPOST api/logout(both answer200JSON),X-Redline-UI: 1; a login screen and a Settings page. Undertokenandbasicthe UI shell is public and everyapi/call needs credentials. Sessions needsecret_keywith several workers.- Live mode resumes by
seq(after=orLast-Event-ID); the stream closes after five minutes on ASGI and about 25 seconds on WSGI servers and the UI reconnects. GET api/indexesreturns candidates withkind,confidence,verified, plusalready_indexed,explained,unused_errorandcached; cached for 30 seconds,refresh=1recomputes; unused indexes are PostgreSQL only.
Changed¶
- Behaviour changes to know about when upgrading from 0.1:
- FastAPI, Flask and Litestar: when
accessis not set anywhere (code,redline.toml,REDLINE_ACCESS) and the app is not in debug mode (app.debug), every Redline URL answers404and an error is logged at startup. A same-host reverse proxy that adds noX-Forwarded-For(proxy_pass http://127.0.0.1:8000;) used to make every visitor "local". Setaccessexplicitly:"token"/"basic"on a server, or"local"to accept that risk on a development machine. In debug mode thelocaldefault still applies. - Under
local, a unix-socket peer (no client address) is no longer local unlesstrust_unix_socket = true. - FastAPI
install(dependencies=[])and LitestarRedlinePlugin(guards=[])are the same as not passing them (the normal default rules), no longeraccess = "framework"with nothing to check. A FastAPI dependency that returnsFalsenow refuses with403(raisingHTTPExceptionremains the normal way). - Django: the default
PERMISSIONis active superusers (was: active staff). Use"PERMISSION": "django_redline.conf.staff_permission"for the old rule. X-Redline-Profile: 1/?_redline=profileare honoured only in debug mode or when the request carries valid Redline credentials (login cookie,Authorizationheader, or a client thelocalpolicy lets in);frameworkhooks cannot run there, so with that policy only debug mode forces profiling. Theproductionpreset setsprofile = "off".X-Redline-Runtags a trace only when the run exists in the store and is running (or ended less than a minute ago); a run started withredline load --no-store(or into another store) no longer tags the app's traces.- UI-started load runs target the server's own listening port (ASGI
scope["server"], WSGISERVER_PORT) on127.0.0.1, never theHostheader; without a known port (a unix socket) thebase_urlsetting is required. - Replay sends no cookies unless "Send my cookies" is ticked.
server_timingnow defaults to"auto"(on in debug mode only). It used to be on whenever recording was; setserver_timing = Trueto keep the old behaviour.Sec-Fetch-Site: same-siteis refused on non-GET requests, likecross-site.- Under
local, a loopback peer that sendsX-Forwarded-For,X-Real-IPorForwardedwithout being intrusted_proxiesis refused (403 forbidden), so a reverse proxy on the same host no longer makes every visitor local. POST api/runsneeds thebase_urlsetting unless the server's listening port is known (400 invalid_bodyotherwise).- FastAPI's
install(prefix=), Flask'surl_prefixand Litestar'spathdefault toNone(thenmount_path, then/_redline). - Under
tokenandbasicthe API needs credentials on everyapi/call. GET api/streamevents carry anid(the trace'sseq) and the server closes the stream periodically.- Log capture uses a log-record factory and follows your loggers' levels; Redline never
adds a root handler or changes a level, and
log_levelis an extra minimum. - Replay refuses paths that point at another origin.
- Storage schema version 3 (migrated in place from 0.1 or 2):
saved_seqgives the live stream an insertion order; writes useBEGIN IMMEDIATE; requests that matched no route are filed as(unmatched)in the history. - The default
redact_keyspattern matchesauth/authorizationonly as whole words and also coversprivate_key. - Documentation is published to GitHub Pages.
- The
redlineconsole script is installed withredline-core.
Security¶
- New error codes for access and safety:
login_required,invalid_credentials,read_only,load_disabled,feature_disabled,open_refused,too_many_requests. - Starting a load run from the UI accepts only paths, never a host, and a forged
Hostheader can no longer aim it at another machine; UI-started runs are capped. - Access control: constant-time token and PBKDF2 password checks, signed
HttpOnly,SameSite=Strictsession cookies, a per-IP rate limit on failed credentials, andX-Forwarded-*believed only fromtrusted_proxies. - CSRF is enforced by one shared gate on every non-GET call, login and logout included.
- Redaction: passwords in URL userinfo (
user:password@host) and secret query values are masked in outbound URLs, log messages and exception locals; locals are masked in containers to a depth of four and through the free-text rule; secrets in a stored load run's config are masked. Server-Timingis off outside debug mode by default, since it is a side channel.- An unset
accessno longer exposes Redline behind a same-host reverse proxy: outside debug mode the UI and API answer404untilaccessis set (FastAPI, Flask, Litestar); unix-socket peers are not local unlesstrust_unix_socket.redline doctorwarns. - Empty
dependencies=[]/guards=[]no longer turn the gate into an uncheckedframeworkpolicy; a FastAPI dependency returningFalserefuses. - Anonymous clients can no longer force profiling and storage with
X-Redline-Profile/?_redline=profile, nor attach traffic to a load run with a made-upX-Redline-Run. - A load run started from the UI can no longer be aimed at another loopback service
through the
Hostheader. - Replay no longer sends the viewer's cookies by default (a recorded request replayed with the viewer's session would be a stored CSRF).
- The store directory Redline creates is
0700with a.gitignoreof*; the database, its-wal/-shmfiles and load-run files are0600(POSIX). cookie_secure("auto",true,false):"auto"setsSecurefor https, includingX-Forwarded-Proto: httpsfrom atrusted_proxiespeer. Logging out revokes that session cookie in the process that answered (in memory until it expires).redline doctorwarns whentrusted_proxiesis empty withtoken/basic(one shared login rate-limit bucket behind a proxy).GET api/configmasks userinfo inbase_url.- Session ids and API tokens are no longer stored: cache keys after a session prefix
(
django.contrib.sessions.cache…,session:) or a secret-looking name are masked, and SQL parameters are masked when their table looks secret (DRFauthtoken_token,django_session), inside function calls (crypt(%s, …)), inINSERT … VALUES,ON CONFLICT … SETand every item of anIN (…)list. - Exception messages, tracebacks (chained ones included) and frame source lines go through
the free-text redaction rule, which now also masks JWTs, Luhn-valid card numbers and
<key>value</key>elements. - Request capture: headers whose name looks secret (
X-Auth-Token,X-CSRFToken, …) are masked; multipart bodies are parsed (secret fields masked, files reduced to[file: name, N bytes]); text, GraphQL and XML bodies use the free-text rule. - Secret route parameters (
token,uidb64,key,signature,code, or aredact_keysmatch) are masked in the stored path, e.g. Django's/reset/[redacted]/[redacted]/; high-entropy segments of unmatched paths are masked too.
0.1.0a1¶
Initial alpha: request profiling, N+1 detection with fix suggestions, EXPLAIN analysis, flamegraphs, web UI for Django and FastAPI.
Security¶
- FastAPI: the default
local_onlyguard now also requires a loopbackHostheader (localhost,*.localhost,127.x.x.x,[::1]), closing a DNS-rebinding read of theGETendpoints.loopback_guard(allowed_hosts=[...])allows other names. - Django: Redline's views call
request.get_host(), soALLOWED_HOSTSis enforced on them withoutCommonMiddleware. - EXPLAIN:
is_explainablenow refuses every row-locking clause (FOR SHARE,FOR NO KEY UPDATE,FOR KEY SHARE,LOCK IN SHARE MODE), matches keywords case-insensitively, and re-reads the raw SQL pessimistically so quoting tricks (backslash strings,$$, MySQL/*! */and--) cannot hide a second statement. - Both adapters send
X-Frame-Options: DENYon the UI; the SPA only linkshttp(s)suggestion URLs and URL-encodes trace ids.
Changed¶
- FastAPI access/CSRF refusals and
HTTPExceptions from auth dependencies now use the{"error": {"code", "message"}}shape (unauthorized,forbidden,csrf_failed). max_rows = 0now disables the row cap (it used to delete everything);0orNonedisable any ofmax_rows,max_age_daysand the newmax_spans_per_trace.?_redline=acceptsprofile,1,true,yesandonon both adapters (parsed inredline_core.sampling.profile_requested).- A 4xx is never an error: Django's
Http404/PermissionDeniedare no longer recorded as the trace'serrornor kept byalways_keep_errors. - FastAPI with
enabled=Falseinstalls no middleware and no SQLAlchemy listeners.
Added¶
max_spans_per_trace(default 2000): spans beyond it are counted, not stored; counts and N+1/slow-query issues stay exact; the trace is markedtruncatedand the UI says so.- Django
REDLINE["STORE"], the counterpart of FastAPI'sinstall(store=...). STORAGE_PATH/PROJECT_ROOTaccept anyos.PathLike.SQLiteStoreis fork-safe (gunicorn--preload): its writer starts lazily per process.- Measured overhead, storage size and writer throughput (
benchmarks/).