generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
bugSomething isn't workingSomething isn't workingcompletedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedloggerThis item relates to the Logger UtilityThis item relates to the Logger Utility
Description
Expected Behavior
Invoking a hot Lambda function refreshes the sampling decision. This results in that log level being sometimes lowered to DEBUG based on my set sampleRateValue.
Current Behavior
Invoking a hot Lambda function does not refresh the sampling decision. The sampling decision seems to only happen on Logger initialization.
Code snippet
The Lambda function uses the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable with a value of 0.5.
import { Logger } from '@aws-lambda-powertools/logger';
const logger = new Logger({
serviceName: 'powertools-logger-test',
});
export const handler = async () => {
logger.refreshSampleRateCalculation();
logger.debug('visible sometimes');
logger.info('@aws-lambda-powertools/logger" = 2.xx');
};Steps to Reproduce
- Create a Lambda function according to the provided code snippet.
- Ensure that the Lambda function uses the
POWERTOOLS_LOGGER_SAMPLE_RATEenvironment variable and that it has a high percentage to lower the log level. - Install version
2.15.0of the@aws-lambda-powertools/logger, deploy the function, and invoke it a few times to confirm that theDEBUGlog level is sometimes used. - Install version
2.16.0of the@aws-lambda-powertools/logger, deploy the function, and invoke it a few times. TheDEBUGlog level will be used for all invocations or none of them (refreshSampleRateCalculationfunction has no effect).
Possible Solution
No response
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompletedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedloggerThis item relates to the Logger UtilityThis item relates to the Logger Utility
Type
Projects
Status
Shipped

