@boxyhq/metrics 0.2.0 → 0.2.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.
@@ -19,7 +19,7 @@ const timer_1 = require("./timer");
19
19
  */
20
20
  function instrument({ meter, name, delegate, instrumentAttributes }) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
- const start = process.hrtime();
22
+ const start = process.hrtime.bigint();
23
23
  try {
24
24
  return yield delegate();
25
25
  }
@@ -32,12 +32,12 @@ function instrument({ meter, name, delegate, instrumentAttributes }) {
32
32
  throw err;
33
33
  }
34
34
  finally {
35
- const elapsed = process.hrtime(start);
36
- const elapsedNanos = elapsed[0] * 1000000000 + elapsed[1];
35
+ const end = process.hrtime.bigint();
36
+ const elapsedNanos = end - start;
37
37
  (0, timer_1.recordTimer)({
38
38
  meter,
39
39
  name: 'function.executionTime',
40
- val: elapsedNanos,
40
+ val: Number(elapsedNanos) /** convert bigint to number */,
41
41
  timerAttributes: Object.assign({ function: name }, instrumentAttributes),
42
42
  });
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/metrics",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Internal SDK for OTel instrumentation",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@tsconfig/recommended": "1.0.2",
38
- "@typescript-eslint/eslint-plugin": "5.57.1",
39
- "@typescript-eslint/parser": "5.57.1",
38
+ "@typescript-eslint/eslint-plugin": "5.58.0",
39
+ "@typescript-eslint/parser": "5.58.0",
40
40
  "eslint": "8.38.0",
41
41
  "eslint-config-prettier": "8.8.0",
42
42
  "prettier": "2.8.7",