You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update environment variable tables for utilities (#1153)
* chore(docs): update environment variable table
* Correct the default value for the POWERTOOLS_METRICS_NAMESPACE env var
* Refer reader to utility page for further info on env vars
* chore(docs): add default, allowed and example values to utility docs
* Extract default and allowed values from description to their own cols
* Add allowed values, example and default columns
* Correct default value for metrics namespace
* refactor: set default service name in utility class
Previously the Metric and Tracer classes did not set a service name if
one was not provided. There was no default service name.
This commit sets a default service name in the Utility class, and
updates the Tracer, Metric and Logger classes to use it.
* test: fix Logger tests
Add missing `defaultServiceName` property to expected Logger object
Correct typo in test names
* test(tracer): remove invalid test
Remove a test that is no longer valid. As there is a default service
name, the tracer should not be enabled even if there is a service name
Update the `addServiceAnnotation` function to remove redundant check
* docs(metrics): correct default value
* test(metrics): update metric tests to account for default service dim
The `service_name` is now set by default. This means it is always
present in metric dimensions. This commit updates the tests to account
for this change
* test(tracer): add test for default service name
* test(utility): add test for new method
Add test for getDefaultServiceName method
* test(utility): fix getdefaultservicename test
* refactor: extract isvalidservicename method to utility class
This commit extracts the isValidServiceName method from the Tracer class
to the Utility class.
* test(utility): fix test description
* refactor: change utility class methods from public to protected
* test(utility): refactor tests to allow for protected methods
* docs(index): remove quotation marks from default values
* test(metrics): add comments to explain magic numbers
* doc(tracer): add explanation for definite assignment assertion operator
* test(tracer): refactor test to match project norms
|**Service name**| Sets the name of service of which the Lambda function is part of, that will be present across all log statements |`POWERTOOLS_SERVICE_NAME`|`serviceName`|
58
-
|**Logging level**| Sets how verbose Logger should be (INFO, by default). Supported values are: `DEBUG`, `INFO`, `WARN`, `ERROR`|`LOG_LEVEL`|`logLevel`|
59
-
|**Log incoming event**| Whether to log or not the incoming event when using the decorator or middleware. Supported values are: `true`, or `false`, disabled by default |`POWERTOOLS_LOGGER_LOG_EVENT`|`logEvent`|
60
-
|**Debug log sampling**| Probability that a Lambda invocation will print all the log items regardless of the log level setting. Supported values range from `0.0` to `1`|`POWERTOOLS_LOGGER_SAMPLE_RATE`|`sampleRateValue`|
|**Service name**| Sets the name of service of which the Lambda function is part of, that will be present across all log statements |`POWERTOOLS_SERVICE_NAME`|`service_undefined`| Any string|`serverlessAirline`|`serviceName`|
58
+
|**Logging level**| Sets how verbose Logger should be |`LOG_LEVEL`|`info`|`DEBUG`, `INFO`, `WARN`, `ERROR`|`ERROR`|`logLevel`|
59
+
|**Log incoming event**| Whether to log or not the incoming event when using the decorator or middleware. |`POWERTOOLS_LOGGER_LOG_EVENT`|`false`|`true`, `false`|`false`|`logEvent`|
60
+
|**Debug log sampling**| Probability that a Lambda invocation will print all the log items regardless of the log level setting. |`POWERTOOLS_LOGGER_SAMPLE_RATE`|`0`|`0.0` to `1`|`0.5`|`sampleRateValue`|
61
61
62
62
#### Example using AWS Serverless Application Model (SAM)
|**Service**| Optionally, sets **service** metric dimension across all metrics|`POWERTOOLS_SERVICE_NAME`|`service_undefined`| Any string|`serverlessAirline`|`serviceName`|
72
+
|**Metric namespace**| Logical container where all metrics will be placed |`POWERTOOLS_METRICS_NAMESPACE`|`default_namespace`| Any string |`serverlessAirline`|`default_namespace`|
73
73
74
74
!!! tip
75
75
Use your application name or main service as the metric namespace to easily group all metrics
|**Service name**| Sets an annotation with the **name of the service** across all traces e.g. `serverlessAirline`|`POWERTOOLS_SERVICE_NAME`|`serviceName`|
56
-
|**Tracing enabled**| Enables or disables tracing. By default tracing is enabled when running in AWS Lambda|`POWERTOOLS_TRACE_ENABLED`|`enabled`|
57
-
|**Capture HTTPs Requests**| Defines whether HTTPs requests will be traced or not, enabled by default when tracing is also enabled|`POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS`|`captureHTTPsRequests`|
58
-
|**Capture Response**| Defines whether functions responses are serialized as metadata, enabled by default when tracing is also enabled |`POWERTOOLS_TRACER_CAPTURE_RESPONSE`|`captureResult`|
59
-
|**Capture Errors**| Defines whether functions errors are serialized as metadata, enabled by default when tracing is also enabled|`POWERTOOLS_TRACER_CAPTURE_ERROR`| N/A |
|**Service name**| Sets an annotation with the **name of the service** across all traces |`POWERTOOLS_SERVICE_NAME`|`service_undefined`| Any string|`serverlessAirline`|`serviceName`|
56
+
|**Tracing enabled**| Enables or disables tracing. |`POWERTOOLS_TRACE_ENABLED`|`true `|`true` or `false`|`false`|`enabled`|
57
+
|**Capture HTTPs Requests**| Defines whether HTTPs requests will be traced or not|`POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS`|`true`|`true` or `false`|`false`|`captureHTTPsRequests`|
58
+
|**Capture Response**| Defines whether functions responses are serialized as metadata|`POWERTOOLS_TRACER_CAPTURE_RESPONSE`|`true`|`true` or `false`|`false`|`captureResult`|
59
+
|**Capture Errors**| Defines whether functions errors are serialized as metadata|`POWERTOOLS_TRACER_CAPTURE_ERROR`|`true`|`true` or `false`|`false`| N/A |
60
60
61
61
!!! note
62
62
Before your use this utility, your AWS Lambda function must have [Active Tracing enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html) as well as [have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray
|**POWERTOOLS_TRACER_CAPTURE_RESPONSE**| Captures Lambda or method return as metadata. |[Tracer](./core/tracer)|`true`|
292
292
|**POWERTOOLS_TRACER_CAPTURE_ERROR**| Captures Lambda or method exception as metadata. |[Tracer](./core/tracer)|`true`|
@@ -296,6 +296,8 @@ Core utilities such as Tracing, Logging, and Metrics will be available across al
296
296
|**POWERTOOLS_DEV**| Increase JSON indentation to ease debugging when running functions locally or in a non-production environment |[Logger](./core/logger)|`false`|
0 commit comments