@instana/shared-metrics 3.1.2 → 3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ # [3.2.0](https://github.com/instana/nodejs/compare/v3.1.3...v3.2.0) (2024-02-27)
7
+
8
+ ### Bug Fixes
9
+
10
+ - depreacted request-promise module ([#1017](https://github.com/instana/nodejs/issues/1017)) ([6bb88dd](https://github.com/instana/nodejs/commit/6bb88dd4ca08d2482ff917fb3b9f884f4e4bdf8e))
11
+
12
+ ## [3.1.3](https://github.com/instana/nodejs/compare/v3.1.2...v3.1.3) (2024-01-31)
13
+
14
+ ### Bug Fixes
15
+
16
+ - resolved logging issue for the dependency distance calculator ([#1024](https://github.com/instana/nodejs/issues/1024)) ([59de3e6](https://github.com/instana/nodejs/commit/59de3e6345bb4b64a2b5f02e01b5351182c66d83)), closes [#1019](https://github.com/instana/nodejs/issues/1019)
17
+
6
18
  ## [3.1.2](https://github.com/instana/nodejs/compare/v3.1.1...v3.1.2) (2024-01-29)
7
19
 
8
20
  **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": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "description": "Internal metrics plug-in package for Node.js monitoring with Instana",
5
5
  "author": {
6
6
  "name": "Bastian Krol",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "scripts": {
28
28
  "audit": "npm audit --omit=dev",
29
- "test": "mocha --config=test/.mocharc.js --require test/hooks.js --sort $(find test -iname '*test.js' -not -path '*node_modules*')",
30
- "test:ci": "echo \"******* Files to be tested:\n $CI_SHARED_METRICS_TEST_FILES\" && if [ -z \"${CI_SHARED_METRICS_TEST_FILES}\" ]; then echo \"No test files have been assigned to this CircleCI executor.\"; else mocha --config=test/.mocharc.js --reporter mocha-multi-reporters --reporter-options configFile=reporter-config.json --require test/hooks.js ${CI_SHARED_METRICS_TEST_FILES}; fi",
29
+ "test": "mocha --config=test/.mocharc.js --require test/hooks.js --sort $(find test -iname '*test.js')",
30
+ "test:ci": "mocha --config=test/.mocharc.js --reporter mocha-multi-reporters --reporter-options configFile=reporter-config.json --require test/hooks.js 'test/**/*test.js'",
31
31
  "test:debug": "WITH_STDOUT=true npm run test",
32
32
  "lint": "eslint src test",
33
33
  "verify": "npm run lint && npm test",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "license": "MIT",
61
61
  "dependencies": {
62
- "@instana/core": "3.1.2",
62
+ "@instana/core": "3.2.0",
63
63
  "detect-libc": "^2.0.2",
64
64
  "event-loop-lag": "^1.4.0",
65
65
  "recursive-copy": "^2.0.13",
@@ -73,5 +73,5 @@
73
73
  "event-loop-stats": "1.4.1",
74
74
  "gcstats.js": "1.0.0"
75
75
  },
76
- "gitHead": "879f6328997177c1ce6da2bc24ba130b39c1c393"
76
+ "gitHead": "4e9af9e088ed97732fc93ac6157cfad90eb96fa2"
77
77
  }
@@ -29,7 +29,13 @@ const MAX_ATTEMPTS = 20;
29
29
  const DELAY = 1000;
30
30
  let attempts = 0;
31
31
 
32
+ exports.deactivate = function deactivate() {
33
+ attempts = 0;
34
+ };
35
+
32
36
  exports.activate = function activate() {
37
+ logger.debug(`activate ${attempts}`);
38
+
33
39
  attempts++;
34
40
  util.applicationUnderMonitoring.getMainPackageJsonPathStartingAtMainModule((err, packageJsonPath) => {
35
41
  if (err) {
@@ -54,6 +60,8 @@ exports.activate = function activate() {
54
60
  * @param {string} packageJsonPath
55
61
  */
56
62
  function addDirectDependenciesFromMainPackageJson(packageJsonPath) {
63
+ logger.debug(`addDirectDependenciesFromMainPackageJson: ${packageJsonPath}`);
64
+
57
65
  const started = Date.now();
58
66
  fs.readFile(packageJsonPath, { encoding: 'utf8' }, (err, contents) => {
59
67
  if (err) {
package/src/index.js CHANGED
@@ -13,7 +13,6 @@ const allMetrics = [
13
13
  require('./dependencies'),
14
14
  require('./directDependencies'),
15
15
  require('./description'),
16
- require('./directDependencies'),
17
16
  require('./execArgs'),
18
17
  require('./gc'),
19
18
  require('./healthchecks'),
@@ -16,7 +16,7 @@ let logger = Logger.getLogger('metrics');
16
16
  /**
17
17
  * @param {import('@instana/core/src/logger').GenericLogger} _logger
18
18
  */
19
- exports.setLogger = function setLogger(_logger) {
19
+ const setLogger = function (_logger) {
20
20
  logger = _logger;
21
21
  };
22
22
 
@@ -277,5 +277,6 @@ function searchInParentDir(dir, onParentDir, callback) {
277
277
  module.exports = {
278
278
  DependencyDistanceCalculator,
279
279
  MAX_DEPTH: 15,
280
- __moduleRefExportedForTest: module
280
+ __moduleRefExportedForTest: module,
281
+ setLogger
281
282
  };
package/src/util/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  'use strict';
7
7
 
8
8
  const nativeModuleRetry = require('./nativeModuleRetry');
9
+ const { setLogger: setLoggerForDependencyDistanceCalculator } = require('./DependencyDistanceCalculator');
9
10
  module.exports = {
10
11
  nativeModuleRetry,
11
12
  /**
@@ -13,5 +14,6 @@ module.exports = {
13
14
  */
14
15
  setLogger: function setLogger(logger) {
15
16
  nativeModuleRetry.setLogger(logger);
17
+ setLoggerForDependencyDistanceCalculator(logger);
16
18
  }
17
19
  };