@geek-fun/serverlessinsight 0.2.0 → 0.2.1

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
5
  "homepage": "https://serverlessinsight.geekfun.club",
6
6
  "main": "dist/src/index.js",
@@ -15,6 +15,7 @@ const parseFunction = (functions) => {
15
15
  timeout: func.timeout,
16
16
  environment: func.environment,
17
17
  code: func.code,
18
+ log: func.log,
18
19
  }));
19
20
  };
20
21
  exports.parseFunction = parseFunction;
@@ -44,6 +44,8 @@ const resolveFunctions = (scope, functions, tags, context, service) => {
44
44
  if ((0, lodash_1.isEmpty)(functions)) {
45
45
  return undefined;
46
46
  }
47
+ let logConfig = undefined;
48
+ const enableLog = functions?.some(({ log }) => log);
47
49
  const slsService = new sls.Project(scope, `${service}_sls`, { name: `${service}-sls`, tags: (0, common_1.replaceReference)(tags, context) }, true);
48
50
  const slsLogstore = new sls.Logstore(scope, `${service}_sls_logstore`, {
49
51
  logstoreName: `${service}-sls-logstore`,
@@ -55,6 +57,13 @@ const resolveFunctions = (scope, functions, tags, context, service) => {
55
57
  logstoreName: slsLogstore.attrLogstoreName,
56
58
  fullTextIndex: { enable: true },
57
59
  }, true);
60
+ if (enableLog) {
61
+ logConfig = {
62
+ project: slsLogstore.attrProjectName,
63
+ logstore: slsLogstore.attrLogstoreName,
64
+ enableRequestMetrics: true,
65
+ };
66
+ }
58
67
  const fileSources = functions
59
68
  ?.filter(({ code }) => (0, common_1.readCodeSize)(code) > common_1.CODE_ZIP_SIZE_LIMIT)
60
69
  .map(({ code, name }) => {
@@ -91,15 +100,13 @@ const resolveFunctions = (scope, functions, tags, context, service) => {
91
100
  timeout: (0, common_1.replaceReference)(fnc.timeout, context),
92
101
  environmentVariables: (0, common_1.replaceReference)(fnc.environment, context),
93
102
  code,
94
- logConfig: {
95
- project: slsLogstore.attrProjectName,
96
- logstore: slsLogstore.attrLogstoreName,
97
- enableRequestMetrics: true,
98
- },
103
+ logConfig,
99
104
  }, true);
100
- fcn.addRosDependency(`${service}_sls`);
101
- fcn.addRosDependency(`${service}_sls_logstore`);
102
- fcn.addRosDependency(`${service}_sls_index`);
105
+ if (enableLog) {
106
+ fcn.addRosDependency(`${service}_sls`);
107
+ fcn.addRosDependency(`${service}_sls_logstore`);
108
+ fcn.addRosDependency(`${service}_sls_index`);
109
+ }
103
110
  if (storeInBucket) {
104
111
  fcn.addRosDependency(`${service}_artifacts_code_deployment`);
105
112
  }
@@ -7,6 +7,7 @@ exports.functionSchema = {
7
7
  patternProperties: {
8
8
  '.*': {
9
9
  type: 'object',
10
+ required: ['name', 'runtime', 'handler', 'code'],
10
11
  properties: {
11
12
  name: { type: 'string' },
12
13
  runtime: {
@@ -32,6 +33,7 @@ exports.functionSchema = {
32
33
  code: { type: 'string' },
33
34
  memory: { type: 'number' },
34
35
  timeout: { type: 'number' },
36
+ log: { type: 'boolean' },
35
37
  environment: {
36
38
  type: 'object',
37
39
  additionalProperties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
5
  "homepage": "https://serverlessinsight.geekfun.club",
6
6
  "main": "dist/src/index.js",