serverless-plugin-warmup 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/config.js +3 -0
- package/src/schema.js +5 -1
- package/src/warmer.js +3 -0
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ custom:
|
|
|
43
43
|
events:
|
|
44
44
|
- schedule: cron(0/5 8-17 ? * MON-FRI *)
|
|
45
45
|
concurrency: 10
|
|
46
|
+
logRetentionInDays: 10
|
|
46
47
|
outOfOfficeHoursWarmer:
|
|
47
48
|
enabled: true
|
|
48
49
|
events:
|
|
@@ -68,6 +69,7 @@ The options are the same for all the warmers:
|
|
|
68
69
|
* **timeout** How many seconds until the warmer lambda times out. (defaults to `10`)
|
|
69
70
|
* **environment** Can be used to set environment variables in the warmer lambda. You can also unset variables configured at the provider by setting them to undefined. However, you should almost never have to change the default. (defaults to unset all package level environment variables. )
|
|
70
71
|
* **tracing** Specify whether to enable/disable tracing at the function level. When tracing is enabled, warmer functions will use NPM to install the X-Ray client and use it to trace requests (It takes any of the values supported by serverless as `boolean`, `Active`or `PassThrough` and defaults to the provider-level setting)
|
|
72
|
+
* **logRetentionInDays** Set the retention time in days for the log group associated to this warmer lamba
|
|
71
73
|
* **prewarm** If set to true, it warms up your lambdas right after deploying (defaults to `false`)
|
|
72
74
|
|
|
73
75
|
There are also some options which can be set under `custom.warmup.<yourWarmer>` to be applied to all your lambdas or under `yourLambda.warmup.<yourWarmer>` to overridde the global configuration for that particular lambda. Keep in mind that in order to configure a warmer at the function level, it needed to be previously configured at the `custom` section or the pluging will error.
|
|
@@ -103,6 +105,7 @@ custom:
|
|
|
103
105
|
- ./**
|
|
104
106
|
timeout: 20
|
|
105
107
|
tracing: true
|
|
108
|
+
logRetentionInDays: 10
|
|
106
109
|
prewarm: true # Run WarmUp immediately after a deploymentlambda
|
|
107
110
|
clientContext:
|
|
108
111
|
source: my-custom-source
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -41,6 +41,9 @@ function getWarmerConfig(config, defaultOpts) {
|
|
|
41
41
|
? config.environment
|
|
42
42
|
: defaultOpts.environment,
|
|
43
43
|
tracing: (config.tracing !== undefined) ? config.tracing : defaultOpts.tracing,
|
|
44
|
+
logRetentionInDays: (config.logRetentionInDays !== undefined)
|
|
45
|
+
? config.logRetentionInDays
|
|
46
|
+
: defaultOpts.logRetentionInDays,
|
|
44
47
|
prewarm: (config.prewarm !== undefined) ? config.prewarm : defaultOpts.prewarm,
|
|
45
48
|
};
|
|
46
49
|
/* eslint-enable no-nested-ternary */
|
package/src/schema.js
CHANGED
|
@@ -107,6 +107,10 @@ function extendServerlessSchema(serverless) {
|
|
|
107
107
|
timeout: { $ref: '#/definitions/awsLambdaTimeout' },
|
|
108
108
|
environment: { $ref: '#/definitions/awsLambdaEnvironment' },
|
|
109
109
|
tracing: { $ref: '#/definitions/awsLambdaTracing' },
|
|
110
|
+
logRetentionInDays: {
|
|
111
|
+
type: 'number',
|
|
112
|
+
enum: [1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653],
|
|
113
|
+
},
|
|
110
114
|
prewarm: { type: 'boolean' },
|
|
111
115
|
};
|
|
112
116
|
|
|
@@ -155,7 +159,7 @@ function extendServerlessSchema(serverless) {
|
|
|
155
159
|
patternProperties: {
|
|
156
160
|
'.*': {
|
|
157
161
|
type: 'object',
|
|
158
|
-
properties:
|
|
162
|
+
properties: functionConfigSchemaProperties,
|
|
159
163
|
additionalProperties: false,
|
|
160
164
|
},
|
|
161
165
|
},
|
package/src/warmer.js
CHANGED
|
@@ -225,6 +225,9 @@ function addWarmUpFunctionToService(service, warmerName, warmerConfig) {
|
|
|
225
225
|
? { environment: warmerConfig.environment }
|
|
226
226
|
: {}),
|
|
227
227
|
...(warmerConfig.tracing !== undefined ? { tracing: warmerConfig.tracing } : {}),
|
|
228
|
+
...(warmerConfig.logRetentionInDays !== undefined
|
|
229
|
+
? { logRetentionInDays: warmerConfig.logRetentionInDays }
|
|
230
|
+
: {}),
|
|
228
231
|
...(warmerConfig.role ? { role: warmerConfig.role } : {}),
|
|
229
232
|
...(warmerConfig.tags ? { tags: warmerConfig.tags } : {}),
|
|
230
233
|
...(warmerConfig.vpc ? { vpc: warmerConfig.vpc } : {}),
|