@tramvai/module-opentelemetry 5.16.2 → 5.17.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.
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandLineRunnerPlugin } from '@tramvai/core';
|
|
2
|
+
export declare const providers: import("@tinkoff/dippy").Provider<{
|
|
3
|
+
tracer: import("../tokens").TramvaiTracer & {
|
|
4
|
+
__type?: "base token" | undefined;
|
|
5
|
+
};
|
|
6
|
+
}, CommandLineRunnerPlugin & {
|
|
7
|
+
__type?: "multi token" | undefined;
|
|
8
|
+
}>[];
|
|
9
|
+
//# sourceMappingURL=commandLineRunner.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { provide } from '@tinkoff/dippy';
|
|
2
|
+
import { COMMAND_LINE_RUNNER_PLUGIN } from '@tramvai/core';
|
|
3
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
4
|
+
import { OPENTELEMETRY_TRACER_TOKEN } from '../tokens.es.js';
|
|
5
|
+
|
|
6
|
+
class CommandLineRunnerOpenTelemetryPlugin {
|
|
7
|
+
constructor({ tracer }) {
|
|
8
|
+
this.tracer = tracer;
|
|
9
|
+
}
|
|
10
|
+
apply(commandLineRunner) {
|
|
11
|
+
commandLineRunner.runLineHook.wrap(async (_, { env, line, di, key }, next) => {
|
|
12
|
+
return this.tracer.trace(`line ${line}`, { kind: SpanKind.SERVER }, (span) => {
|
|
13
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
14
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
15
|
+
return next({ env, line, di, key });
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
commandLineRunner.runCommandHook.wrap(async (_, { env, line, di, command }, next) => {
|
|
19
|
+
const commandName = command.toString();
|
|
20
|
+
return this.tracer.trace(`command ${commandName}`, { kind: SpanKind.SERVER }, async (span) => {
|
|
21
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
22
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
23
|
+
span.setAttribute('tramvai.command_line_runner.command', commandName);
|
|
24
|
+
return next({ env, line, di, command });
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
commandLineRunner.runCommandFnHook.wrap(async (_, { fn, line, di, command }, next) => {
|
|
28
|
+
const commandName = command.toString();
|
|
29
|
+
return this.tracer.trace(`${commandName} fn`, { kind: SpanKind.SERVER }, async (span) => {
|
|
30
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
31
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
32
|
+
span.setAttribute('tramvai.command_line_runner.command', commandName);
|
|
33
|
+
span.setAttribute('tramvai.command_line_runner.fn', fn.name ?? 'unknown');
|
|
34
|
+
return next({ fn, line, di, command });
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const providers = [
|
|
40
|
+
provide({
|
|
41
|
+
provide: COMMAND_LINE_RUNNER_PLUGIN,
|
|
42
|
+
useClass: CommandLineRunnerOpenTelemetryPlugin,
|
|
43
|
+
deps: {
|
|
44
|
+
tracer: OPENTELEMETRY_TRACER_TOKEN,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
export { providers };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dippy = require('@tinkoff/dippy');
|
|
6
|
+
var core = require('@tramvai/core');
|
|
7
|
+
var api = require('@opentelemetry/api');
|
|
8
|
+
var tokens = require('../tokens.js');
|
|
9
|
+
|
|
10
|
+
class CommandLineRunnerOpenTelemetryPlugin {
|
|
11
|
+
constructor({ tracer }) {
|
|
12
|
+
this.tracer = tracer;
|
|
13
|
+
}
|
|
14
|
+
apply(commandLineRunner) {
|
|
15
|
+
commandLineRunner.runLineHook.wrap(async (_, { env, line, di, key }, next) => {
|
|
16
|
+
return this.tracer.trace(`line ${line}`, { kind: api.SpanKind.SERVER }, (span) => {
|
|
17
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
18
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
19
|
+
return next({ env, line, di, key });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
commandLineRunner.runCommandHook.wrap(async (_, { env, line, di, command }, next) => {
|
|
23
|
+
const commandName = command.toString();
|
|
24
|
+
return this.tracer.trace(`command ${commandName}`, { kind: api.SpanKind.SERVER }, async (span) => {
|
|
25
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
26
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
27
|
+
span.setAttribute('tramvai.command_line_runner.command', commandName);
|
|
28
|
+
return next({ env, line, di, command });
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
commandLineRunner.runCommandFnHook.wrap(async (_, { fn, line, di, command }, next) => {
|
|
32
|
+
const commandName = command.toString();
|
|
33
|
+
return this.tracer.trace(`${commandName} fn`, { kind: api.SpanKind.SERVER }, async (span) => {
|
|
34
|
+
span.setAttribute('tramvai.scope', 'command_line_runner');
|
|
35
|
+
span.setAttribute('tramvai.command_line_runner.line', line);
|
|
36
|
+
span.setAttribute('tramvai.command_line_runner.command', commandName);
|
|
37
|
+
span.setAttribute('tramvai.command_line_runner.fn', fn.name ?? 'unknown');
|
|
38
|
+
return next({ fn, line, di, command });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const providers = [
|
|
44
|
+
dippy.provide({
|
|
45
|
+
provide: core.COMMAND_LINE_RUNNER_PLUGIN,
|
|
46
|
+
useClass: CommandLineRunnerOpenTelemetryPlugin,
|
|
47
|
+
deps: {
|
|
48
|
+
tracer: tokens.OPENTELEMETRY_TRACER_TOKEN,
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
exports.providers = providers;
|
package/lib/server.es.js
CHANGED
|
@@ -10,6 +10,7 @@ import { TramvaiTracerImpl } from './tracer/tracer.es.js';
|
|
|
10
10
|
import { providers } from './instrumentation/server.es.js';
|
|
11
11
|
import { providers as providers$1 } from './instrumentation/httpClient.es.js';
|
|
12
12
|
import { providers as providers$2 } from './instrumentation/logs.es.js';
|
|
13
|
+
import { providers as providers$3 } from './instrumentation/commandLineRunner.es.js';
|
|
13
14
|
|
|
14
15
|
let OpenTelemetryModule = class OpenTelemetryModule {
|
|
15
16
|
};
|
|
@@ -20,6 +21,7 @@ OpenTelemetryModule = __decorate([
|
|
|
20
21
|
...providers,
|
|
21
22
|
...providers$1,
|
|
22
23
|
...providers$2,
|
|
24
|
+
...providers$3,
|
|
23
25
|
provide({
|
|
24
26
|
provide: commandLineListTokens.init,
|
|
25
27
|
useFactory: ({ provider }) => {
|
package/lib/server.js
CHANGED
|
@@ -13,6 +13,7 @@ var tracer = require('./tracer/tracer.js');
|
|
|
13
13
|
var server = require('./instrumentation/server.js');
|
|
14
14
|
var httpClient = require('./instrumentation/httpClient.js');
|
|
15
15
|
var logs = require('./instrumentation/logs.js');
|
|
16
|
+
var commandLineRunner = require('./instrumentation/commandLineRunner.js');
|
|
16
17
|
|
|
17
18
|
exports.OpenTelemetryModule = class OpenTelemetryModule {
|
|
18
19
|
};
|
|
@@ -23,6 +24,7 @@ exports.OpenTelemetryModule = tslib.__decorate([
|
|
|
23
24
|
...server.providers,
|
|
24
25
|
...httpClient.providers,
|
|
25
26
|
...logs.providers,
|
|
27
|
+
...commandLineRunner.providers,
|
|
26
28
|
core.provide({
|
|
27
29
|
provide: core.commandLineListTokens.init,
|
|
28
30
|
useFactory: ({ provider }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-opentelemetry",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.17.0",
|
|
4
4
|
"description": "Интеграция OpenTelemetry",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"@opentelemetry/sdk-trace-node": "^1.28.0",
|
|
29
29
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
30
30
|
"path-to-regexp": "0.1.7",
|
|
31
|
-
"@tramvai/tokens-common": "5.
|
|
32
|
-
"@tramvai/tokens-metrics": "5.
|
|
33
|
-
"@tramvai/tokens-http-client": "5.
|
|
34
|
-
"@tramvai/tokens-server": "5.
|
|
35
|
-
"@tramvai/tokens-server-private": "5.
|
|
31
|
+
"@tramvai/tokens-common": "5.17.0",
|
|
32
|
+
"@tramvai/tokens-metrics": "5.17.0",
|
|
33
|
+
"@tramvai/tokens-http-client": "5.17.0",
|
|
34
|
+
"@tramvai/tokens-server": "5.17.0",
|
|
35
|
+
"@tramvai/tokens-server-private": "5.17.0",
|
|
36
36
|
"@tinkoff/utils": "^2.1.2",
|
|
37
37
|
"@tinkoff/errors": "0.6.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@tinkoff/dippy": "0.11.3",
|
|
42
|
-
"@tramvai/core": "5.
|
|
42
|
+
"@tramvai/core": "5.17.0",
|
|
43
43
|
"tslib": "^2.4.0"
|
|
44
44
|
}
|
|
45
45
|
}
|