Skip to content

Commit 7345c34

Browse files
committed
add documentation
1 parent 2ea6c19 commit 7345c34

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Diff for: aws_lambda_powertools/metrics/metrics.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def lambda_handler():
4747
metric namespace
4848
POWERTOOLS_SERVICE_NAME : str
4949
service name used for default dimension
50+
POWERTOOLS_METRICS_DISABLED: bool
51+
Powertools metrics disabled (e.g. `"true", "True", "TRUE"`)
5052
5153
Parameters
5254
----------

Diff for: docs/core/metrics.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ If you're new to Amazon CloudWatch, there are five terminologies you must be awa
3434
???+ tip
3535
All examples shared in this documentation are available within the [project repository](https://github.com/aws-powertools/powertools-lambda-python/tree/develop/examples){target="_blank"}.
3636

37-
Metric has two global settings that will be used across all metrics emitted:
37+
Metric has three global settings that will be used across all metrics emitted:
3838

3939
| Setting | Description | Environment variable | Constructor parameter |
4040
| -------------------- | ------------------------------------------------------------------------------- | ------------------------------ | --------------------- |
4141
| **Metric namespace** | Logical container where all metrics will be placed e.g. `ServerlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace` |
4242
| **Service** | Optionally, sets **service** metric dimension across all metrics e.g. `payment` | `POWERTOOLS_SERVICE_NAME` | `service` |
43+
| **Disable Powertools Metrics** | Optionally, disables all Powertools metrics. | `POWERTOOLS_METRICS_DISABLED` | N/A |
44+
45+
???+ warning
46+
`POWERTOOLS_METRICS_DISABLED` will not disable default metrics created by AWS services.
4347

4448
???+ tip
4549
Use your application or main service as the metric namespace to easily group all metrics.
@@ -79,7 +83,7 @@ You can create metrics using `add_metric`, and you can create dimensions for all
7983
CloudWatch EMF supports a max of 100 metrics per batch. Metrics utility will flush all metrics when adding the 100th metric. Subsequent metrics (101th+) will be aggregated into a new EMF object, for your convenience.
8084

8185
???+ warning "Warning: Do not create metrics or dimensions outside the handler"
82-
Metrics or dimensions added in the global scope will only be added during cold start. Disregard if you that's the intended behavior.
86+
Metrics or dimensions added in the global scope will only be added during cold start. Disregard if that's the intended behavior.
8387

8488
### Adding high-resolution metrics
8589

Diff for: docs/core/metrics/datadog.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stateDiagram-v2
2323
DatadogExtension --> Datadog: async
2424
2525
state LambdaExtension {
26-
DatadogExtension
26+
DatadogExtension
2727
}
2828
2929
```
@@ -178,6 +178,10 @@ You can use any of the following environment variables to configure `DatadogMetr
178178
| -------------------- | -------------------------------------------------------------------------------- | ------------------------------ | --------------------- |
179179
| **Metric namespace** | Logical container where all metrics will be placed e.g. `ServerlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace` |
180180
| **Flush to log** | Use this when you want to flush metrics to be exported through Datadog Forwarder | `DD_FLUSH_TO_LOG` | `flush_to_log` |
181+
| **Disable Powertools Metrics** | Optionally, disables all Powertools metrics. | `POWERTOOLS_METRICS_DISABLED` | N/A |
182+
183+
???+ warning
184+
`POWERTOOLS_METRICS_DISABLED` will not disable default metrics created by AWS services.
181185

182186
## Advanced
183187

0 commit comments

Comments
 (0)