@pocket-tools/tracing 1.5.0 → 1.5.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 -86
- package/README.md +1 -1
- package/dist/index.d.mts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +145 -56
- package/dist/index.mjs +156 -62
- package/package.json +10 -5
- package/.turbo/turbo-build.log +0 -20
|
@@ -14,96 +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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
19
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
20
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.35 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 170ms
|
|
19
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m7.79 KB[39m
|
|
20
|
+
[32mESM[39m ⚡️ Build success in 185ms
|
|
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 6548ms
|
|
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
|
-
[5:
|
|
30
|
-
[5:
|
|
31
|
-
[5:
|
|
32
|
-
[5:
|
|
33
|
-
[5:
|
|
34
|
-
[5:
|
|
35
|
-
[5:
|
|
36
|
-
[5:
|
|
37
|
-
[5:
|
|
38
|
-
[5:
|
|
39
|
-
[5:
|
|
40
|
-
[5:
|
|
41
|
-
[5:
|
|
29
|
+
[5:20:03 PM] [semantic-release] › ℹ Running semantic-release version 24.1.0
|
|
30
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
|
|
31
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
|
|
32
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
|
|
33
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
|
|
34
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
|
|
35
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
|
|
36
|
+
[5:20:04 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
|
|
37
|
+
[5:20:09 PM] [semantic-release] › ✔ Run automated release from branch main on repository git+https://github.com/Pocket/pocket-monorepo.git
|
|
38
|
+
[5:20:10 PM] [semantic-release] › ✔ Allowed to push to the Git repository
|
|
39
|
+
[5:20:10 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
|
|
40
|
+
[5:20:10 PM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
|
|
41
|
+
[5:20:10 PM] [semantic-release] [@semantic-release/npm] › ℹ Wrote NPM_TOKEN to /tmp/a4312a0d09d608fb5fab5336e91f6503/.npmrc
|
|
42
42
|
pocket-npm
|
|
43
|
-
[5:
|
|
44
|
-
[5:
|
|
45
|
-
[5:
|
|
46
|
-
[5:
|
|
47
|
-
[5:
|
|
48
|
-
[5:
|
|
49
|
-
[5:
|
|
50
|
-
[5:
|
|
51
|
-
[5:
|
|
52
|
-
[5:
|
|
43
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
|
|
44
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
|
|
45
|
+
[5:20:11 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
|
|
46
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
|
|
47
|
+
[5:20:11 PM] [semantic-release] › ℹ Found git tag @pocket-tools/tracing-v1.5.0 associated with version 1.5.0 on branch main
|
|
48
|
+
[5:20:11 PM] [semantic-release] › ℹ Found 1 commits since last release
|
|
49
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
50
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
51
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Found 1 commits for package @pocket-tools/tracing since last release
|
|
52
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: Revert "feat(otel): adding in basic tracing via otel (#794)" (#797)
|
|
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
|
-
[5:
|
|
80
|
-
[5:
|
|
81
|
-
[5:
|
|
82
|
-
[5:
|
|
83
|
-
[5:
|
|
84
|
-
[5:
|
|
85
|
-
[5:
|
|
86
|
-
[5:
|
|
87
|
-
[5:
|
|
88
|
-
[5:
|
|
89
|
-
[5:
|
|
90
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/github" does not provide step "analyzeCommits"
|
|
91
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
92
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
93
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
94
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
95
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
96
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
97
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
98
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
99
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
100
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
101
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
102
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
103
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
104
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
105
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
106
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
107
|
-
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
108
|
-
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
109
|
-
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
54
|
+
This reverts commit 9e5cd939e7bbea631f7822abd90fcfa40ff3c312.
|
|
55
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The release type for the commit is patch
|
|
56
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analysis of 1 commits complete: patch release
|
|
57
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
58
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
59
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
60
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/release-notes-generator" does not provide step "analyzeCommits"
|
|
61
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
62
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
63
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/npm" does not provide step "analyzeCommits"
|
|
64
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
65
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
66
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/github" does not provide step "analyzeCommits"
|
|
67
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
68
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
69
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
70
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
71
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
72
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
73
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
74
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
75
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
76
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
77
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
78
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
79
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
80
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
81
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
82
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
83
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
84
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
|
|
85
|
+
[5:20:11 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
86
|
+
[5:20:11 PM] [semantic-release] › ℹ The next release version is 1.5.1
|
|
87
|
+
[5:20:11 PM] [semantic-release] › ℹ Start step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
|
|
88
|
+
[5:20:11 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/commit-analyzer" does not provide step "generateNotes"
|
|
89
|
+
[5:20:11 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,21 +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
|
|
48
|
-
var import_exporter_metrics_otlp_grpc = require("@opentelemetry/exporter-metrics-otlp-grpc");
|
|
49
|
-
var import_auto_instrumentations_node = require("@opentelemetry/auto-instrumentations-node");
|
|
61
|
+
var import_context_async_hooks = require("@opentelemetry/context-async-hooks");
|
|
50
62
|
var import_resources2 = require("@opentelemetry/resources");
|
|
51
63
|
var Sentry = __toESM(require("@sentry/node"));
|
|
52
|
-
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
53
|
-
var import_propagator_aws_xray = require("@opentelemetry/propagator-aws-xray");
|
|
54
|
-
var import_id_generator_aws_xray = require("@opentelemetry/id-generator-aws-xray");
|
|
55
64
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
56
65
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
57
66
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -61,17 +70,9 @@ var additionalInstrumentationConstructors = {
|
|
|
61
70
|
KNEX: import_instrumentation_knex.KnexInstrumentation,
|
|
62
71
|
PRISMA: import_instrumentation.PrismaInstrumentation
|
|
63
72
|
};
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
sentry: void 0,
|
|
68
|
-
graphQLDepth: 8,
|
|
69
|
-
grpcDefaultPort: 4317,
|
|
70
|
-
httpDefaultPort: 4318,
|
|
71
|
-
host: "localhost",
|
|
72
|
-
logger: new import_api.DiagConsoleLogger(),
|
|
73
|
-
additionalInstrumentations: []
|
|
74
|
-
};
|
|
73
|
+
var SentryContextManager = (0, import_opentelemetry.wrapContextManagerClass)(
|
|
74
|
+
import_context_async_hooks.AsyncLocalStorageContextManager
|
|
75
|
+
);
|
|
75
76
|
function awaitAttributes(detector) {
|
|
76
77
|
return {
|
|
77
78
|
/**
|
|
@@ -86,63 +87,68 @@ function awaitAttributes(detector) {
|
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
async function nodeSDKBuilder(config) {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
config = { ...tracingDefaults, ...config };
|
|
90
|
+
var _a, _b, _c;
|
|
91
91
|
import_api.diag.setLogger((_a = config.logger) != null ? _a : new import_api.DiagConsoleLogger(), import_api.DiagLogLevel.WARN);
|
|
92
92
|
const _resource = import_resources.Resource.default().merge(
|
|
93
93
|
new import_resources.Resource({
|
|
94
|
-
[import_semantic_conventions.
|
|
95
|
-
[import_semantic_conventions.
|
|
94
|
+
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: config.serviceName,
|
|
95
|
+
[import_semantic_conventions.SEMRESATTRS_SERVICE_VERSION]: config.release
|
|
96
96
|
})
|
|
97
97
|
);
|
|
98
98
|
const _traceExporter = new import_exporter_trace_otlp_grpc.OTLPTraceExporter({
|
|
99
99
|
//collector url
|
|
100
100
|
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
101
101
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
(0, import_auto_instrumentations_node.getNodeAutoInstrumentations)({
|
|
111
|
-
"@opentelemetry/instrumentation-fs": {
|
|
112
|
-
enabled: false,
|
|
113
|
-
requireParentSpan: true
|
|
114
|
-
},
|
|
115
|
-
"@opentelemetry/instrumentation-undici": {
|
|
116
|
-
headersToSpanAttributes: {
|
|
117
|
-
requestHeaders: [
|
|
118
|
-
"sentry-trace",
|
|
119
|
-
"baggage",
|
|
120
|
-
"x-amzn-trace-id",
|
|
121
|
-
"encodedid",
|
|
122
|
-
"applicationname"
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
"@opentelemetry/instrumentation-http": {
|
|
127
|
-
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
|
|
128
110
|
}
|
|
129
|
-
|
|
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({})
|
|
130
136
|
];
|
|
131
|
-
((
|
|
137
|
+
((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
|
|
132
138
|
instrumentations.push(
|
|
133
139
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
134
140
|
);
|
|
135
141
|
});
|
|
136
142
|
const sdk = new import_sdk_node.NodeSDK({
|
|
137
|
-
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(),
|
|
138
146
|
instrumentations,
|
|
139
|
-
|
|
140
|
-
contextManager: new Sentry.SentryContextManager(),
|
|
147
|
+
contextManager: config.addSentry ? new SentryContextManager() : void 0,
|
|
141
148
|
resource: _resource,
|
|
142
|
-
|
|
143
|
-
spanProcessors: [new import_sdk_trace_base.BatchSpanProcessor(_traceExporter)],
|
|
149
|
+
spanProcessors: _spanProcessors,
|
|
144
150
|
traceExporter: _traceExporter,
|
|
145
|
-
|
|
151
|
+
idGenerator: _idGenerator,
|
|
146
152
|
// TODO: Remove after issue is fixed
|
|
147
153
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
148
154
|
resourceDetectors: [
|
|
@@ -153,15 +159,98 @@ async function nodeSDKBuilder(config) {
|
|
|
153
159
|
});
|
|
154
160
|
sdk.start();
|
|
155
161
|
import_api.diag.info("Tracer successfully started");
|
|
156
|
-
Sentry.validateOpenTelemetrySetup();
|
|
157
162
|
import_process.default.on("SIGTERM", () => {
|
|
158
163
|
sdk.shutdown().then(() => import_api.diag.info("Tracing and Metrics terminated")).catch(
|
|
159
164
|
(error) => import_api.diag.error("Error terminating tracing and metrics", error)
|
|
160
165
|
).finally(() => import_process.default.exit(0));
|
|
161
166
|
});
|
|
162
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
|
+
};
|
|
163
250
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
251
|
0 && (module.exports = {
|
|
165
252
|
AdditionalInstrumentation,
|
|
253
|
+
CustomAWSXraySpanProcessor,
|
|
254
|
+
CustomSentrySpanProcessor,
|
|
166
255
|
nodeSDKBuilder
|
|
167
256
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,35 +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 {
|
|
19
|
-
|
|
20
|
-
|
|
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";
|
|
21
41
|
import {
|
|
22
42
|
envDetectorSync,
|
|
23
43
|
hostDetectorSync,
|
|
24
44
|
processDetectorSync
|
|
25
45
|
} from "@opentelemetry/resources";
|
|
26
46
|
import * as Sentry from "@sentry/node";
|
|
27
|
-
import {
|
|
28
|
-
BatchSpanProcessor,
|
|
29
|
-
ParentBasedSampler
|
|
30
|
-
} from "@opentelemetry/sdk-trace-base";
|
|
31
|
-
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
|
|
32
|
-
import { AWSXRayIdGenerator } from "@opentelemetry/id-generator-aws-xray";
|
|
33
47
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
34
48
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
35
49
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -39,17 +53,9 @@ var additionalInstrumentationConstructors = {
|
|
|
39
53
|
KNEX: KnexInstrumentation,
|
|
40
54
|
PRISMA: PrismaInstrumentation
|
|
41
55
|
};
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
sentry: void 0,
|
|
46
|
-
graphQLDepth: 8,
|
|
47
|
-
grpcDefaultPort: 4317,
|
|
48
|
-
httpDefaultPort: 4318,
|
|
49
|
-
host: "localhost",
|
|
50
|
-
logger: new DiagConsoleLogger(),
|
|
51
|
-
additionalInstrumentations: []
|
|
52
|
-
};
|
|
56
|
+
var SentryContextManager = wrapContextManagerClass(
|
|
57
|
+
AsyncLocalStorageContextManager
|
|
58
|
+
);
|
|
53
59
|
function awaitAttributes(detector) {
|
|
54
60
|
return {
|
|
55
61
|
/**
|
|
@@ -64,63 +70,68 @@ function awaitAttributes(detector) {
|
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
72
|
async function nodeSDKBuilder(config) {
|
|
67
|
-
var _a, _b;
|
|
68
|
-
config = { ...tracingDefaults, ...config };
|
|
73
|
+
var _a, _b, _c;
|
|
69
74
|
diag.setLogger((_a = config.logger) != null ? _a : new DiagConsoleLogger(), DiagLogLevel.WARN);
|
|
70
75
|
const _resource = Resource.default().merge(
|
|
71
76
|
new Resource({
|
|
72
|
-
[
|
|
73
|
-
[
|
|
77
|
+
[SEMRESATTRS_SERVICE_NAME]: config.serviceName,
|
|
78
|
+
[SEMRESATTRS_SERVICE_VERSION]: config.release
|
|
74
79
|
})
|
|
75
80
|
);
|
|
76
81
|
const _traceExporter = new OTLPTraceExporter({
|
|
77
82
|
//collector url
|
|
78
83
|
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
79
84
|
});
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
getNodeAutoInstrumentations({
|
|
89
|
-
"@opentelemetry/instrumentation-fs": {
|
|
90
|
-
enabled: false,
|
|
91
|
-
requireParentSpan: true
|
|
92
|
-
},
|
|
93
|
-
"@opentelemetry/instrumentation-undici": {
|
|
94
|
-
headersToSpanAttributes: {
|
|
95
|
-
requestHeaders: [
|
|
96
|
-
"sentry-trace",
|
|
97
|
-
"baggage",
|
|
98
|
-
"x-amzn-trace-id",
|
|
99
|
-
"encodedid",
|
|
100
|
-
"applicationname"
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"@opentelemetry/instrumentation-http": {
|
|
105
|
-
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
|
|
106
93
|
}
|
|
107
|
-
|
|
94
|
+
)
|
|
108
95
|
];
|
|
109
|
-
(
|
|
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({})
|
|
119
|
+
];
|
|
120
|
+
((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
|
|
110
121
|
instrumentations.push(
|
|
111
122
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
112
123
|
);
|
|
113
124
|
});
|
|
114
125
|
const sdk = new NodeSDK({
|
|
115
|
-
textMapPropagator: new
|
|
126
|
+
textMapPropagator: config.addSentry ? new CompositePropagator({
|
|
127
|
+
propagators: [new AWSXRayPropagator(), new SentryPropagator()]
|
|
128
|
+
}) : new AWSXRayPropagator(),
|
|
116
129
|
instrumentations,
|
|
117
|
-
|
|
118
|
-
contextManager: new Sentry.SentryContextManager(),
|
|
130
|
+
contextManager: config.addSentry ? new SentryContextManager() : void 0,
|
|
119
131
|
resource: _resource,
|
|
120
|
-
|
|
121
|
-
spanProcessors: [new BatchSpanProcessor(_traceExporter)],
|
|
132
|
+
spanProcessors: _spanProcessors,
|
|
122
133
|
traceExporter: _traceExporter,
|
|
123
|
-
|
|
134
|
+
idGenerator: _idGenerator,
|
|
124
135
|
// TODO: Remove after issue is fixed
|
|
125
136
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
126
137
|
resourceDetectors: [
|
|
@@ -131,14 +142,97 @@ async function nodeSDKBuilder(config) {
|
|
|
131
142
|
});
|
|
132
143
|
sdk.start();
|
|
133
144
|
diag.info("Tracer successfully started");
|
|
134
|
-
Sentry.validateOpenTelemetrySetup();
|
|
135
145
|
process.on("SIGTERM", () => {
|
|
136
146
|
sdk.shutdown().then(() => diag.info("Tracing and Metrics terminated")).catch(
|
|
137
147
|
(error) => diag.error("Error terminating tracing and metrics", error)
|
|
138
148
|
).finally(() => process.exit(0));
|
|
139
149
|
});
|
|
140
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
|
+
};
|
|
141
233
|
export {
|
|
142
234
|
AdditionalInstrumentation,
|
|
235
|
+
CustomAWSXraySpanProcessor,
|
|
236
|
+
CustomSentrySpanProcessor,
|
|
143
237
|
nodeSDKBuilder
|
|
144
238
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocket-tools/tracing",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.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
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m4.85 KB[39m
|
|
14
|
-
[32mESM[39m ⚡️ Build success in 129ms
|
|
15
|
-
[32mCJS[39m [1mdist/index.js [22m[32m7.01 KB[39m
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in 134ms
|
|
17
|
-
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in 9098ms
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m652.00 B[39m
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m652.00 B[39m
|