@pocket-tools/tracing 1.6.0 → 1.6.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.
- package/.turbo/turbo-semantic-release.log +66 -69
- package/README.md +1 -1
- package/dist/index.d.mts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +145 -47
- package/dist/index.mjs +156 -53
- package/package.json +10 -5
- package/.turbo/turbo-build.log +0 -20
|
@@ -14,79 +14,76 @@
|
|
|
14
14
|
[34mESM[39m Build start
|
|
15
15
|
[33mCJS[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m
|
|
16
16
|
[33mESM[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
19
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
20
|
-
[32mCJS[39m ⚡️ Build success in
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m7.79 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 197ms
|
|
19
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.35 KB[39m
|
|
20
|
+
[32mCJS[39m ⚡️ Build success in 199ms
|
|
21
21
|
[34mDTS[39m Build start
|
|
22
|
-
[32mDTS[39m ⚡️ Build success in
|
|
23
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
24
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
+
[32mDTS[39m ⚡️ Build success in 7190ms
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.41 KB[39m
|
|
24
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.41 KB[39m
|
|
25
25
|
|
|
26
26
|
> @pocket-tools/tracing@0.0.0-development semantic-release /home/runner/work/pocket-monorepo/pocket-monorepo/packages/tracing
|
|
27
27
|
> semantic-release
|
|
28
28
|
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
29
|
+
[7:25:34 PM] [semantic-release] › ℹ Running semantic-release version 24.1.0
|
|
30
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
|
|
31
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
|
|
32
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
|
|
33
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
|
|
34
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
|
|
35
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
|
|
36
|
+
[7:25:36 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
|
|
37
|
+
[7:25:39 PM] [semantic-release] › ✔ Run automated release from branch main on repository git+https://github.com/Pocket/pocket-monorepo.git
|
|
38
|
+
[7:25:39 PM] [semantic-release] › ✔ Allowed to push to the Git repository
|
|
39
|
+
[7:25:39 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
|
|
40
|
+
[7:25:39 PM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
|
|
41
|
+
[7:25:39 PM] [semantic-release] [@semantic-release/npm] › ℹ Wrote NPM_TOKEN to /tmp/cb2d65bae8b2278cca2c9045e6c89137/.npmrc
|
|
42
42
|
pocket-npm
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
43
|
+
[7:25:40 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
|
|
44
|
+
[7:25:40 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
|
|
45
|
+
[7:25:40 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
|
|
46
|
+
[7:25:40 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
|
|
47
|
+
[7:25:40 PM] [semantic-release] › ℹ Found git tag @pocket-tools/tracing-v1.6.0 associated with version 1.6.0 on branch main
|
|
48
|
+
[7:25:41 PM] [semantic-release] › ℹ Found 1 commits since last release
|
|
49
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
50
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
51
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Found 1 commits for package @pocket-tools/tracing since last release
|
|
52
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: Revert "feat(otel): adding in basic tracing via otel (#798)" (#799)
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[6:51:36 PM] [semantic-release] › ℹ The next release version is 1.6.0
|
|
91
|
-
[6:51:36 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
|
|
92
|
-
[6:51:36 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/commit-analyzer" does not provide step "generateNotes"
|
|
54
|
+
This reverts commit dbbe47179f7ed36c12fe9c1a76c72b93a4eb8af5.
|
|
55
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The release type for the commit is patch
|
|
56
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analysis of 1 commits complete: patch release
|
|
57
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
58
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
59
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
60
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/release-notes-generator" does not provide step "analyzeCommits"
|
|
61
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
62
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
63
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/npm" does not provide step "analyzeCommits"
|
|
64
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
65
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
66
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/github" does not provide step "analyzeCommits"
|
|
67
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
68
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
69
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
70
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
71
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
72
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
73
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
74
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
75
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
76
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
77
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
78
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
79
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
80
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
81
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
82
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
83
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
84
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
85
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
86
|
+
[7:25:41 PM] [semantic-release] › ℹ The next release version is 1.6.1
|
|
87
|
+
[7:25:41 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
|
|
88
|
+
[7:25:41 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/commit-analyzer" does not provide step "generateNotes"
|
|
89
|
+
[7:25:41 PM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
|
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BatchSpanProcessor, ParentBasedSampler, SpanExporter, BufferConfig, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { DiagLogger, Context } from '@opentelemetry/api';
|
|
3
|
+
import { SentrySpanProcessor, SentrySampler } from '@sentry/opentelemetry';
|
|
3
4
|
|
|
4
5
|
declare enum AdditionalInstrumentation {
|
|
5
6
|
KNEX = "KNEX",
|
|
@@ -14,9 +15,23 @@ type TracingConfig = {
|
|
|
14
15
|
httpDefaultPort?: number;
|
|
15
16
|
host?: string;
|
|
16
17
|
logger?: DiagLogger;
|
|
17
|
-
|
|
18
|
+
addSentry?: boolean;
|
|
18
19
|
additionalInstrumentations?: AdditionalInstrumentation[];
|
|
19
20
|
};
|
|
20
21
|
declare function nodeSDKBuilder(config: TracingConfig): Promise<void>;
|
|
22
|
+
declare class CustomAWSXraySpanProcessor extends BatchSpanProcessor {
|
|
23
|
+
sampler: ParentBasedSampler;
|
|
24
|
+
contextMap: Map<string, Context>;
|
|
25
|
+
constructor(_exporter: SpanExporter, ratio: number, config: BufferConfig);
|
|
26
|
+
onStart(span: Span, parentContext: Context): void;
|
|
27
|
+
onEnd(span: ReadableSpan): void;
|
|
28
|
+
}
|
|
29
|
+
declare class CustomSentrySpanProcessor extends SentrySpanProcessor {
|
|
30
|
+
sampler: SentrySampler;
|
|
31
|
+
contextMap: Map<string, Context>;
|
|
32
|
+
constructor();
|
|
33
|
+
onStart(span: Span, parentContext: Context): void;
|
|
34
|
+
onEnd(span: Span & ReadableSpan): void;
|
|
35
|
+
}
|
|
21
36
|
|
|
22
|
-
export { AdditionalInstrumentation, type TracingConfig, nodeSDKBuilder };
|
|
37
|
+
export { AdditionalInstrumentation, CustomAWSXraySpanProcessor, CustomSentrySpanProcessor, type TracingConfig, nodeSDKBuilder };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BatchSpanProcessor, ParentBasedSampler, SpanExporter, BufferConfig, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { DiagLogger, Context } from '@opentelemetry/api';
|
|
3
|
+
import { SentrySpanProcessor, SentrySampler } from '@sentry/opentelemetry';
|
|
3
4
|
|
|
4
5
|
declare enum AdditionalInstrumentation {
|
|
5
6
|
KNEX = "KNEX",
|
|
@@ -14,9 +15,23 @@ type TracingConfig = {
|
|
|
14
15
|
httpDefaultPort?: number;
|
|
15
16
|
host?: string;
|
|
16
17
|
logger?: DiagLogger;
|
|
17
|
-
|
|
18
|
+
addSentry?: boolean;
|
|
18
19
|
additionalInstrumentations?: AdditionalInstrumentation[];
|
|
19
20
|
};
|
|
20
21
|
declare function nodeSDKBuilder(config: TracingConfig): Promise<void>;
|
|
22
|
+
declare class CustomAWSXraySpanProcessor extends BatchSpanProcessor {
|
|
23
|
+
sampler: ParentBasedSampler;
|
|
24
|
+
contextMap: Map<string, Context>;
|
|
25
|
+
constructor(_exporter: SpanExporter, ratio: number, config: BufferConfig);
|
|
26
|
+
onStart(span: Span, parentContext: Context): void;
|
|
27
|
+
onEnd(span: ReadableSpan): void;
|
|
28
|
+
}
|
|
29
|
+
declare class CustomSentrySpanProcessor extends SentrySpanProcessor {
|
|
30
|
+
sampler: SentrySampler;
|
|
31
|
+
contextMap: Map<string, Context>;
|
|
32
|
+
constructor();
|
|
33
|
+
onStart(span: Span, parentContext: Context): void;
|
|
34
|
+
onEnd(span: Span & ReadableSpan): void;
|
|
35
|
+
}
|
|
21
36
|
|
|
22
|
-
export { AdditionalInstrumentation, type TracingConfig, nodeSDKBuilder };
|
|
37
|
+
export { AdditionalInstrumentation, CustomAWSXraySpanProcessor, CustomSentrySpanProcessor, type TracingConfig, nodeSDKBuilder };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var src_exports = {};
|
|
31
31
|
__export(src_exports, {
|
|
32
32
|
AdditionalInstrumentation: () => AdditionalInstrumentation,
|
|
33
|
+
CustomAWSXraySpanProcessor: () => CustomAWSXraySpanProcessor,
|
|
34
|
+
CustomSentrySpanProcessor: () => CustomSentrySpanProcessor,
|
|
33
35
|
nodeSDKBuilder: () => nodeSDKBuilder
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -37,19 +39,28 @@ module.exports = __toCommonJS(src_exports);
|
|
|
37
39
|
// src/tracing.ts
|
|
38
40
|
var import_process = __toESM(require("process"));
|
|
39
41
|
var import_sdk_node = require("@opentelemetry/sdk-node");
|
|
42
|
+
var import_core = require("@opentelemetry/core");
|
|
43
|
+
var import_instrumentation_graphql = require("@opentelemetry/instrumentation-graphql");
|
|
44
|
+
var import_instrumentation_aws_sdk = require("@opentelemetry/instrumentation-aws-sdk");
|
|
45
|
+
var import_id_generator_aws_xray = require("@opentelemetry/id-generator-aws-xray");
|
|
46
|
+
var import_propagator_aws_xray = require("@opentelemetry/propagator-aws-xray");
|
|
47
|
+
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
48
|
+
var import_instrumentation_dataloader = require("@opentelemetry/instrumentation-dataloader");
|
|
40
49
|
var import_api = require("@opentelemetry/api");
|
|
50
|
+
var import_instrumentation_express = require("@opentelemetry/instrumentation-express");
|
|
51
|
+
var import_instrumentation_http = require("@opentelemetry/instrumentation-http");
|
|
41
52
|
var import_instrumentation_knex = require("@opentelemetry/instrumentation-knex");
|
|
53
|
+
var import_instrumentation_mysql2 = require("@opentelemetry/instrumentation-mysql2");
|
|
54
|
+
var import_instrumentation_net = require("@opentelemetry/instrumentation-net");
|
|
42
55
|
var import_exporter_trace_otlp_grpc = require("@opentelemetry/exporter-trace-otlp-grpc");
|
|
43
56
|
var import_instrumentation = require("@prisma/instrumentation");
|
|
44
57
|
var import_resources = require("@opentelemetry/resources");
|
|
45
58
|
var import_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
59
|
+
var import_ExpressLayerType = require("@opentelemetry/instrumentation-express/build/src/enums/ExpressLayerType");
|
|
46
60
|
var import_opentelemetry = require("@sentry/opentelemetry");
|
|
47
|
-
var
|
|
61
|
+
var import_context_async_hooks = require("@opentelemetry/context-async-hooks");
|
|
48
62
|
var import_resources2 = require("@opentelemetry/resources");
|
|
49
63
|
var Sentry = __toESM(require("@sentry/node"));
|
|
50
|
-
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
51
|
-
var import_propagator_aws_xray = require("@opentelemetry/propagator-aws-xray");
|
|
52
|
-
var import_id_generator_aws_xray = require("@opentelemetry/id-generator-aws-xray");
|
|
53
64
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
54
65
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
55
66
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -59,17 +70,9 @@ var additionalInstrumentationConstructors = {
|
|
|
59
70
|
KNEX: import_instrumentation_knex.KnexInstrumentation,
|
|
60
71
|
PRISMA: import_instrumentation.PrismaInstrumentation
|
|
61
72
|
};
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
sentry: void 0,
|
|
66
|
-
graphQLDepth: 8,
|
|
67
|
-
grpcDefaultPort: 4317,
|
|
68
|
-
httpDefaultPort: 4318,
|
|
69
|
-
host: "localhost",
|
|
70
|
-
logger: new import_api.DiagConsoleLogger(),
|
|
71
|
-
additionalInstrumentations: []
|
|
72
|
-
};
|
|
73
|
+
var SentryContextManager = (0, import_opentelemetry.wrapContextManagerClass)(
|
|
74
|
+
import_context_async_hooks.AsyncLocalStorageContextManager
|
|
75
|
+
);
|
|
73
76
|
function awaitAttributes(detector) {
|
|
74
77
|
return {
|
|
75
78
|
/**
|
|
@@ -84,56 +87,68 @@ function awaitAttributes(detector) {
|
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
async function nodeSDKBuilder(config) {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
config = { ...tracingDefaults, ...config };
|
|
90
|
+
var _a, _b, _c;
|
|
89
91
|
import_api.diag.setLogger((_a = config.logger) != null ? _a : new import_api.DiagConsoleLogger(), import_api.DiagLogLevel.WARN);
|
|
90
92
|
const _resource = import_resources.Resource.default().merge(
|
|
91
93
|
new import_resources.Resource({
|
|
92
|
-
[import_semantic_conventions.
|
|
93
|
-
[import_semantic_conventions.
|
|
94
|
+
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: config.serviceName,
|
|
95
|
+
[import_semantic_conventions.SEMRESATTRS_SERVICE_VERSION]: config.release
|
|
94
96
|
})
|
|
95
97
|
);
|
|
96
98
|
const _traceExporter = new import_exporter_trace_otlp_grpc.OTLPTraceExporter({
|
|
97
99
|
//collector url
|
|
98
100
|
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
99
101
|
});
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
requestHeaders: [
|
|
109
|
-
"sentry-trace",
|
|
110
|
-
"baggage",
|
|
111
|
-
"x-amzn-trace-id",
|
|
112
|
-
"encodedid",
|
|
113
|
-
"applicationname"
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"@opentelemetry/instrumentation-http": {
|
|
118
|
-
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
102
|
+
const _spanProcessors = [
|
|
103
|
+
new CustomAWSXraySpanProcessor(
|
|
104
|
+
_traceExporter,
|
|
105
|
+
(_b = config.samplingRatio) != null ? _b : 0.01,
|
|
106
|
+
{
|
|
107
|
+
// only force 100ms between 2 batch exports.
|
|
108
|
+
// Default is 5000ms which is 5 seconds and causes us to lose spans
|
|
109
|
+
scheduledDelayMillis: 100
|
|
119
110
|
}
|
|
120
|
-
|
|
111
|
+
)
|
|
112
|
+
];
|
|
113
|
+
if (config.addSentry) {
|
|
114
|
+
_spanProcessors.push(new CustomSentrySpanProcessor());
|
|
115
|
+
}
|
|
116
|
+
const _idGenerator = new import_id_generator_aws_xray.AWSXRayIdGenerator();
|
|
117
|
+
const instrumentations = [
|
|
118
|
+
new import_instrumentation_aws_sdk.AwsInstrumentation({
|
|
119
|
+
suppressInternalInstrumentation: true
|
|
120
|
+
}),
|
|
121
|
+
new import_instrumentation_dataloader.DataloaderInstrumentation({}),
|
|
122
|
+
new import_instrumentation_express.ExpressInstrumentation({
|
|
123
|
+
ignoreLayersType: [import_ExpressLayerType.ExpressLayerType.MIDDLEWARE]
|
|
124
|
+
}),
|
|
125
|
+
new import_instrumentation_graphql.GraphQLInstrumentation({
|
|
126
|
+
// optional params
|
|
127
|
+
depth: config.graphQLDepth,
|
|
128
|
+
//query depth
|
|
129
|
+
allowValues: true
|
|
130
|
+
}),
|
|
131
|
+
new import_instrumentation_http.HttpInstrumentation({
|
|
132
|
+
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
133
|
+
}),
|
|
134
|
+
new import_instrumentation_mysql2.MySQL2Instrumentation({}),
|
|
135
|
+
new import_instrumentation_net.NetInstrumentation({})
|
|
121
136
|
];
|
|
122
|
-
((
|
|
137
|
+
((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
|
|
123
138
|
instrumentations.push(
|
|
124
139
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
125
140
|
);
|
|
126
141
|
});
|
|
127
142
|
const sdk = new import_sdk_node.NodeSDK({
|
|
128
|
-
textMapPropagator: new
|
|
143
|
+
textMapPropagator: config.addSentry ? new import_core.CompositePropagator({
|
|
144
|
+
propagators: [new import_propagator_aws_xray.AWSXRayPropagator(), new import_opentelemetry.SentryPropagator()]
|
|
145
|
+
}) : new import_propagator_aws_xray.AWSXRayPropagator(),
|
|
129
146
|
instrumentations,
|
|
130
|
-
|
|
131
|
-
contextManager: new Sentry.SentryContextManager(),
|
|
147
|
+
contextManager: config.addSentry ? new SentryContextManager() : void 0,
|
|
132
148
|
resource: _resource,
|
|
133
|
-
|
|
134
|
-
spanProcessors: [new import_sdk_trace_base.BatchSpanProcessor(_traceExporter)],
|
|
149
|
+
spanProcessors: _spanProcessors,
|
|
135
150
|
traceExporter: _traceExporter,
|
|
136
|
-
|
|
151
|
+
idGenerator: _idGenerator,
|
|
137
152
|
// TODO: Remove after issue is fixed
|
|
138
153
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
139
154
|
resourceDetectors: [
|
|
@@ -144,15 +159,98 @@ async function nodeSDKBuilder(config) {
|
|
|
144
159
|
});
|
|
145
160
|
sdk.start();
|
|
146
161
|
import_api.diag.info("Tracer successfully started");
|
|
147
|
-
Sentry.validateOpenTelemetrySetup();
|
|
148
162
|
import_process.default.on("SIGTERM", () => {
|
|
149
163
|
sdk.shutdown().then(() => import_api.diag.info("Tracing and Metrics terminated")).catch(
|
|
150
164
|
(error) => import_api.diag.error("Error terminating tracing and metrics", error)
|
|
151
165
|
).finally(() => import_process.default.exit(0));
|
|
152
166
|
});
|
|
153
167
|
}
|
|
168
|
+
var CustomAWSXraySpanProcessor = class extends import_sdk_trace_base.BatchSpanProcessor {
|
|
169
|
+
constructor(_exporter, ratio, config) {
|
|
170
|
+
super(_exporter, config);
|
|
171
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
|
172
|
+
this.sampler = new import_sdk_trace_base.ParentBasedSampler({
|
|
173
|
+
root: new import_sdk_trace_base.TraceIdRatioBasedSampler(ratio)
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
onStart(span, parentContext) {
|
|
177
|
+
this.contextMap.set(span.spanContext().traceId, parentContext);
|
|
178
|
+
const sampleResult = this.sampler.shouldSample(
|
|
179
|
+
parentContext,
|
|
180
|
+
span.spanContext().traceId,
|
|
181
|
+
span.name,
|
|
182
|
+
span.kind,
|
|
183
|
+
span.attributes,
|
|
184
|
+
span.links
|
|
185
|
+
);
|
|
186
|
+
if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
|
|
187
|
+
super.onStart(span, parentContext);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
onEnd(span) {
|
|
191
|
+
const context = this.contextMap.get(span.spanContext().traceId);
|
|
192
|
+
if (context) {
|
|
193
|
+
const sampleResult = this.sampler.shouldSample(
|
|
194
|
+
context,
|
|
195
|
+
span.spanContext().traceId,
|
|
196
|
+
span.name,
|
|
197
|
+
span.kind,
|
|
198
|
+
span.attributes,
|
|
199
|
+
span.links
|
|
200
|
+
);
|
|
201
|
+
this.contextMap.delete(span.spanContext().traceId);
|
|
202
|
+
if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
|
|
203
|
+
super.onEnd(span);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var CustomSentrySpanProcessor = class extends import_opentelemetry.SentrySpanProcessor {
|
|
209
|
+
constructor() {
|
|
210
|
+
super();
|
|
211
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
|
212
|
+
const sentryClient = Sentry.getClient();
|
|
213
|
+
if (!sentryClient) {
|
|
214
|
+
throw new Error("Sentry client is not initialized");
|
|
215
|
+
}
|
|
216
|
+
this.sampler = new import_opentelemetry.SentrySampler(sentryClient);
|
|
217
|
+
}
|
|
218
|
+
onStart(span, parentContext) {
|
|
219
|
+
this.contextMap.set(span.spanContext().traceId, parentContext);
|
|
220
|
+
const sampleResult = this.sampler.shouldSample(
|
|
221
|
+
parentContext,
|
|
222
|
+
span.spanContext().traceId,
|
|
223
|
+
span.name,
|
|
224
|
+
span.kind,
|
|
225
|
+
span.attributes,
|
|
226
|
+
span.links
|
|
227
|
+
);
|
|
228
|
+
if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
|
|
229
|
+
super.onStart(span, parentContext);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
onEnd(span) {
|
|
233
|
+
const context = this.contextMap.get(span.spanContext().traceId);
|
|
234
|
+
if (context) {
|
|
235
|
+
const sampleResult = this.sampler.shouldSample(
|
|
236
|
+
context,
|
|
237
|
+
span.spanContext().traceId,
|
|
238
|
+
span.name,
|
|
239
|
+
span.kind,
|
|
240
|
+
span.attributes,
|
|
241
|
+
span.links
|
|
242
|
+
);
|
|
243
|
+
this.contextMap.delete(span.spanContext().traceId);
|
|
244
|
+
if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
|
|
245
|
+
super.onEnd(span);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
154
250
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
251
|
0 && (module.exports = {
|
|
156
252
|
AdditionalInstrumentation,
|
|
253
|
+
CustomAWSXraySpanProcessor,
|
|
254
|
+
CustomSentrySpanProcessor,
|
|
157
255
|
nodeSDKBuilder
|
|
158
256
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
// src/tracing.ts
|
|
2
2
|
import process from "process";
|
|
3
3
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
4
|
+
import { CompositePropagator } from "@opentelemetry/core";
|
|
5
|
+
import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql";
|
|
6
|
+
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
|
|
7
|
+
import { AWSXRayIdGenerator } from "@opentelemetry/id-generator-aws-xray";
|
|
8
|
+
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
|
|
9
|
+
import {
|
|
10
|
+
BatchSpanProcessor,
|
|
11
|
+
SamplingDecision,
|
|
12
|
+
TraceIdRatioBasedSampler,
|
|
13
|
+
ParentBasedSampler
|
|
14
|
+
} from "@opentelemetry/sdk-trace-base";
|
|
15
|
+
import { DataloaderInstrumentation } from "@opentelemetry/instrumentation-dataloader";
|
|
4
16
|
import {
|
|
5
17
|
DiagConsoleLogger,
|
|
6
18
|
DiagLogLevel,
|
|
7
19
|
diag
|
|
8
20
|
} from "@opentelemetry/api";
|
|
21
|
+
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
22
|
+
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
9
23
|
import { KnexInstrumentation } from "@opentelemetry/instrumentation-knex";
|
|
24
|
+
import { MySQL2Instrumentation } from "@opentelemetry/instrumentation-mysql2";
|
|
25
|
+
import { NetInstrumentation } from "@opentelemetry/instrumentation-net";
|
|
10
26
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
11
27
|
import { PrismaInstrumentation } from "@prisma/instrumentation";
|
|
12
28
|
import { Resource } from "@opentelemetry/resources";
|
|
13
29
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
SEMRESATTRS_SERVICE_NAME,
|
|
31
|
+
SEMRESATTRS_SERVICE_VERSION
|
|
16
32
|
} from "@opentelemetry/semantic-conventions";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
33
|
+
import { ExpressLayerType } from "@opentelemetry/instrumentation-express/build/src/enums/ExpressLayerType";
|
|
34
|
+
import {
|
|
35
|
+
SentrySpanProcessor,
|
|
36
|
+
SentryPropagator,
|
|
37
|
+
SentrySampler,
|
|
38
|
+
wrapContextManagerClass
|
|
39
|
+
} from "@sentry/opentelemetry";
|
|
40
|
+
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
|
|
19
41
|
import {
|
|
20
42
|
envDetectorSync,
|
|
21
43
|
hostDetectorSync,
|
|
22
44
|
processDetectorSync
|
|
23
45
|
} from "@opentelemetry/resources";
|
|
24
46
|
import * as Sentry from "@sentry/node";
|
|
25
|
-
import {
|
|
26
|
-
BatchSpanProcessor,
|
|
27
|
-
ParentBasedSampler
|
|
28
|
-
} from "@opentelemetry/sdk-trace-base";
|
|
29
|
-
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
|
|
30
|
-
import { AWSXRayIdGenerator } from "@opentelemetry/id-generator-aws-xray";
|
|
31
47
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
32
48
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
33
49
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -37,17 +53,9 @@ var additionalInstrumentationConstructors = {
|
|
|
37
53
|
KNEX: KnexInstrumentation,
|
|
38
54
|
PRISMA: PrismaInstrumentation
|
|
39
55
|
};
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sentry: void 0,
|
|
44
|
-
graphQLDepth: 8,
|
|
45
|
-
grpcDefaultPort: 4317,
|
|
46
|
-
httpDefaultPort: 4318,
|
|
47
|
-
host: "localhost",
|
|
48
|
-
logger: new DiagConsoleLogger(),
|
|
49
|
-
additionalInstrumentations: []
|
|
50
|
-
};
|
|
56
|
+
var SentryContextManager = wrapContextManagerClass(
|
|
57
|
+
AsyncLocalStorageContextManager
|
|
58
|
+
);
|
|
51
59
|
function awaitAttributes(detector) {
|
|
52
60
|
return {
|
|
53
61
|
/**
|
|
@@ -62,56 +70,68 @@ function awaitAttributes(detector) {
|
|
|
62
70
|
};
|
|
63
71
|
}
|
|
64
72
|
async function nodeSDKBuilder(config) {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
config = { ...tracingDefaults, ...config };
|
|
73
|
+
var _a, _b, _c;
|
|
67
74
|
diag.setLogger((_a = config.logger) != null ? _a : new DiagConsoleLogger(), DiagLogLevel.WARN);
|
|
68
75
|
const _resource = Resource.default().merge(
|
|
69
76
|
new Resource({
|
|
70
|
-
[
|
|
71
|
-
[
|
|
77
|
+
[SEMRESATTRS_SERVICE_NAME]: config.serviceName,
|
|
78
|
+
[SEMRESATTRS_SERVICE_VERSION]: config.release
|
|
72
79
|
})
|
|
73
80
|
);
|
|
74
81
|
const _traceExporter = new OTLPTraceExporter({
|
|
75
82
|
//collector url
|
|
76
83
|
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
77
84
|
});
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
requestHeaders: [
|
|
87
|
-
"sentry-trace",
|
|
88
|
-
"baggage",
|
|
89
|
-
"x-amzn-trace-id",
|
|
90
|
-
"encodedid",
|
|
91
|
-
"applicationname"
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"@opentelemetry/instrumentation-http": {
|
|
96
|
-
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
85
|
+
const _spanProcessors = [
|
|
86
|
+
new CustomAWSXraySpanProcessor(
|
|
87
|
+
_traceExporter,
|
|
88
|
+
(_b = config.samplingRatio) != null ? _b : 0.01,
|
|
89
|
+
{
|
|
90
|
+
// only force 100ms between 2 batch exports.
|
|
91
|
+
// Default is 5000ms which is 5 seconds and causes us to lose spans
|
|
92
|
+
scheduledDelayMillis: 100
|
|
97
93
|
}
|
|
98
|
-
|
|
94
|
+
)
|
|
95
|
+
];
|
|
96
|
+
if (config.addSentry) {
|
|
97
|
+
_spanProcessors.push(new CustomSentrySpanProcessor());
|
|
98
|
+
}
|
|
99
|
+
const _idGenerator = new AWSXRayIdGenerator();
|
|
100
|
+
const instrumentations = [
|
|
101
|
+
new AwsInstrumentation({
|
|
102
|
+
suppressInternalInstrumentation: true
|
|
103
|
+
}),
|
|
104
|
+
new DataloaderInstrumentation({}),
|
|
105
|
+
new ExpressInstrumentation({
|
|
106
|
+
ignoreLayersType: [ExpressLayerType.MIDDLEWARE]
|
|
107
|
+
}),
|
|
108
|
+
new GraphQLInstrumentation({
|
|
109
|
+
// optional params
|
|
110
|
+
depth: config.graphQLDepth,
|
|
111
|
+
//query depth
|
|
112
|
+
allowValues: true
|
|
113
|
+
}),
|
|
114
|
+
new HttpInstrumentation({
|
|
115
|
+
ignoreIncomingPaths: ["/.well-known/apollo/server-health"]
|
|
116
|
+
}),
|
|
117
|
+
new MySQL2Instrumentation({}),
|
|
118
|
+
new NetInstrumentation({})
|
|
99
119
|
];
|
|
100
|
-
((
|
|
120
|
+
((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
|
|
101
121
|
instrumentations.push(
|
|
102
122
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
103
123
|
);
|
|
104
124
|
});
|
|
105
125
|
const sdk = new NodeSDK({
|
|
106
|
-
textMapPropagator: new
|
|
126
|
+
textMapPropagator: config.addSentry ? new CompositePropagator({
|
|
127
|
+
propagators: [new AWSXRayPropagator(), new SentryPropagator()]
|
|
128
|
+
}) : new AWSXRayPropagator(),
|
|
107
129
|
instrumentations,
|
|
108
|
-
|
|
109
|
-
contextManager: new Sentry.SentryContextManager(),
|
|
130
|
+
contextManager: config.addSentry ? new SentryContextManager() : void 0,
|
|
110
131
|
resource: _resource,
|
|
111
|
-
|
|
112
|
-
spanProcessors: [new BatchSpanProcessor(_traceExporter)],
|
|
132
|
+
spanProcessors: _spanProcessors,
|
|
113
133
|
traceExporter: _traceExporter,
|
|
114
|
-
|
|
134
|
+
idGenerator: _idGenerator,
|
|
115
135
|
// TODO: Remove after issue is fixed
|
|
116
136
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
117
137
|
resourceDetectors: [
|
|
@@ -122,14 +142,97 @@ async function nodeSDKBuilder(config) {
|
|
|
122
142
|
});
|
|
123
143
|
sdk.start();
|
|
124
144
|
diag.info("Tracer successfully started");
|
|
125
|
-
Sentry.validateOpenTelemetrySetup();
|
|
126
145
|
process.on("SIGTERM", () => {
|
|
127
146
|
sdk.shutdown().then(() => diag.info("Tracing and Metrics terminated")).catch(
|
|
128
147
|
(error) => diag.error("Error terminating tracing and metrics", error)
|
|
129
148
|
).finally(() => process.exit(0));
|
|
130
149
|
});
|
|
131
150
|
}
|
|
151
|
+
var CustomAWSXraySpanProcessor = class extends BatchSpanProcessor {
|
|
152
|
+
constructor(_exporter, ratio, config) {
|
|
153
|
+
super(_exporter, config);
|
|
154
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
|
155
|
+
this.sampler = new ParentBasedSampler({
|
|
156
|
+
root: new TraceIdRatioBasedSampler(ratio)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
onStart(span, parentContext) {
|
|
160
|
+
this.contextMap.set(span.spanContext().traceId, parentContext);
|
|
161
|
+
const sampleResult = this.sampler.shouldSample(
|
|
162
|
+
parentContext,
|
|
163
|
+
span.spanContext().traceId,
|
|
164
|
+
span.name,
|
|
165
|
+
span.kind,
|
|
166
|
+
span.attributes,
|
|
167
|
+
span.links
|
|
168
|
+
);
|
|
169
|
+
if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
|
|
170
|
+
super.onStart(span, parentContext);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
onEnd(span) {
|
|
174
|
+
const context = this.contextMap.get(span.spanContext().traceId);
|
|
175
|
+
if (context) {
|
|
176
|
+
const sampleResult = this.sampler.shouldSample(
|
|
177
|
+
context,
|
|
178
|
+
span.spanContext().traceId,
|
|
179
|
+
span.name,
|
|
180
|
+
span.kind,
|
|
181
|
+
span.attributes,
|
|
182
|
+
span.links
|
|
183
|
+
);
|
|
184
|
+
this.contextMap.delete(span.spanContext().traceId);
|
|
185
|
+
if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
|
|
186
|
+
super.onEnd(span);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var CustomSentrySpanProcessor = class extends SentrySpanProcessor {
|
|
192
|
+
constructor() {
|
|
193
|
+
super();
|
|
194
|
+
this.contextMap = /* @__PURE__ */ new Map();
|
|
195
|
+
const sentryClient = Sentry.getClient();
|
|
196
|
+
if (!sentryClient) {
|
|
197
|
+
throw new Error("Sentry client is not initialized");
|
|
198
|
+
}
|
|
199
|
+
this.sampler = new SentrySampler(sentryClient);
|
|
200
|
+
}
|
|
201
|
+
onStart(span, parentContext) {
|
|
202
|
+
this.contextMap.set(span.spanContext().traceId, parentContext);
|
|
203
|
+
const sampleResult = this.sampler.shouldSample(
|
|
204
|
+
parentContext,
|
|
205
|
+
span.spanContext().traceId,
|
|
206
|
+
span.name,
|
|
207
|
+
span.kind,
|
|
208
|
+
span.attributes,
|
|
209
|
+
span.links
|
|
210
|
+
);
|
|
211
|
+
if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
|
|
212
|
+
super.onStart(span, parentContext);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
onEnd(span) {
|
|
216
|
+
const context = this.contextMap.get(span.spanContext().traceId);
|
|
217
|
+
if (context) {
|
|
218
|
+
const sampleResult = this.sampler.shouldSample(
|
|
219
|
+
context,
|
|
220
|
+
span.spanContext().traceId,
|
|
221
|
+
span.name,
|
|
222
|
+
span.kind,
|
|
223
|
+
span.attributes,
|
|
224
|
+
span.links
|
|
225
|
+
);
|
|
226
|
+
this.contextMap.delete(span.spanContext().traceId);
|
|
227
|
+
if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
|
|
228
|
+
super.onEnd(span);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
132
233
|
export {
|
|
133
234
|
AdditionalInstrumentation,
|
|
235
|
+
CustomAWSXraySpanProcessor,
|
|
236
|
+
CustomSentrySpanProcessor,
|
|
134
237
|
nodeSDKBuilder
|
|
135
238
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocket-tools/tracing",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Utilities for tracing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tracing"
|
|
@@ -66,22 +66,27 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@opentelemetry/api": "1.9.0",
|
|
69
|
-
"@opentelemetry/auto-instrumentations-node": "0.50.0",
|
|
70
69
|
"@opentelemetry/context-async-hooks": "1.26.0",
|
|
71
70
|
"@opentelemetry/core": "1.26.0",
|
|
72
|
-
"@opentelemetry/exporter-metrics-otlp-grpc": "0.53.0",
|
|
73
71
|
"@opentelemetry/exporter-trace-otlp-grpc": "0.53.0",
|
|
74
72
|
"@opentelemetry/exporter-trace-otlp-http": "0.53.0",
|
|
75
73
|
"@opentelemetry/id-generator-aws-xray": "1.2.2",
|
|
74
|
+
"@opentelemetry/instrumentation": "0.53.0",
|
|
75
|
+
"@opentelemetry/instrumentation-aws-sdk": "0.44.0",
|
|
76
|
+
"@opentelemetry/instrumentation-dataloader": "0.12.0",
|
|
77
|
+
"@opentelemetry/instrumentation-express": "0.42.0",
|
|
78
|
+
"@opentelemetry/instrumentation-graphql": "0.43.0",
|
|
79
|
+
"@opentelemetry/instrumentation-http": "0.53.0",
|
|
76
80
|
"@opentelemetry/instrumentation-knex": "0.40.0",
|
|
81
|
+
"@opentelemetry/instrumentation-mysql2": "0.41.0",
|
|
82
|
+
"@opentelemetry/instrumentation-net": "0.39.0",
|
|
77
83
|
"@opentelemetry/propagator-aws-xray": "1.26.0",
|
|
84
|
+
"@opentelemetry/resource-detector-aws": "1.6.1",
|
|
78
85
|
"@opentelemetry/resources": "1.26.0",
|
|
79
|
-
"@opentelemetry/sdk-metrics": "1.26.0",
|
|
80
86
|
"@opentelemetry/sdk-node": "0.53.0",
|
|
81
87
|
"@opentelemetry/sdk-trace-base": "1.26.0",
|
|
82
88
|
"@opentelemetry/sdk-trace-node": "1.26.0",
|
|
83
89
|
"@opentelemetry/semantic-conventions": "1.27.0",
|
|
84
|
-
"@opentelemetry/winston-transport": "0.6.0",
|
|
85
90
|
"@prisma/instrumentation": "5.19.1",
|
|
86
91
|
"@sentry/node": "8.33.0",
|
|
87
92
|
"@sentry/opentelemetry": "8.33.0",
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @pocket-tools/tracing@0.0.0-development build /home/runner/work/pocket-monorepo/pocket-monorepo/packages/tracing
|
|
3
|
-
> tsup src/index.ts --format cjs,esm --dts
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.2.4
|
|
8
|
-
[34mCLI[39m Target: es2019
|
|
9
|
-
[34mCJS[39m Build start
|
|
10
|
-
[34mESM[39m Build start
|
|
11
|
-
[33mCJS[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m
|
|
12
|
-
[33mESM[39m [33mYou have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin[39m
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m6.46 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in 142ms
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m4.36 KB[39m
|
|
16
|
-
[32mESM[39m ⚡️ Build success in 152ms
|
|
17
|
-
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in 9242ms
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m652.00 B[39m
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m652.00 B[39m
|