chore(docs): include the environment variables section in the utilities documentation by barreeeiroo · Pull Request #2925 · aws-powertools/powertools-lambda-python · GitHub
Skip to content
14 changes: 14 additions & 0 deletions docs/core/logger.md
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