@instana/shared-metrics 2.5.0 → 2.6.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 2.6.2 (2022-08-17)
7
+
8
+ **Note:** Version bump only for package @instana/shared-metrics
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.6.1](https://github.com/instana/nodejs/compare/v2.6.0...v2.6.1) (2022-08-09)
15
+
16
+ **Note:** Version bump only for package @instana/shared-metrics
17
+
18
+
19
+
20
+
21
+
22
+ # [2.6.0](https://github.com/instana/nodejs/compare/v2.5.0...v2.6.0) (2022-06-28)
23
+
24
+ **Note:** Version bump only for package @instana/shared-metrics
25
+
26
+
27
+
28
+
29
+
6
30
  # [2.5.0](https://github.com/instana/nodejs/compare/v2.4.0...v2.5.0) (2022-06-23)
7
31
 
8
32
  **Note:** Version bump only for package @instana/shared-metrics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instana/shared-metrics",
3
- "version": "2.5.0",
3
+ "version": "2.6.2",
4
4
  "description": "Internal metrics plug-in package for Node.js monitoring with Instana",
5
5
  "author": {
6
6
  "name": "Bastian Krol",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "license": "MIT",
69
69
  "dependencies": {
70
- "@instana/core": "2.5.0",
70
+ "@instana/core": "2.6.2",
71
71
  "detect-libc": "^1.0.3",
72
72
  "event-loop-lag": "^1.4.0",
73
73
  "recursive-copy": "^2.0.13",
@@ -82,5 +82,5 @@
82
82
  "event-loop-stats": "1.4.1",
83
83
  "gcstats.js": "1.0.0"
84
84
  },
85
- "gitHead": "0d11b04a5bee77f5a8dd8255bcc756b4c313804f"
85
+ "gitHead": "14403f521e832904e6aff83f873ef90a2f8ded51"
86
86
  }
package/src/gc.js CHANGED
@@ -53,9 +53,10 @@ const nativeModuleLoader = require('./util/nativeModuleRetry')({
53
53
  moduleRoot: path.join(__dirname, '..'),
54
54
  message:
55
55
  'Could not load gcstats.js. You will not be able to see GC information in Instana for this application. This ' +
56
- 'typically occurs when native addons could not be installed during module installation (npm install). See the ' +
56
+ 'typically occurs when native addons could not be built during module installation (npm install/yarn) or when ' +
57
+ 'npm install --no-optional or yarn --ignore-optional have been used to install dependencies. See the ' +
57
58
  'instructions to learn more about the requirements of the collector: ' +
58
- 'https://www.ibm.com/docs/de/obi/current?topic=nodejs-collector-installation#native-addons'
59
+ 'https://www.ibm.com/docs/de/obi/current?topic=nodejs-collector-installation#native-add-ons'
59
60
  });
60
61
 
61
62
  /** @type {NodeJS.Timeout} */
package/src/libuv.js CHANGED
@@ -18,11 +18,11 @@ const nativeModuleLoader = require('./util/nativeModuleRetry')({
18
18
  nativeModuleName: 'event-loop-stats',
19
19
  moduleRoot: path.join(__dirname, '..'),
20
20
  message:
21
- 'Could not load event-loop-stats. You will only see limited event loop information in ' +
22
- 'Instana for this application. This typically occurs when native addons could not be ' +
23
- 'installed during module installation (npm install). See the instructions to learn more ' +
24
- 'about the requirements of the collector: ' +
25
- 'https://www.ibm.com/docs/de/obi/current?topic=nodejs-collector-installation#native-addons'
21
+ 'Could not load event-loop-stats. You will only see limited event loop information in Instana for this ' +
22
+ 'application. This typically occurs when native addons could not be built during module installation ' +
23
+ '(npm install/yarn) or when npm install --no-optional or yarn --ignore-optional have been used to install ' +
24
+ 'dependencies. See the instructions to learn more about the requirements of the collector: ' +
25
+ 'https://www.ibm.com/docs/de/obi/current?topic=nodejs-collector-installation#native-add-ons'
26
26
  });
27
27
 
28
28
  nativeModuleLoader.once('loaded', eventLoopStats_ => {
package/src/name.js CHANGED
@@ -20,24 +20,26 @@ exports.payloadPrefix = 'name';
20
20
  // @ts-ignore
21
21
  exports.currentPayload = undefined;
22
22
 
23
- const MAX_ATTEMPTS = 60;
24
- const DELAY = 1000;
23
+ exports.MAX_ATTEMPTS = 60;
24
+ exports.DELAY = 1000;
25
25
  let attempts = 0;
26
26
 
27
27
  exports.activate = function activate() {
28
28
  attempts++;
29
+
29
30
  applicationUnderMonitoring.getMainPackageJsonStartingAtMainModule((err, packageJson) => {
30
31
  if (err) {
31
32
  return logger.warn('Failed to determine main package json. Reason: ', err.message, err.stack);
32
- } else if (!packageJson && attempts < MAX_ATTEMPTS) {
33
+ } else if (!packageJson && attempts < exports.MAX_ATTEMPTS) {
33
34
  logger.debug('Main package.json could not be found. Will try again later.');
34
- setTimeout(exports.activate, DELAY).unref();
35
+ setTimeout(exports.activate, exports.DELAY).unref();
35
36
  return;
36
37
  } else if (!packageJson) {
37
- if (process.mainModule) {
38
+ if (require.main) {
38
39
  // @ts-ignore
39
- exports.currentPayload = process.mainModule.filename;
40
+ exports.currentPayload = require.main.filename;
40
41
  }
42
+
41
43
  return logger.warn(
42
44
  `Main package.json could not be found. This Node.js app will be labeled "${
43
45
  exports.currentPayload ? exports.currentPayload : 'Unknown'
@@ -49,3 +51,9 @@ exports.activate = function activate() {
49
51
  exports.currentPayload = packageJson.name;
50
52
  });
51
53
  };
54
+
55
+ exports.reset = () => {
56
+ exports.currentPayload = undefined;
57
+ exports.MAX_ATTEMPTS = 60;
58
+ exports.DELAY = 1000;
59
+ };