Skip to content
14 changes: 14 additions & 0 deletions docs/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Logger requires two settings:
| **Logging level** | Sets how verbose Logger should be (INFO, by default) | `LOG_LEVEL` | `level` |
| **Service** | Sets **service** key that will be present across all log statements | `POWERTOOLS_SERVICE_NAME` | `service` |

There are some [other environment variables](#environment-variables) which can be set to modify Logger's settings at a global scope.

```yaml hl_lines="12-13" title="AWS Serverless Application Model (SAM) example"
--8<-- "examples/logger/sam/template.yaml"
```
Expand Down Expand Up @@ -341,6 +343,18 @@ You can easily change the date format using one of the following parameters:
--8<-- "examples/logger/src/date_formatting_output.json"
```

### Environment variables

The following environment variables are available to configure Logger at a global scope:

| Setting | Description | Environment variable | Default |
|---------------------------|------------------------------------------------------------------------------|-----------------------------------------|---------|
| **Event Logging** | Whether to log the incoming event. | `POWERTOOLS_LOGGER_LOG_EVENT` | `false` |
| **Debug Sample Rate** | Sets the debug log sampling. | `POWERTOOLS_LOGGER_SAMPLE_RATE` | `0` |
| **Disable Deduplication** | Disables log deduplication filter protection to use Pytest Live Log feature. | `POWERTOOLS_LOG_DEDUPLICATION_DISABLED` | `false` |

[`POWERTOOLS_LOGGER_LOG_EVENT`](#logging-incoming-event) can also be set on a per-method basis, and [`POWERTOOLS_LOGGER_SAMPLE_RATE`](#sampling-debug-logs) on a per-instance basis. These parameter values will override the environment variable value.

## Advanced

### Built-in Correlation ID expressions
Expand Down
12 changes: 11 additions & 1 deletion docs/core/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ This has the advantage of keeping cold start metric separate from your applicati
???+ info
We do not emit 0 as a value for ColdStart metric for cost reasons. [Let us know](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=feature-request%2C+triage&template=feature_request.md&title=){target="_blank"} if you'd prefer a flag to override it.

### Environment variables

The following environment variable is available to configure Metrics at a global scope:

| Setting | Description | Environment variable | Default |
|--------------------|------------------------------------------------------------------------------|-----------------------------------------|---------|
| **Namespace Name** | Sets namespace used for metrics. | `POWERTOOLS_METRICS_NAMESPACE` | `None` |

`POWERTOOLS_METRICS_NAMESPACE` is also available on a per-instance basis with the `namespace` parameter, which will consequently override the environment variable value.

## Advanced

### Adding metadata
Expand Down Expand Up @@ -319,7 +329,7 @@ That is why `Metrics` shares data across instances by default, as that covers 80

## Testing your code

### Environment variables
### Setting environment variables

???+ tip
Ignore this section, if:
Expand Down
12 changes: 12 additions & 0 deletions docs/core/tracer.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ You can trace asynchronous functions and generator functions (including context
--8<-- "examples/tracer/src/capture_method_generators.py"
```

### Environment variables

The following environment variables are available to configure Tracer at a global scope:

| Setting | Description | Environment variable | Default |
|-----------------------|--------------------------------------------------|--------------------------------------|---------|
| **Disable Tracing** | Explicitly disables all tracing. | `POWERTOOLS_TRACE_DISABLED` | `false` |
| **Response Capture** | Captures Lambda or method return as metadata. | `POWERTOOLS_TRACER_CAPTURE_RESPONSE` | `true` |
| **Exception Capture** | Captures Lambda or method exception as metadata. | `POWERTOOLS_TRACER_CAPTURE_ERROR` | `true` |

Both [`POWERTOOLS_TRACER_CAPTURE_RESPONSE`](#disabling-response-auto-capture) and [`POWERTOOLS_TRACER_CAPTURE_ERROR`](#disabling-exception-auto-capture) can be set on a per-method basis, consequently overriding the environment variable value.

## Advanced

### Patching modules
Expand Down
10 changes: 10 additions & 0 deletions docs/utilities/middleware_factory.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ You can also have your own keyword arguments after the mandatory arguments.
--8<-- "examples/middleware_factory/src/getting_started_middleware_with_params_payload.json"
```

### Environment variables

The following environment variable is available to configure the middleware factory at a global scope:

| Setting | Description | Environment variable | Default |
|----------------------|------------------------------------------------------------------------------|-----------------------------------------|---------|
| **Middleware Trace** | Creates sub-segment for each custom middleware. | `POWERTOOLS_TRACE_MIDDLEWARES` | `false` |

You can also use [`POWERTOOLS_TRACE_MIDDLEWARES`](#tracing-middleware-execution) on a per-method basis, which will consequently override the environment variable value.

## Advanced

For advanced use cases, you can instantiate [Tracer](../core/tracer.md){target="_blank"} inside your middleware, and add annotations as well as metadata for additional operational insights.
Expand Down
11 changes: 11 additions & 0 deletions docs/utilities/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ The following will retrieve the latest version and store it in the cache.
--8<-- "examples/parameters/src/getting_started_appconfig.py"
```

### Environment variables

The following environment variables are available to configure the parameter utility at a global scope:

| Setting | Description | Environment variable | Default |
|-----------------------|--------------------------------------------------------------------------------|-------------------------------------|---------|
| **Max Age** | Adjusts for how long values are kept in cache (in seconds). | `POWERTOOLS_PARAMETERS_MAX_AGE` | `5` |
| **Debug Sample Rate** | Sets whether to decrypt or not values retrieved from AWS SSM Parameters Store. | `POWERTOOLS_PARAMETERS_SSM_DECRYPT` | `false` |

You can also use [`POWERTOOLS_PARAMETERS_MAX_AGE`](#adjusting-cache-ttl) through the `max_age` parameter and [`POWERTOOLS_PARAMETERS_SSM_DECRYPT`](#ssmprovider) through the `decrypt` parameter to override the environment variable values.

## Advanced

### Adjusting cache TTL
Expand Down