@instana/shared-metrics 2.6.1 → 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,14 @@
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
+
6
14
  ## [2.6.1](https://github.com/instana/nodejs/compare/v2.6.0...v2.6.1) (2022-08-09)
7
15
 
8
16
  **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.6.1",
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.6.1",
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": "6910adcc568af60c1f648abc816daff8ff0bccdb"
85
+ "gitHead": "14403f521e832904e6aff83f873ef90a2f8ded51"
86
86
  }
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
+ };