@aws-lambda-powertools/tracer
Version:
The tracer package for the Powertools for AWS Lambda (TypeScript) library
61 lines (60 loc) • 2.07 kB
JavaScript
import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons';
class EnvironmentVariablesService extends CommonEnvironmentVariablesService {
// Environment variables
awsExecutionEnv = 'AWS_EXECUTION_ENV';
samLocalVariable = 'AWS_SAM_LOCAL';
tracerCaptureErrorVariable = 'POWERTOOLS_TRACER_CAPTURE_ERROR';
tracerCaptureHTTPsRequestsVariable = 'POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS';
tracerCaptureResponseVariable = 'POWERTOOLS_TRACER_CAPTURE_RESPONSE';
tracingEnabledVariable = 'POWERTOOLS_TRACE_ENABLED';
/**
* It returns the value of the AWS_EXECUTION_ENV environment variable.
*
* @returns {string}
*/
getAwsExecutionEnv() {
return this.get(this.awsExecutionEnv);
}
/**
* It returns the value of the POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS environment variable.
*
* @returns {string}
*/
getCaptureHTTPsRequests() {
return this.get(this.tracerCaptureHTTPsRequestsVariable);
}
/**
* It returns the value of the AWS_SAM_LOCAL environment variable.
*
* @returns {string}
*/
getSamLocal() {
return this.get(this.samLocalVariable);
}
/**
* It returns the value of the POWERTOOLS_TRACER_CAPTURE_ERROR environment variable.
*
* @returns {string}
*/
getTracingCaptureError() {
return this.get(this.tracerCaptureErrorVariable);
}
/**
* It returns the value of the POWERTOOLS_TRACER_CAPTURE_RESPONSE environment variable.
*
* @returns {string}
*/
getTracingCaptureResponse() {
return this.get(this.tracerCaptureResponseVariable);
}
/**
* It returns the value of the POWERTOOLS_TRACE_ENABLED environment variable.
*
* @returns {string}
*/
getTracingEnabled() {
return this.get(this.tracingEnabledVariable);
}
}
const environmentVariablesService = new EnvironmentVariablesService();
export { EnvironmentVariablesService, environmentVariablesService };