@pocket-tools/tracing 1.4.7 → 1.5.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.
- package/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-semantic-release.log +87 -65
- package/README.md +1 -1
- package/dist/index.d.mts +4 -19
- package/dist/index.d.ts +4 -19
- package/dist/index.js +56 -145
- package/dist/index.mjs +62 -156
- package/package.json +7 -12
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -14,74 +14,96 @@
|
|
|
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[32m7.01 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 143ms
|
|
19
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m4.85 KB[39m
|
|
20
|
+
[32mESM[39m ⚡️ Build success in 151ms
|
|
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 6739ms
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m652.00 B[39m
|
|
24
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m652.00 B[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
|
+
[5:02:12 PM] [semantic-release] › ℹ Running semantic-release version 24.1.0
|
|
30
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
|
|
31
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
|
|
32
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
|
|
33
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
|
|
34
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
|
|
35
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
|
|
36
|
+
[5:02:13 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
|
|
37
|
+
[5:02:16 PM] [semantic-release] › ✔ Run automated release from branch main on repository git+https://github.com/Pocket/pocket-monorepo.git
|
|
38
|
+
[5:02:16 PM] [semantic-release] › ✔ Allowed to push to the Git repository
|
|
39
|
+
[5:02:16 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
|
|
40
|
+
[5:02:16 PM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
|
|
41
|
+
[5:02:16 PM] [semantic-release] [@semantic-release/npm] › ℹ Wrote NPM_TOKEN to /tmp/49a729215fc1cb1ff393d0668244db73/.npmrc
|
|
42
42
|
pocket-npm
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
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
|
-
[
|
|
43
|
+
[5:02:17 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
|
|
44
|
+
[5:02:17 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
|
|
45
|
+
[5:02:17 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
|
|
46
|
+
[5:02:17 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
|
|
47
|
+
[5:02:17 PM] [semantic-release] › ℹ Found git tag @pocket-tools/tracing-v1.4.9 associated with version 1.4.9 on branch main
|
|
48
|
+
[5:02:17 PM] [semantic-release] › ℹ Found 1 commits since last release
|
|
49
|
+
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
50
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
51
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Found 1 commits for package @pocket-tools/tracing since last release
|
|
52
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: feat(otel): adding in basic tracing via otel (#794)
|
|
53
|
+
|
|
54
|
+
* feat(otel): adding in basic tracing via otel
|
|
55
|
+
|
|
56
|
+
* fix(otel): adding in otel propogation
|
|
57
|
+
|
|
58
|
+
* fix(otel): moving to the otel
|
|
59
|
+
|
|
60
|
+
* fix(otel): send otel to gcp
|
|
61
|
+
|
|
62
|
+
* fix(keys): import full key
|
|
63
|
+
|
|
64
|
+
* fix(secret): moving to a secret without -
|
|
65
|
+
|
|
66
|
+
* fix(otel): building a simple custom otel container
|
|
67
|
+
|
|
68
|
+
* fix(tracing): ignore well-known
|
|
69
|
+
|
|
70
|
+
* fix(tracing): ignore well-known
|
|
71
|
+
|
|
72
|
+
* fix(otel): updating metric exporter
|
|
73
|
+
|
|
74
|
+
* feat(costs): adding in query costs
|
|
75
|
+
|
|
76
|
+
* fix(otel): adding in new otel exporter to all
|
|
77
|
+
|
|
78
|
+
* fix(docker): adding in docker image building
|
|
79
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The release type for the commit is minor
|
|
80
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analysis of 1 commits complete: minor release
|
|
81
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
|
|
82
|
+
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
83
|
+
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
84
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/release-notes-generator" does not provide step "analyzeCommits"
|
|
85
|
+
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
86
|
+
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
87
|
+
[5:02:17 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/npm" does not provide step "analyzeCommits"
|
|
88
|
+
[5:02:17 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
89
|
+
[5:02:17 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
|
|
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]"
|
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SentrySpanProcessor, SentrySampler } from '@sentry/opentelemetry';
|
|
1
|
+
import { DiagLogger } from '@opentelemetry/api';
|
|
2
|
+
import { NodeClient } from '@sentry/node';
|
|
4
3
|
|
|
5
4
|
declare enum AdditionalInstrumentation {
|
|
6
5
|
KNEX = "KNEX",
|
|
@@ -15,23 +14,9 @@ type TracingConfig = {
|
|
|
15
14
|
httpDefaultPort?: number;
|
|
16
15
|
host?: string;
|
|
17
16
|
logger?: DiagLogger;
|
|
18
|
-
|
|
17
|
+
sentry: NodeClient | undefined;
|
|
19
18
|
additionalInstrumentations?: AdditionalInstrumentation[];
|
|
20
19
|
};
|
|
21
20
|
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
|
-
}
|
|
36
21
|
|
|
37
|
-
export { AdditionalInstrumentation,
|
|
22
|
+
export { AdditionalInstrumentation, type TracingConfig, nodeSDKBuilder };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SentrySpanProcessor, SentrySampler } from '@sentry/opentelemetry';
|
|
1
|
+
import { DiagLogger } from '@opentelemetry/api';
|
|
2
|
+
import { NodeClient } from '@sentry/node';
|
|
4
3
|
|
|
5
4
|
declare enum AdditionalInstrumentation {
|
|
6
5
|
KNEX = "KNEX",
|
|
@@ -15,23 +14,9 @@ type TracingConfig = {
|
|
|
15
14
|
httpDefaultPort?: number;
|
|
16
15
|
host?: string;
|
|
17
16
|
logger?: DiagLogger;
|
|
18
|
-
|
|
17
|
+
sentry: NodeClient | undefined;
|
|
19
18
|
additionalInstrumentations?: AdditionalInstrumentation[];
|
|
20
19
|
};
|
|
21
20
|
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
|
-
}
|
|
36
21
|
|
|
37
|
-
export { AdditionalInstrumentation,
|
|
22
|
+
export { AdditionalInstrumentation, type TracingConfig, nodeSDKBuilder };
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,6 @@ 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,
|
|
35
33
|
nodeSDKBuilder: () => nodeSDKBuilder
|
|
36
34
|
});
|
|
37
35
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -39,28 +37,21 @@ module.exports = __toCommonJS(src_exports);
|
|
|
39
37
|
// src/tracing.ts
|
|
40
38
|
var import_process = __toESM(require("process"));
|
|
41
39
|
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");
|
|
49
40
|
var import_api = require("@opentelemetry/api");
|
|
50
|
-
var import_instrumentation_express = require("@opentelemetry/instrumentation-express");
|
|
51
|
-
var import_instrumentation_http = require("@opentelemetry/instrumentation-http");
|
|
52
41
|
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");
|
|
55
42
|
var import_exporter_trace_otlp_grpc = require("@opentelemetry/exporter-trace-otlp-grpc");
|
|
56
43
|
var import_instrumentation = require("@prisma/instrumentation");
|
|
57
44
|
var import_resources = require("@opentelemetry/resources");
|
|
58
45
|
var import_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
59
|
-
var import_ExpressLayerType = require("@opentelemetry/instrumentation-express/build/src/enums/ExpressLayerType");
|
|
60
46
|
var import_opentelemetry = require("@sentry/opentelemetry");
|
|
61
|
-
var
|
|
47
|
+
var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
|
|
48
|
+
var import_exporter_metrics_otlp_grpc = require("@opentelemetry/exporter-metrics-otlp-grpc");
|
|
49
|
+
var import_auto_instrumentations_node = require("@opentelemetry/auto-instrumentations-node");
|
|
62
50
|
var import_resources2 = require("@opentelemetry/resources");
|
|
63
51
|
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");
|
|
64
55
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
65
56
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
66
57
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -70,9 +61,17 @@ var additionalInstrumentationConstructors = {
|
|
|
70
61
|
KNEX: import_instrumentation_knex.KnexInstrumentation,
|
|
71
62
|
PRISMA: import_instrumentation.PrismaInstrumentation
|
|
72
63
|
};
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
var tracingDefaults = {
|
|
65
|
+
serviceName: "unknown",
|
|
66
|
+
release: "unknown",
|
|
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
|
+
};
|
|
76
75
|
function awaitAttributes(detector) {
|
|
77
76
|
return {
|
|
78
77
|
/**
|
|
@@ -87,68 +86,63 @@ function awaitAttributes(detector) {
|
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
88
|
async function nodeSDKBuilder(config) {
|
|
90
|
-
var _a, _b
|
|
89
|
+
var _a, _b;
|
|
90
|
+
config = { ...tracingDefaults, ...config };
|
|
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.ATTR_SERVICE_NAME]: config.serviceName,
|
|
95
|
+
[import_semantic_conventions.ATTR_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
|
-
new
|
|
104
|
-
|
|
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
|
|
110
|
-
}
|
|
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"]
|
|
102
|
+
const _metricReader = new import_sdk_metrics.PeriodicExportingMetricReader({
|
|
103
|
+
exporter: new import_exporter_metrics_otlp_grpc.OTLPMetricExporter({
|
|
104
|
+
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
133
105
|
}),
|
|
134
|
-
|
|
135
|
-
|
|
106
|
+
exportIntervalMillis: 1e4
|
|
107
|
+
// once every 10 seconds, GCP supports 1 every 5 seconds for custom metrics https://cloud.google.com/monitoring/quotas#custom_metrics_quotas
|
|
108
|
+
});
|
|
109
|
+
const instrumentations = [
|
|
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"]
|
|
128
|
+
}
|
|
129
|
+
})
|
|
136
130
|
];
|
|
137
|
-
((
|
|
131
|
+
((_b = config.additionalInstrumentations) != null ? _b : []).forEach((instrumentation) => {
|
|
138
132
|
instrumentations.push(
|
|
139
133
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
140
134
|
);
|
|
141
135
|
});
|
|
142
136
|
const sdk = new import_sdk_node.NodeSDK({
|
|
143
|
-
textMapPropagator:
|
|
144
|
-
propagators: [new import_propagator_aws_xray.AWSXRayPropagator(), new import_opentelemetry.SentryPropagator()]
|
|
145
|
-
}) : new import_propagator_aws_xray.AWSXRayPropagator(),
|
|
137
|
+
textMapPropagator: new import_propagator_aws_xray.AWSXRayPropagator(),
|
|
146
138
|
instrumentations,
|
|
147
|
-
|
|
139
|
+
sampler: config.sentry ? new import_sdk_trace_base.ParentBasedSampler({ root: new import_opentelemetry.SentrySampler(config.sentry) }) : void 0,
|
|
140
|
+
contextManager: new Sentry.SentryContextManager(),
|
|
148
141
|
resource: _resource,
|
|
149
|
-
|
|
142
|
+
idGenerator: new import_id_generator_aws_xray.AWSXRayIdGenerator(),
|
|
143
|
+
spanProcessors: [new import_sdk_trace_base.BatchSpanProcessor(_traceExporter)],
|
|
150
144
|
traceExporter: _traceExporter,
|
|
151
|
-
|
|
145
|
+
metricReader: _metricReader,
|
|
152
146
|
// TODO: Remove after issue is fixed
|
|
153
147
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
154
148
|
resourceDetectors: [
|
|
@@ -159,98 +153,15 @@ async function nodeSDKBuilder(config) {
|
|
|
159
153
|
});
|
|
160
154
|
sdk.start();
|
|
161
155
|
import_api.diag.info("Tracer successfully started");
|
|
156
|
+
Sentry.validateOpenTelemetrySetup();
|
|
162
157
|
import_process.default.on("SIGTERM", () => {
|
|
163
158
|
sdk.shutdown().then(() => import_api.diag.info("Tracing and Metrics terminated")).catch(
|
|
164
159
|
(error) => import_api.diag.error("Error terminating tracing and metrics", error)
|
|
165
160
|
).finally(() => import_process.default.exit(0));
|
|
166
161
|
});
|
|
167
162
|
}
|
|
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
|
-
};
|
|
250
163
|
// Annotate the CommonJS export names for ESM import in node:
|
|
251
164
|
0 && (module.exports = {
|
|
252
165
|
AdditionalInstrumentation,
|
|
253
|
-
CustomAWSXraySpanProcessor,
|
|
254
|
-
CustomSentrySpanProcessor,
|
|
255
166
|
nodeSDKBuilder
|
|
256
167
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,49 +1,35 @@
|
|
|
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";
|
|
16
4
|
import {
|
|
17
5
|
DiagConsoleLogger,
|
|
18
6
|
DiagLogLevel,
|
|
19
7
|
diag
|
|
20
8
|
} from "@opentelemetry/api";
|
|
21
|
-
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
22
|
-
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
23
9
|
import { KnexInstrumentation } from "@opentelemetry/instrumentation-knex";
|
|
24
|
-
import { MySQL2Instrumentation } from "@opentelemetry/instrumentation-mysql2";
|
|
25
|
-
import { NetInstrumentation } from "@opentelemetry/instrumentation-net";
|
|
26
10
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
27
11
|
import { PrismaInstrumentation } from "@prisma/instrumentation";
|
|
28
12
|
import { Resource } from "@opentelemetry/resources";
|
|
29
13
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
ATTR_SERVICE_NAME,
|
|
15
|
+
ATTR_SERVICE_VERSION
|
|
32
16
|
} from "@opentelemetry/semantic-conventions";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
SentrySampler,
|
|
38
|
-
wrapContextManagerClass
|
|
39
|
-
} from "@sentry/opentelemetry";
|
|
40
|
-
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";
|
|
17
|
+
import { SentrySampler } from "@sentry/opentelemetry";
|
|
18
|
+
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
19
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-grpc";
|
|
20
|
+
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
|
|
41
21
|
import {
|
|
42
22
|
envDetectorSync,
|
|
43
23
|
hostDetectorSync,
|
|
44
24
|
processDetectorSync
|
|
45
25
|
} from "@opentelemetry/resources";
|
|
46
26
|
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";
|
|
47
33
|
var AdditionalInstrumentation = /* @__PURE__ */ ((AdditionalInstrumentation2) => {
|
|
48
34
|
AdditionalInstrumentation2["KNEX"] = "KNEX";
|
|
49
35
|
AdditionalInstrumentation2["PRISMA"] = "PRISMA";
|
|
@@ -53,9 +39,17 @@ var additionalInstrumentationConstructors = {
|
|
|
53
39
|
KNEX: KnexInstrumentation,
|
|
54
40
|
PRISMA: PrismaInstrumentation
|
|
55
41
|
};
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
var tracingDefaults = {
|
|
43
|
+
serviceName: "unknown",
|
|
44
|
+
release: "unknown",
|
|
45
|
+
sentry: void 0,
|
|
46
|
+
graphQLDepth: 8,
|
|
47
|
+
grpcDefaultPort: 4317,
|
|
48
|
+
httpDefaultPort: 4318,
|
|
49
|
+
host: "localhost",
|
|
50
|
+
logger: new DiagConsoleLogger(),
|
|
51
|
+
additionalInstrumentations: []
|
|
52
|
+
};
|
|
59
53
|
function awaitAttributes(detector) {
|
|
60
54
|
return {
|
|
61
55
|
/**
|
|
@@ -70,68 +64,63 @@ function awaitAttributes(detector) {
|
|
|
70
64
|
};
|
|
71
65
|
}
|
|
72
66
|
async function nodeSDKBuilder(config) {
|
|
73
|
-
var _a, _b
|
|
67
|
+
var _a, _b;
|
|
68
|
+
config = { ...tracingDefaults, ...config };
|
|
74
69
|
diag.setLogger((_a = config.logger) != null ? _a : new DiagConsoleLogger(), DiagLogLevel.WARN);
|
|
75
70
|
const _resource = Resource.default().merge(
|
|
76
71
|
new Resource({
|
|
77
|
-
[
|
|
78
|
-
[
|
|
72
|
+
[ATTR_SERVICE_NAME]: config.serviceName,
|
|
73
|
+
[ATTR_SERVICE_VERSION]: config.release
|
|
79
74
|
})
|
|
80
75
|
);
|
|
81
76
|
const _traceExporter = new OTLPTraceExporter({
|
|
82
77
|
//collector url
|
|
83
78
|
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
84
79
|
});
|
|
85
|
-
const
|
|
86
|
-
new
|
|
87
|
-
|
|
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
|
|
93
|
-
}
|
|
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]
|
|
80
|
+
const _metricReader = new PeriodicExportingMetricReader({
|
|
81
|
+
exporter: new OTLPMetricExporter({
|
|
82
|
+
url: `http://${config.host}:${config.grpcDefaultPort}`
|
|
107
83
|
}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
84
|
+
exportIntervalMillis: 1e4
|
|
85
|
+
// once every 10 seconds, GCP supports 1 every 5 seconds for custom metrics https://cloud.google.com/monitoring/quotas#custom_metrics_quotas
|
|
86
|
+
});
|
|
87
|
+
const instrumentations = [
|
|
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"]
|
|
106
|
+
}
|
|
107
|
+
})
|
|
119
108
|
];
|
|
120
|
-
((
|
|
109
|
+
((_b = config.additionalInstrumentations) != null ? _b : []).forEach((instrumentation) => {
|
|
121
110
|
instrumentations.push(
|
|
122
111
|
new additionalInstrumentationConstructors[instrumentation]()
|
|
123
112
|
);
|
|
124
113
|
});
|
|
125
114
|
const sdk = new NodeSDK({
|
|
126
|
-
textMapPropagator:
|
|
127
|
-
propagators: [new AWSXRayPropagator(), new SentryPropagator()]
|
|
128
|
-
}) : new AWSXRayPropagator(),
|
|
115
|
+
textMapPropagator: new AWSXRayPropagator(),
|
|
129
116
|
instrumentations,
|
|
130
|
-
|
|
117
|
+
sampler: config.sentry ? new ParentBasedSampler({ root: new SentrySampler(config.sentry) }) : void 0,
|
|
118
|
+
contextManager: new Sentry.SentryContextManager(),
|
|
131
119
|
resource: _resource,
|
|
132
|
-
|
|
120
|
+
idGenerator: new AWSXRayIdGenerator(),
|
|
121
|
+
spanProcessors: [new BatchSpanProcessor(_traceExporter)],
|
|
133
122
|
traceExporter: _traceExporter,
|
|
134
|
-
|
|
123
|
+
metricReader: _metricReader,
|
|
135
124
|
// TODO: Remove after issue is fixed
|
|
136
125
|
// https://github.com/open-telemetry/opentelemetry-js/issues/4638
|
|
137
126
|
resourceDetectors: [
|
|
@@ -142,97 +131,14 @@ async function nodeSDKBuilder(config) {
|
|
|
142
131
|
});
|
|
143
132
|
sdk.start();
|
|
144
133
|
diag.info("Tracer successfully started");
|
|
134
|
+
Sentry.validateOpenTelemetrySetup();
|
|
145
135
|
process.on("SIGTERM", () => {
|
|
146
136
|
sdk.shutdown().then(() => diag.info("Tracing and Metrics terminated")).catch(
|
|
147
137
|
(error) => diag.error("Error terminating tracing and metrics", error)
|
|
148
138
|
).finally(() => process.exit(0));
|
|
149
139
|
});
|
|
150
140
|
}
|
|
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
|
-
};
|
|
233
141
|
export {
|
|
234
142
|
AdditionalInstrumentation,
|
|
235
|
-
CustomAWSXraySpanProcessor,
|
|
236
|
-
CustomSentrySpanProcessor,
|
|
237
143
|
nodeSDKBuilder
|
|
238
144
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocket-tools/tracing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Utilities for tracing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tracing"
|
|
@@ -66,30 +66,25 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@opentelemetry/api": "1.9.0",
|
|
69
|
+
"@opentelemetry/auto-instrumentations-node": "0.50.0",
|
|
69
70
|
"@opentelemetry/context-async-hooks": "1.26.0",
|
|
70
71
|
"@opentelemetry/core": "1.26.0",
|
|
72
|
+
"@opentelemetry/exporter-metrics-otlp-grpc": "0.53.0",
|
|
71
73
|
"@opentelemetry/exporter-trace-otlp-grpc": "0.53.0",
|
|
72
74
|
"@opentelemetry/exporter-trace-otlp-http": "0.53.0",
|
|
73
75
|
"@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",
|
|
80
76
|
"@opentelemetry/instrumentation-knex": "0.40.0",
|
|
81
|
-
"@opentelemetry/instrumentation-mysql2": "0.41.0",
|
|
82
|
-
"@opentelemetry/instrumentation-net": "0.39.0",
|
|
83
77
|
"@opentelemetry/propagator-aws-xray": "1.26.0",
|
|
84
|
-
"@opentelemetry/resource-detector-aws": "1.6.1",
|
|
85
78
|
"@opentelemetry/resources": "1.26.0",
|
|
79
|
+
"@opentelemetry/sdk-metrics": "1.26.0",
|
|
86
80
|
"@opentelemetry/sdk-node": "0.53.0",
|
|
87
81
|
"@opentelemetry/sdk-trace-base": "1.26.0",
|
|
88
82
|
"@opentelemetry/sdk-trace-node": "1.26.0",
|
|
89
83
|
"@opentelemetry/semantic-conventions": "1.27.0",
|
|
84
|
+
"@opentelemetry/winston-transport": "0.6.0",
|
|
90
85
|
"@prisma/instrumentation": "5.19.1",
|
|
91
|
-
"@sentry/node": "8.
|
|
92
|
-
"@sentry/opentelemetry": "8.
|
|
86
|
+
"@sentry/node": "8.33.0",
|
|
87
|
+
"@sentry/opentelemetry": "8.33.0",
|
|
93
88
|
"tslib": "2.7.0"
|
|
94
89
|
},
|
|
95
90
|
"devDependencies": {
|