# config

Python API: `luxonis_ml.telemetry.config`

## Classes

| Name | Description |
| --- | --- |
|
[`TelemetryConfig`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry/config.md)
| Configuration for telemetry collection. |
|
[`TelemetryDefaults`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry/config.md)
| Optional product-level defaults for telemetry configuration. |

### class `TelemetryConfig`

```python
class TelemetryConfig
```

Configuration for telemetry collection.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `allow_reserved_overrides` | `bool` | Whether callers and context providers may override reserved telemetry control fields. The
reserved fields are `$process_person_profile`, `$session_id`, `source_product`, `source_component`, and `sdk_version`. See
[luxonis_ml.telemetry.context.RESERVED_METADATA_KEYS](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry/context.md).
Keep the default unless you intend the override. The PostHog backend still sets `schema_version` itself. |
| `allowlist` | `set[str] | None` | CLI parameter names that may be logged. |
| `api_key` | `str | None` | API key for the backend, if applicable. |
| `backend` | `str` | Backend name to use, such as `"posthog"` or `"stdout"`. |
| `debug` | `bool` | Whether to enable debug behavior such as the stdout backend default. |
| `disable_geoip` | `bool` | Whether to disable PostHog GeoIP enrichment. |
| `enabled` | `bool` | Whether telemetry should emit events. |
| `endpoint` | `str | None` | Custom endpoint or host for the backend, if applicable. |
| `include_base_context` | `bool` | Whether to include the shared default context on every event. |
| `include_system_metadata` | `bool` | Whether to include extended system metadata by default. |

Methods

| Name | Description |
| --- | --- |
|
[`from_environ`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry/config.md)
| Build a config from environment variables. |

#### class method `from_environ`

```python
def from_environ(defaults: TelemetryDefaults | None = None) -> TelemetryConfig
```

Build a config from environment variables.

Reads the `LUXONIS_TELEMETRY_*` settings and returns a fully populated `TelemetryConfig` instance. The
[luxonis_ml.telemetry](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry.md)
package documentation lists the variables. Environment variables take precedence over product-level defaults, which in turn take
precedence over the telemetry module's base defaults.

The `backend` field is the one exception. If neither `LUXONIS_TELEMETRY_BACKEND` nor `TelemetryDefaults.backend` gives a value,
the last fallback stays dynamic: the backend is `"stdout"` when the resolved `debug` is True, and `"posthog"` otherwise.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `defaults` | `TelemetryDefaults | None` | Optional product-level defaults used when a given environment variable is not set. |
`None` |

Returns

| Type | Description |
| --- | --- |
| `TelemetryConfig` | A telemetry configuration built from environment variables. |

### class `TelemetryDefaults`

```python
class TelemetryDefaults
```

Optional product-level defaults for telemetry configuration.

Any field left as `None` falls back to the telemetry module's base default for that setting.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `allow_reserved_overrides` | `bool | None` |  |
| `allowlist` | `set[str] | None` |  |
| `api_key` | `str | None` |  |
| `backend` | `str | None` |  |
| `debug` | `bool | None` |  |
| `disable_geoip` | `bool | None` |  |
| `enabled` | `bool | None` |  |
| `endpoint` | `str | None` |  |
| `include_base_context` | `bool | None` |  |
| `include_system_metadata` | `bool | None` |  |

## Module Attributes

| Name | Description |
| --- | --- |
|
[`T`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/telemetry/config.md)
| |

### type variable `T`

```python
T = TypeVar('T')
```
