> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sluice.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Celery configuration flags that the Sluice SDK manages, and recommendations for optimal monitoring.

## Auto-configured settings

The SDK automatically enables three Celery settings that are critical for monitoring. All three are `False` by default in Celery — which means most Celery deployments emit zero monitoring data out of the box.

| Setting                   | Default | SDK sets to | Purpose                                                                                                                                                                |
| ------------------------- | ------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `worker_send_task_events` | `False` | `True`      | Enables the real-time event stream. Without this, Sluice receives nothing.                                                                                             |
| `task_send_sent_event`    | `False` | `True`      | Emits an event when a task is dispatched. Without this, "sent but not yet received" tasks are invisible — Celery reports them as PENDING (which just means "unknown"). |
| `task_track_started`      | `False` | `True`      | Emits an event when a task begins executing. Without this, duration tracking is impossible.                                                                            |

The SDK sets these via the Celery Bootstep it installs. If you've explicitly set any of these to `False` in your Celery config, the SDK will log a warning but respect your setting.

## Recommended Celery settings

These aren't required, but they improve monitoring reliability:

```python theme={null}
# Prevent tasks from running forever without a timeout.
# This is Celery's #1 silent failure mode — tasks can hang indefinitely
# and occupy a worker slot until the process is killed.
task_time_limit = 600  # seconds (hard kill)
task_soft_time_limit = 540  # seconds (SoftTimeLimitExceeded exception)

# Keep prefetch low for long-running tasks.
# High prefetch means workers grab multiple tasks upfront, which makes
# queue depth readings inaccurate and can cause uneven load distribution.
worker_prefetch_multiplier = 1  # default is 4

# Store results so Sluice can capture return values and errors.
# Without a result backend, failed tasks lose their traceback after
# the event stream window expires.
result_backend = "redis://localhost:6379/0"
result_expires = 86400  # 24 hours (default)
```

## Settings the SDK never touches

| Setting                      | Why we leave it alone                                                |
| ---------------------------- | -------------------------------------------------------------------- |
| `worker_hijack_root_logger`  | Changing logging config in customer infrastructure is too invasive.  |
| `task_time_limit`            | Safety-critical — should be an explicit choice, not auto-configured. |
| `worker_prefetch_multiplier` | Affects throughput characteristics.                                  |
| `result_backend`             | Requires infrastructure (Redis/DB). Can't be assumed.                |
| `broker_url`                 | The SDK reads this, but never modifies it.                           |
