Make configurable via environment variable & fix typos in profiler trace filenames
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
Research direction
Start with the profiling settings in inference/core/env.py, then trace their defaults through inference/core/interfaces/stream/inference_pipeline.py and inference_sdk/http/entities.py. Review the profiler filename construction in inference/core/interfaces/stream/utils.py and inference_sdk/http/utils/profilling.py; done means the directory can be selected through WORKFLOWS_PROFILING_DIRECTORY and the listed profiler typos are corrected.
Written by the indexing model from the issue text.
Description
Make profiling_directory configurable via environment variable & fix typos in profiler trace filenames
Search Before Asking
- I searched the Issues and did not find a duplicate.
- Related: #1110 (read-only filesystem profiling crash, fixed by PR #2732)
Feature Description
Following the merge of PR #2732 (which addressed the read-only filesystem crash from #1110), the profiling subsystem now gracefully handles OSError when writing traces. However, the output directory itself is still hardcoded as "./inference_profiling" in two separate locations with no environment variable override — making it the only pipeline/profiling setting that can't be configured at deploy time.
Current state
In inference/core/env.py (lines 1036–1037), the profiling feature already has two env vars:
ENABLE_WORKFLOWS_PROFILING = str2bool(os.getenv("ENABLE_WORKFLOWS_PROFILING", "False"))
WORKFLOWS_PROFILER_BUFFER_SIZE = int(os.getenv("WORKFLOWS_PROFILER_BUFFER_SIZE", "64"))
And the sibling pipeline configs all follow the env-var pattern:
| Setting | Env Var | Default |
|---|---|---|
| Predictions queue size | INFERENCE_PIPELINE_PREDICTIONS_QUEUE_SIZE |
512 |
| Restart attempt delay | INFERENCE_PIPELINE_RESTART_ATTEMPT_DELAY |
1 |
| Video source buffer size | VIDEO_SOURCE_BUFFER_SIZE |
64 |
| Profiling enabled | ENABLE_WORKFLOWS_PROFILING |
False |
| Profiler buffer size | WORKFLOWS_PROFILER_BUFFER_SIZE |
64 |
| Profiling directory | ❌ none | hardcoded "./inference_profiling" |
The hardcoded default appears in:
inference/core/interfaces/stream/inference_pipeline.pyline 503 —init()method parameter defaultinference_sdk/http/entities.pyline 150 —InferenceConfigurationdataclass field default
Proposed change
Add a new environment variable WORKFLOWS_PROFILING_DIRECTORY to inference/core/env.py:
WORKFLOWS_PROFILING_DIRECTORY = os.getenv("WORKFLOWS_PROFILING_DIRECTORY", "./inference_profiling")
Then import and use it as the default in both locations above instead of the hardcoded string.
Why this matters
-
Containerised deployments (Docker, K8s): The working directory inside a container is often read-only or ephemeral. While PR #2732 made the crash non-fatal, users still can't direct profiling output to a writable mounted volume without modifying the source code or passing the directory through the Python API every time.
-
Consistency: Every other profiling/pipeline knob has an env var. The directory is the sole exception — an easy oversight to fix.
-
SDK usage:
InferenceConfigurationin the SDK also hardcodes the same path. An env var gives a single, code-free control point for both the HTTP server and SDK clients. -
Observability pipelines: In production, teams often want traces written to a shared volume (e.g.
/data/profiling) for collection by a sidecar. An env var makes this a one-line Docker Compose / Helm values change.
Bonus: Typo fixes in profiler trace filenames
Two typos exist in the profiler trace output that produce malformed filenames:
1. Missing 'r' in track — inference/core/interfaces/stream/utils.py line 142
# Current (typo):
f"inference_pipeline_workflow_execution_tack_{formatted_time}.json"
# Should be:
f"inference_pipeline_workflow_execution_track_{formatted_time}.json"
2. Same typo in the SDK — inference_sdk/http/utils/profilling.py line 21
# Current (typo):
f"workflow_execution_tack_{formatted_time}.json"
# Should be:
f"workflow_execution_track_{formatted_time}.json"
3. missmatch → mismatch — inference/core/interfaces/stream/utils.py line 43
# Current (typo):
error_description="Cannot apply `video_source_properties` to video sources due to missmatch in "
# Should be:
error_description="Cannot apply `video_source_properties` to video sources due to mismatch in "
Note:
missmatchappears in several other files across the codebase (stream_manager, workflows, inference_models). Those could be addressed in a follow-up cleanup PR if desired, but the two above are directly in the profiling code path.
Example Usage
Docker
docker run \
-e ENABLE_WORKFLOWS_PROFILING=True \
-e WORKFLOWS_PROFILING_DIRECTORY=/data/profiling \
-v /host/profiling:/data/profiling \
roboflow/inference:latest
Docker Compose
services:
inference:
image: roboflow/inference:latest
environment:
ENABLE_WORKFLOWS_PROFILING: "True"
WORKFLOWS_PROFILING_DIRECTORY: "/data/profiling"
volumes:
- ./profiling:/data/profiling
Helm / K8s
env:
- name: ENABLE_WORKFLOWS_PROFILING
value: "True"
- name: WORKFLOWS_PROFILING_DIRECTORY
value: "/mnt/profiling"
Suggested implementation (happy to submit a PR)
-
inference/core/env.py— add after line 1037:WORKFLOWS_PROFILING_DIRECTORY = os.getenv("WORKFLOWS_PROFILING_DIRECTORY", "./inference_profiling") -
inference/core/interfaces/stream/inference_pipeline.pyline 503 — change default:profiling_directory: str = WORKFLOWS_PROFILING_DIRECTORY, -
inference_sdk/http/entities.pyline 150 — change default:profiling_directory: str = WORKFLOWS_PROFILING_DIRECTORY, -
Fix typos in
utils.py(lines 43, 142) andprofilling.py(line 21) as described above.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 340
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 92
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from roboflow/inference
-
Allow Pillow 13 in inference-sdkMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
roboflow/inference#3335 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
roboflow/inference#3173 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
roboflow/inference#2993 · 2 comments ·
Maintainers usually reply within 1 day
-
Add context manager (__enter__ / __exit__) support to InferencePipelinePossibly taken @KushagraKanaujia claimed this 67 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
roboflow/inference#2744 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
roboflow/inference#1913 · 1 comment · 2 reactions ·
Maintainers usually reply within 1 day
All issues in roboflow/inference
Similar issues
-
area:core-platform effort:S priority:P3 risk:night-safe status:ready type:test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
randomparity/kdive#3620 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FinanceFlash/unvibecode#760 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
google-research/google-research#3470 ·
Maintainers usually reply within 21 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
mrvautin/ha-workouts#11 ·