@contrast/telemetry 1.27.0 → 1.28.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.
Files changed (2) hide show
  1. package/lib/index.js +8 -5
  2. package/package.json +6 -6
package/lib/index.js CHANGED
@@ -31,9 +31,11 @@ const TELEMETRY_VERSION = 'v0'; // TODO: set this to v1 when format is establish
31
31
 
32
32
  /**
33
33
  * @param {import("@contrast/core").Core} core
34
+ * @param {import('@contrast/common').SystemInfo} sysInfo
35
+ * @returns {Promise<{ applicationId: string, instance: string }>}
34
36
  */
35
- async function getIds(core) {
36
- const { Host: { Docker: { containerID: containerId } } } = await core.getSystemInfo();
37
+ async function getIds(core, sysInfo) {
38
+ const { host: { docker: { containerId } } } = sysInfo;
37
39
  let applicationId, instance;
38
40
 
39
41
  try {
@@ -51,7 +53,7 @@ async function getIds(core) {
51
53
  applicationId = instance = `_${id}`;
52
54
  }
53
55
 
54
- return { applicationId, containerId, instance };
56
+ return { applicationId, instance };
55
57
  }
56
58
 
57
59
  /**
@@ -85,14 +87,15 @@ module.exports = function (core) {
85
87
 
86
88
  logger.info(DISCLAIMER);
87
89
 
88
- const { instance, containerId, applicationId } = await getIds(core);
90
+ const sysInfo = await core.getSystemInfo();
91
+ const { applicationId, instance } = await getIds(core, sysInfo);
89
92
  const tags = {
90
93
  applicationId,
91
94
  isCustomerEnv: true,
92
95
  osArch: appInfo.os.architecture,
93
96
  osPlatform: appInfo.os.platform,
94
97
  osRelease: appInfo.os.release,
95
- isContainer: !!containerId,
98
+ isContainer: sysInfo.host.docker.isDocker,
96
99
  agent: agentName,
97
100
  agentVersion,
98
101
  isAssess: config.getEffectiveValue('assess.enable'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/telemetry",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Telemetry reporting for the Contrast Node.js agent.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -16,13 +16,13 @@
16
16
  "node": ">=16.9.1"
17
17
  },
18
18
  "scripts": {
19
- "test": "../scripts/test.sh"
19
+ "test": "bash ../scripts/test.sh"
20
20
  },
21
21
  "dependencies": {
22
- "@contrast/common": "1.32.0",
23
- "@contrast/config": "1.47.0",
24
- "@contrast/core": "1.52.0",
25
- "@contrast/logger": "1.25.0",
22
+ "@contrast/common": "1.33.0",
23
+ "@contrast/config": "1.48.0",
24
+ "@contrast/core": "1.53.0",
25
+ "@contrast/logger": "1.26.0",
26
26
  "axios": "^1.7.4",
27
27
  "getmac": "^6.3.0"
28
28
  }