Skip to content

Commit 114188c

Browse files
authored
docs: Update metrics docs to mention correct POWERTOOLS_METRICS_DISABLED variable name. (#3848)
1 parent 316fee1 commit 114188c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/environment-variables.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You can configure Powertools for AWS Lambda using environment variables. This is
1515
| **POWERTOOLS_SERVICE_NAME** | Set service name used for tracing namespace, metrics dimension and structured logging | All | `service_undefined` |
1616
| **POWERTOOLS_METRICS_NAMESPACE** | Set namespace used for metrics | [Metrics](features/metrics.md) | `default_namespace` |
1717
| **POWERTOOLS_METRICS_FUNCTION_NAME** | Function name used as dimension for the `ColdStart` metric | [Metrics](features/metrics.md) | [See docs](features/metrics.md#setting-function-name) |
18-
| **POWERTOOLS_METRICS_ENABLED** | Explicitly disables emitting metrics to stdout | [Metrics](features/metrics.md) | `true` |
18+
| **POWERTOOLS_METRICS_DISABLED** | Explicitly disables emitting metrics to stdout | [Metrics](features/metrics.md) | `false` |
1919
| **POWERTOOLS_TRACE_ENABLED** | Explicitly disables tracing | [Tracer](features/tracer.md) | `true` |
2020
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Capture Lambda or method return as metadata. | [Tracer](features/tracer.md) | `true` |
2121
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Capture Lambda or method exception as metadata. | [Tracer](features/tracer.md) | `true` |
@@ -40,4 +40,4 @@ When `POWERTOOLS_DEV` is set to a truthy value (`1`, `true`), it'll have the fol
4040
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
4141
| **Logger** | Increase JSON indentation to 4 and uses global `console` to emit logs to ease testing and local debugging when running functions locally. However, Amazon CloudWatch Logs view will degrade as each new line is treated as a new message |
4242
| **Tracer** | Disables tracing operations in non-Lambda environments. This already happens automatically in the Tracer utility |
43-
| **Metrics** | Disables emitting metrics to stdout. Can be overridden by setting `POWERTOOLS_METRICS_ENABLED` to `true` |
43+
| **Metrics** | Disables emitting metrics to stdout. Can be overridden by explicitly setting `POWERTOOLS_METRICS_DISABLED` to `false` |

docs/features/metrics.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ These settings will be used across all metrics emitted:
7171
| **Service** | Optionally, sets **service** metric dimension across all metrics | `POWERTOOLS_SERVICE_NAME` | `service_undefined` | Any string | `serverlessAirline` | `serviceName` |
7272
| **Metric namespace** | Logical container where all metrics will be placed | `POWERTOOLS_METRICS_NAMESPACE` | `default_namespace` | Any string | `serverlessAirline` | `default_namespace` |
7373
| **Function Name** | Function name used as dimension for the `ColdStart` metric | `POWERTOOLS_METRICS_FUNCTION_NAME` | [See docs](#capturing-a-cold-start-invocation-as-metric) | Any string | `my-function-name` | `functionName` |
74-
| **Enabled** | Whether to emit metrics to standard output or not | `POWERTOOLS_METRICS_ENABLED` | `true` | Boolean | `false` | |
74+
| **Disabled** | Whether to disable the log of metrics to standard output or not | `POWERTOOLS_METRICS_DISABLED` | `false` | Boolean | `true` | |
7575

7676
!!! tip
7777
Use your application name or main service as the metric namespace to easily group all metrics
@@ -493,7 +493,7 @@ You can customize how Metrics logs warnings and debug messages to standard outpu
493493

494494
When unit testing your code that uses the Metrics utility, you may want to silence the logs emitted by the utility. To do so, you can set the `POWERTOOLS_DEV` environment variable to `true`. This instructs the utility to not emit any logs to standard output.
495495

496-
If instead you want to spy on the logs emitted by the utility, you must set the `POWERTOOLS_DEV` environment variable to `true` in conjunction with the `POWERTOOLS_METRICS_ENABLED` environment variable also set to `true`.
496+
If instead you want to spy on the logs emitted by the utility, you must set the `POWERTOOLS_DEV` environment variable to `true` in conjunction with the `POWERTOOLS_METRICS_DISABLED` environment variable set to `false`.
497497

498498
When `POWERTOOLS_DEV` is enabled, Metrics uses the global `console` to emit metrics to standard out. This allows you to easily spy on the logs emitted and make assertions on them.
499499

examples/snippets/metrics/testingMetrics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';
22

33
vi.hoisted(() => {
44
process.env.POWERTOOLS_DEV = 'true';
5-
process.env.POWERTOOLS_METRICS_ENABLED = 'true';
5+
process.env.POWERTOOLS_METRICS_DISABLED = 'false';
66
});
77

88
describe('Metrics tests', () => {

0 commit comments

Comments
 (0)