@instana/shared-metrics 3.15.0 → 3.15.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,16 @@
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.15.2](https://github.com/instana/nodejs/compare/v3.15.1...v3.15.2) (2024-08-27)
7
+
8
+ **Note:** Version bump only for package @instana/shared-metrics
9
+
10
+ ## [3.15.1](https://github.com/instana/nodejs/compare/v3.15.0...v3.15.1) (2024-08-19)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **shared-metrics:** removed recursive-copy dependency ([#1265](https://github.com/instana/nodejs/issues/1265)) ([63e67f1](https://github.com/instana/nodejs/commit/63e67f17d0b3025a5b671c2a4ba7f37e163a9649))
15
+
6
16
  # [3.15.0](https://github.com/instana/nodejs/compare/v3.14.4...v3.15.0) (2024-08-13)
7
17
 
8
18
  **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.15.0",
3
+ "version": "3.15.2",
4
4
  "description": "Internal metrics plug-in package for Node.js monitoring with Instana",
5
5
  "author": {
6
6
  "name": "Bastian Krol",
@@ -59,19 +59,20 @@
59
59
  },
60
60
  "license": "MIT",
61
61
  "dependencies": {
62
- "@instana/core": "3.15.0",
62
+ "@instana/core": "3.15.2",
63
63
  "detect-libc": "^2.0.2",
64
64
  "event-loop-lag": "^1.4.0",
65
- "recursive-copy": "^2.0.13",
65
+ "fs-extra": "^11.2.0",
66
66
  "semver": "^7.5.4",
67
67
  "tar": "^6.2.1"
68
68
  },
69
69
  "devDependencies": {
70
+ "@types/fs-extra": "^11.0.4",
70
71
  "@types/tar": "^6.1.6"
71
72
  },
72
73
  "optionalDependencies": {
73
74
  "event-loop-stats": "1.4.1",
74
75
  "gcstats.js": "1.0.0"
75
76
  },
76
- "gitHead": "afbe2f4ac0d9017f9ff6031507f479f14fdd1fb5"
77
+ "gitHead": "654046cc3111e0ee43d4d32dfb70b76478d0d99c"
77
78
  }
@@ -9,11 +9,11 @@ const { logger: Logger, uninstrumentedFs: fs } = require('@instana/core');
9
9
  let logger = Logger.getLogger('shared-metrics/native-module-retry');
10
10
 
11
11
  const EventEmitter = require('events');
12
- const copy = require('recursive-copy');
13
12
  const os = require('os');
14
13
  const tar = require('tar');
15
14
  const path = require('path');
16
15
  const detectLibc = require('detect-libc');
16
+ const fse = require('fs-extra');
17
17
 
18
18
  /**
19
19
  * @typedef {Object} InstanaSharedMetricsOptions
@@ -183,23 +183,14 @@ function copyPrecompiled(opts, loaderEmitter, callback) {
183
183
  .then(() => {
184
184
  // See below for the reason why we append 'precompiled' to the path.
185
185
  const targetDir = path.join(opts.nativeModulePath, 'precompiled');
186
+ const sourceDir = path.join(os.tmpdir(), opts.nativeModuleName);
187
+ logger.debug(
188
+ `Copying the precompiled build for ${opts.nativeModuleName} ${label} from ${sourceDir} to ${targetDir}.`
189
+ );
186
190
 
187
- // @ts-ignore
188
- copy(
189
- path.join(os.tmpdir(), opts.nativeModuleName),
190
- targetDir,
191
- {
192
- overwrite: true,
193
- dot: true
194
- },
195
- // @ts-ignore
196
- cpErr => {
197
- if (cpErr) {
198
- logger.warn(`Copying the precompiled build for ${opts.nativeModuleName} ${label} failed.`, cpErr);
199
- callback(false);
200
- return;
201
- }
202
-
191
+ fse
192
+ .copy(sourceDir, targetDir)
193
+ .then(() => {
203
194
  // We have unpacked and copied the correct precompiled native addon. The next attempt to require the
204
195
  // dependency should work.
205
196
  //
@@ -211,10 +202,14 @@ function copyPrecompiled(opts, loaderEmitter, callback) {
211
202
  // it will remember and not try to load anything from that path again (a `false` will be
212
203
  // put into the cache for that cache key). Instead, we force a new path, by adding precompiled
213
204
  // to the module path and use the absolute path to the module to load it.
205
+ logger.debug(`Successfully copied the precompiled build for ${opts.nativeModuleName} ${label}.`);
214
206
  opts.loadFrom = targetDir;
215
207
  callback(true);
216
- }
217
- );
208
+ })
209
+ .catch(error => {
210
+ logger.warn(`Copying the precompiled build for ${opts.nativeModuleName} ${label} failed.`, error);
211
+ callback(false);
212
+ });
218
213
  })
219
214
  .catch(tarErr => {
220
215
  logger.warn(`Unpacking the precompiled build for ${opts.nativeModuleName} ${label} failed.`, tarErr);