@midwayjs/otel 3.19.2 → 4.0.0-alpha.1

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.
@@ -55,6 +55,7 @@ let OtelConfiguration = class OtelConfiguration {
55
55
  }
56
56
  }
57
57
  };
58
+ exports.OtelConfiguration = OtelConfiguration;
58
59
  __decorate([
59
60
  (0, core_1.Inject)(),
60
61
  __metadata("design:type", core_1.MidwayDecoratorService)
@@ -67,10 +68,9 @@ __decorate([
67
68
  (0, core_1.Inject)(),
68
69
  __metadata("design:type", core_1.MidwayApplicationManager)
69
70
  ], OtelConfiguration.prototype, "applicationManager", void 0);
70
- OtelConfiguration = __decorate([
71
+ exports.OtelConfiguration = OtelConfiguration = __decorate([
71
72
  (0, core_1.Configuration)({
72
73
  namespace: 'otel',
73
74
  })
74
75
  ], OtelConfiguration);
75
- exports.OtelConfiguration = OtelConfiguration;
76
76
  //# sourceMappingURL=configuration.js.map
@@ -4,7 +4,7 @@ exports.Trace = exports.TRACE_KEY = void 0;
4
4
  const core_1 = require("@midwayjs/core");
5
5
  exports.TRACE_KEY = 'decorator:open_telemetry_key';
6
6
  function Trace(spanName) {
7
- return (0, core_1.createCustomMethodDecorator)(exports.TRACE_KEY, {
7
+ return core_1.DecoratorManager.createCustomMethodDecorator(exports.TRACE_KEY, {
8
8
  spanName,
9
9
  });
10
10
  }
package/dist/service.js CHANGED
@@ -14,15 +14,13 @@ const core_1 = require("@midwayjs/core");
14
14
  const api_1 = require("@opentelemetry/api");
15
15
  let TraceService = class TraceService {
16
16
  async init() {
17
- var _a;
18
- this.currentTracerName = (_a = this.app.getProjectName()) !== null && _a !== void 0 ? _a : 'unknown_project';
17
+ this.currentTracerName = this.app.getProjectName() ?? 'unknown_project';
19
18
  }
20
19
  getCurrentSpan() {
21
20
  return api_1.trace.getSpan(api_1.context.active());
22
21
  }
23
22
  getTraceId() {
24
- var _a;
25
- return (_a = this.getCurrentSpan()) === null || _a === void 0 ? void 0 : _a.spanContext().traceId;
23
+ return this.getCurrentSpan()?.spanContext().traceId;
26
24
  }
27
25
  createSpan(name, callback) {
28
26
  return api_1.trace.getTracer(this.currentTracerName).startActiveSpan(name, {
@@ -30,8 +28,9 @@ let TraceService = class TraceService {
30
28
  }, callback);
31
29
  }
32
30
  };
31
+ exports.TraceService = TraceService;
33
32
  __decorate([
34
- (0, core_1.App)(),
33
+ (0, core_1.MainApp)(),
35
34
  __metadata("design:type", Object)
36
35
  ], TraceService.prototype, "app", void 0);
37
36
  __decorate([
@@ -40,9 +39,8 @@ __decorate([
40
39
  __metadata("design:paramtypes", []),
41
40
  __metadata("design:returntype", Promise)
42
41
  ], TraceService.prototype, "init", null);
43
- TraceService = __decorate([
42
+ exports.TraceService = TraceService = __decorate([
44
43
  (0, core_1.Provide)(),
45
44
  (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
46
45
  ], TraceService);
47
- exports.TraceService = TraceService;
48
46
  //# sourceMappingURL=service.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/otel",
3
3
  "description": "midway open telemetry component",
4
- "version": "3.19.2",
4
+ "version": "4.0.0-alpha.1",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -10,10 +10,12 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "devDependencies": {
13
- "@midwayjs/core": "^3.19.0",
14
- "@midwayjs/koa": "^3.19.2",
15
- "@midwayjs/mock": "^3.19.2",
16
- "@opentelemetry/sdk-node": "0.56.0"
13
+ "@midwayjs/core": "^4.0.0-alpha.1",
14
+ "@midwayjs/koa": "^4.0.0-alpha.1",
15
+ "@midwayjs/mock": "^4.0.0-alpha.1",
16
+ "@opentelemetry/sdk-node": "0.56.0",
17
+ "@opentelemetry/sdk-trace-base": "1.26.0",
18
+ "@opentelemetry/sdk-trace-node": "1.26.0"
17
19
  },
18
20
  "dependencies": {
19
21
  "@opentelemetry/api": "1.9.0"
@@ -27,8 +29,8 @@
27
29
  "license": "MIT",
28
30
  "scripts": {
29
31
  "build": "tsc",
30
- "test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
31
- "cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
32
+ "test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
33
+ "cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
32
34
  "ci": "npm run test",
33
35
  "lint": "mwts check"
34
36
  },
@@ -39,5 +41,5 @@
39
41
  "type": "git",
40
42
  "url": "https://github.com/midwayjs/midway.git"
41
43
  },
42
- "gitHead": "57fd034be94897fb819b0d9ef776de0b9923ab0f"
44
+ "gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
43
45
  }