PrefectHQ
prefect
BlogDocsChangelog

Add logfire sampling configuration and fix boolean env var handling

#19372
Comparing
nate/logfire-sampling-and-bool-fix
(
a284483
) with
main
(
abcb29c
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
456.9 µs456.6 µs
bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.3 s1.3 s

Ignored

bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
164.8 ms165 ms
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+3%
167.4 ms162.8 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1 s1 s
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-7%
5.9 ms6.4 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+21%
5.2 ms4.3 ms
bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+1%
108.1 ms107.3 ms

Commits

Click on a commit to change the comparison range
Base
main
abcb29c
+0.04%
Add logfire sampling config, fix boolean env var handling, and exclude /admin/settings from OpenAPI schema **Logfire sampling configuration:** introduces configurable logfire sampling via environment variables to reduce span budget consumption for deployments with high traffic. environment variables (all optional with sane defaults): - PREFECT_LOGFIRE_SAMPLING_HEAD_RATE: 0.1 (10% of traces) - PREFECT_LOGFIRE_SAMPLING_LEVEL_THRESHOLD: "warn" - PREFECT_LOGFIRE_SAMPLING_DURATION_THRESHOLD: 5.0 seconds - PREFECT_LOGFIRE_SAMPLING_BACKGROUND_RATE: 0.01 (1% tail sampling) centralizes logfire configuration in prefect._internal.observability module to avoid duplication and ensure consistent behavior. fixes #19360 where PREFECT_LOGFIRE_ENABLED=0 doesn't properly disable logfire. the fix uses Pydantic's TypeAdapter for proper boolean parsing that handles "0", "false", "False", etc. supersedes #19362 **OpenAPI schema fix:** excludes /admin/settings endpoint from OpenAPI schema to prevent Settings type pollution. the endpoint returns the full prefect.settings.Settings object, which was causing FastAPI to include the entire Settings model tree (APISettings, CLISettings, etc.) in the generated schema. this was causing the pre-commit hook to regenerate ui-v2/src/api/prefect.ts with 2000+ lines of spurious Settings type definitions every time someone modified a file matching src/prefect/server/api/.*, polluting PRs with unrelated changes. the UI doesn't need these types since it just displays settings as raw JSON. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
a284483
12 hours ago
by zzstoatzz
© 2025 CodSpeed Technology
Home Terms Privacy Docs