@pocket-tools/tracing 1.4.1 → 1.4.4

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.
@@ -14,76 +14,80 @@
14
14
  ESM Build start
15
15
  CJS You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin
16
16
  ESM You have emitDecoratorMetadata enabled but @swc/core was not installed, skipping swc plugin
17
- ESM dist/index.mjs 7.83 KB
18
- ESM ⚡️ Build success in 81ms
19
- CJS dist/index.js 10.39 KB
20
- CJS ⚡️ Build success in 81ms
17
+ ESM dist/index.mjs 7.79 KB
18
+ ESM ⚡️ Build success in 197ms
19
+ CJS dist/index.js 10.35 KB
20
+ CJS ⚡️ Build success in 201ms
21
21
  DTS Build start
22
- DTS ⚡️ Build success in 5887ms
22
+ DTS ⚡️ Build success in 8407ms
23
23
  DTS dist/index.d.ts 1.41 KB
24
24
  DTS dist/index.d.mts 1.41 KB
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
- [4:19:58 PM] [semantic-release] › ℹ Running semantic-release version 24.1.0
30
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
31
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
32
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
33
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
34
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
35
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
36
- [4:19:59 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
37
- [4:20:02 PM] [semantic-release] › ✔ Run automated release from branch main on repository git+https://github.com/Pocket/pocket-monorepo.git
38
- [4:20:02 PM] [semantic-release] › ✔ Allowed to push to the Git repository
39
- [4:20:02 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
40
- [4:20:02 PM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
41
- [4:20:02 PM] [semantic-release] [@semantic-release/npm] › ℹ Wrote NPM_TOKEN to /tmp/479afa050cdf97b0d6a23b2d7529c494/.npmrc
29
+ [7:08:23 PM] [semantic-release] › ℹ Running semantic-release version 24.1.0
30
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
31
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
32
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
33
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
34
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
35
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
36
+ [7:08:25 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
37
+ [7:08:28 PM] [semantic-release] › ✔ Run automated release from branch main on repository git+https://github.com/Pocket/pocket-monorepo.git
38
+ [7:08:28 PM] [semantic-release] › ✔ Allowed to push to the Git repository
39
+ [7:08:28 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/npm"
40
+ [7:08:28 PM] [semantic-release] [@semantic-release/npm] › ℹ Verify authentication for registry https://registry.npmjs.org/
41
+ [7:08:28 PM] [semantic-release] [@semantic-release/npm] › ℹ Wrote NPM_TOKEN to /tmp/0b1b681bfb36bf2b84b2b460ce55696c/.npmrc
42
42
  pocket-npm
43
- [4:20:03 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
44
- [4:20:03 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
45
- [4:20:03 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
46
- [4:20:03 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
47
- [4:20:03 PM] [semantic-release] › ℹ Found git tag @pocket-tools/tracing-v1.4.0 associated with version 1.4.0 on branch main
48
- [4:20:04 PM] [semantic-release] › ℹ Found 3 commits since last release
49
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
50
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
51
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Found 1 commits for package @pocket-tools/tracing since last release
52
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: fix(deps): update prisma monorepo to v5.19.0 (#711)
43
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/npm"
44
+ [7:08:29 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
45
+ [7:08:29 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
46
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
47
+ [7:08:29 PM] [semantic-release] › ℹ Found git tag @pocket-tools/tracing-v1.4.3 associated with version 1.4.3 on branch main
48
+ [7:08:29 PM] [semantic-release] › ℹ Found 9 commits since last release
49
+ [7:08:29 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
50
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
51
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Found 2 commits for package @pocket-tools/tracing since last release
52
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: fix(deps): update sentry-javascript monorepo to v8.30.0 (#758)
53
53
 
54
54
  Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
55
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The release type for the commit is patch
56
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analysis of 1 commits complete: patch release
57
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
58
- [4:20:04 PM] [semantic-release] ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
59
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
60
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] ℹ Plugin "@semantic-release/release-notes-generator" does not provide step "analyzeCommits"
61
- [4:20:04 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
62
- [4:20:04 PM] [semantic-release] ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
63
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/npm" does not provide step "analyzeCommits"
64
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
65
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
66
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/github" does not provide step "analyzeCommits"
67
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
68
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
69
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
70
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
71
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
72
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
73
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
74
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
75
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
76
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
77
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
78
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
79
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
80
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
81
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
82
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
83
- [4:20:04 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
84
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
85
- [4:20:04 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
86
- [4:20:04 PM] [semantic-release] › ℹ The next release version is 1.4.1
87
- [4:20:04 PM] [semantic-release] › Start step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
88
- [4:20:04 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/commit-analyzer" does not provide step "generateNotes"
89
- [4:20:04 PM] [semantic-release] › ✔ Completed step "generateNotes" of plugin "[Function: semantic-release-monorepo]"
55
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The release type for the commit is patch
56
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Analyzing commit: chore(strictNull): adding strict null check to all infra (#750)
57
+
58
+ * chore(strictNull): adding strict null check to all infra
59
+
60
+ * fix(packages): updating publish scope for npm
61
+
62
+ * fix(packages): updating publish scope for npm
63
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ The commit should not trigger a release
64
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] Analysis of 2 commits complete: patch release
65
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
66
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
67
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
68
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/release-notes-generator" does not provide step "analyzeCommits"
69
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
70
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
71
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/npm" does not provide step "analyzeCommits"
72
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
73
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
74
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ Plugin "@semantic-release/github" does not provide step "analyzeCommits"
75
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
76
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
77
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
78
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
79
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
80
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
81
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
82
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
83
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
84
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
85
+ [7:08:29 PM] [semantic-release] › Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
86
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
87
+ [7:08:29 PM] [semantic-release] › Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
88
+ [7:08:29 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
89
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
90
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
91
+ [7:08:29 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
92
+ [7:08:29 PM] [semantic-release] [[Function: semantic-release-monorepo]] › ℹ No more plugins
93
+ [7:08:29 PM] [semantic-release] › ✔ Completed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
package/dist/index.js CHANGED
@@ -70,18 +70,6 @@ var additionalInstrumentationConstructors = {
70
70
  KNEX: import_instrumentation_knex.KnexInstrumentation,
71
71
  PRISMA: import_instrumentation.PrismaInstrumentation
72
72
  };
73
- var tracingDefaults = {
74
- serviceName: "unknown",
75
- release: "unknown",
76
- samplingRatio: 0.01,
77
- graphQLDepth: 8,
78
- grpcDefaultPort: 4317,
79
- httpDefaultPort: 4318,
80
- host: "otlpcollector",
81
- logger: new import_api.DiagConsoleLogger(),
82
- addSentry: false,
83
- additionalInstrumentations: []
84
- };
85
73
  var SentryContextManager = (0, import_opentelemetry.wrapContextManagerClass)(
86
74
  import_context_async_hooks.AsyncLocalStorageContextManager
87
75
  );
@@ -99,8 +87,8 @@ function awaitAttributes(detector) {
99
87
  };
100
88
  }
101
89
  async function nodeSDKBuilder(config) {
102
- config = { ...tracingDefaults, ...config };
103
- import_api.diag.setLogger(config.logger, import_api.DiagLogLevel.WARN);
90
+ var _a, _b, _c;
91
+ import_api.diag.setLogger((_a = config.logger) != null ? _a : new import_api.DiagConsoleLogger(), import_api.DiagLogLevel.WARN);
104
92
  const _resource = import_resources.Resource.default().merge(
105
93
  new import_resources.Resource({
106
94
  [import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: config.serviceName,
@@ -112,11 +100,15 @@ async function nodeSDKBuilder(config) {
112
100
  url: `http://${config.host}:${config.grpcDefaultPort}`
113
101
  });
114
102
  const _spanProcessors = [
115
- new CustomAWSXraySpanProcessor(_traceExporter, config.samplingRatio, {
116
- // only force 100ms between 2 batch exports.
117
- // Default is 5000ms which is 5 seconds and causes us to lose spans
118
- scheduledDelayMillis: 100
119
- })
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
110
+ }
111
+ )
120
112
  ];
121
113
  if (config.addSentry) {
122
114
  _spanProcessors.push(new CustomSentrySpanProcessor());
@@ -142,7 +134,7 @@ async function nodeSDKBuilder(config) {
142
134
  new import_instrumentation_mysql2.MySQL2Instrumentation({}),
143
135
  new import_instrumentation_net.NetInstrumentation({})
144
136
  ];
145
- config.additionalInstrumentations.forEach((instrumentation) => {
137
+ ((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
146
138
  instrumentations.push(
147
139
  new additionalInstrumentationConstructors[instrumentation]()
148
140
  );
@@ -191,7 +183,7 @@ var CustomAWSXraySpanProcessor = class extends import_sdk_trace_base.BatchSpanPr
191
183
  span.attributes,
192
184
  span.links
193
185
  );
194
- if (sampleResult.decision == import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
186
+ if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
195
187
  super.onStart(span, parentContext);
196
188
  }
197
189
  }
@@ -207,7 +199,7 @@ var CustomAWSXraySpanProcessor = class extends import_sdk_trace_base.BatchSpanPr
207
199
  span.links
208
200
  );
209
201
  this.contextMap.delete(span.spanContext().traceId);
210
- if (sampleResult.decision == import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
202
+ if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
211
203
  super.onEnd(span);
212
204
  }
213
205
  }
@@ -217,7 +209,11 @@ var CustomSentrySpanProcessor = class extends import_opentelemetry.SentrySpanPro
217
209
  constructor() {
218
210
  super();
219
211
  this.contextMap = /* @__PURE__ */ new Map();
220
- this.sampler = new import_opentelemetry.SentrySampler(Sentry.getClient());
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);
221
217
  }
222
218
  onStart(span, parentContext) {
223
219
  this.contextMap.set(span.spanContext().traceId, parentContext);
@@ -229,7 +225,7 @@ var CustomSentrySpanProcessor = class extends import_opentelemetry.SentrySpanPro
229
225
  span.attributes,
230
226
  span.links
231
227
  );
232
- if (sampleResult.decision == import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
228
+ if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
233
229
  super.onStart(span, parentContext);
234
230
  }
235
231
  }
@@ -245,7 +241,7 @@ var CustomSentrySpanProcessor = class extends import_opentelemetry.SentrySpanPro
245
241
  span.links
246
242
  );
247
243
  this.contextMap.delete(span.spanContext().traceId);
248
- if (sampleResult.decision == import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
244
+ if (sampleResult.decision === import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED) {
249
245
  super.onEnd(span);
250
246
  }
251
247
  }
package/dist/index.mjs CHANGED
@@ -53,18 +53,6 @@ var additionalInstrumentationConstructors = {
53
53
  KNEX: KnexInstrumentation,
54
54
  PRISMA: PrismaInstrumentation
55
55
  };
56
- var tracingDefaults = {
57
- serviceName: "unknown",
58
- release: "unknown",
59
- samplingRatio: 0.01,
60
- graphQLDepth: 8,
61
- grpcDefaultPort: 4317,
62
- httpDefaultPort: 4318,
63
- host: "otlpcollector",
64
- logger: new DiagConsoleLogger(),
65
- addSentry: false,
66
- additionalInstrumentations: []
67
- };
68
56
  var SentryContextManager = wrapContextManagerClass(
69
57
  AsyncLocalStorageContextManager
70
58
  );
@@ -82,8 +70,8 @@ function awaitAttributes(detector) {
82
70
  };
83
71
  }
84
72
  async function nodeSDKBuilder(config) {
85
- config = { ...tracingDefaults, ...config };
86
- diag.setLogger(config.logger, DiagLogLevel.WARN);
73
+ var _a, _b, _c;
74
+ diag.setLogger((_a = config.logger) != null ? _a : new DiagConsoleLogger(), DiagLogLevel.WARN);
87
75
  const _resource = Resource.default().merge(
88
76
  new Resource({
89
77
  [SEMRESATTRS_SERVICE_NAME]: config.serviceName,
@@ -95,11 +83,15 @@ async function nodeSDKBuilder(config) {
95
83
  url: `http://${config.host}:${config.grpcDefaultPort}`
96
84
  });
97
85
  const _spanProcessors = [
98
- new CustomAWSXraySpanProcessor(_traceExporter, config.samplingRatio, {
99
- // only force 100ms between 2 batch exports.
100
- // Default is 5000ms which is 5 seconds and causes us to lose spans
101
- scheduledDelayMillis: 100
102
- })
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
93
+ }
94
+ )
103
95
  ];
104
96
  if (config.addSentry) {
105
97
  _spanProcessors.push(new CustomSentrySpanProcessor());
@@ -125,7 +117,7 @@ async function nodeSDKBuilder(config) {
125
117
  new MySQL2Instrumentation({}),
126
118
  new NetInstrumentation({})
127
119
  ];
128
- config.additionalInstrumentations.forEach((instrumentation) => {
120
+ ((_c = config.additionalInstrumentations) != null ? _c : []).forEach((instrumentation) => {
129
121
  instrumentations.push(
130
122
  new additionalInstrumentationConstructors[instrumentation]()
131
123
  );
@@ -174,7 +166,7 @@ var CustomAWSXraySpanProcessor = class extends BatchSpanProcessor {
174
166
  span.attributes,
175
167
  span.links
176
168
  );
177
- if (sampleResult.decision == SamplingDecision.RECORD_AND_SAMPLED) {
169
+ if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
178
170
  super.onStart(span, parentContext);
179
171
  }
180
172
  }
@@ -190,7 +182,7 @@ var CustomAWSXraySpanProcessor = class extends BatchSpanProcessor {
190
182
  span.links
191
183
  );
192
184
  this.contextMap.delete(span.spanContext().traceId);
193
- if (sampleResult.decision == SamplingDecision.RECORD_AND_SAMPLED) {
185
+ if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
194
186
  super.onEnd(span);
195
187
  }
196
188
  }
@@ -200,7 +192,11 @@ var CustomSentrySpanProcessor = class extends SentrySpanProcessor {
200
192
  constructor() {
201
193
  super();
202
194
  this.contextMap = /* @__PURE__ */ new Map();
203
- this.sampler = new SentrySampler(Sentry.getClient());
195
+ const sentryClient = Sentry.getClient();
196
+ if (!sentryClient) {
197
+ throw new Error("Sentry client is not initialized");
198
+ }
199
+ this.sampler = new SentrySampler(sentryClient);
204
200
  }
205
201
  onStart(span, parentContext) {
206
202
  this.contextMap.set(span.spanContext().traceId, parentContext);
@@ -212,7 +208,7 @@ var CustomSentrySpanProcessor = class extends SentrySpanProcessor {
212
208
  span.attributes,
213
209
  span.links
214
210
  );
215
- if (sampleResult.decision == SamplingDecision.RECORD_AND_SAMPLED) {
211
+ if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
216
212
  super.onStart(span, parentContext);
217
213
  }
218
214
  }
@@ -228,7 +224,7 @@ var CustomSentrySpanProcessor = class extends SentrySpanProcessor {
228
224
  span.links
229
225
  );
230
226
  this.contextMap.delete(span.spanContext().traceId);
231
- if (sampleResult.decision == SamplingDecision.RECORD_AND_SAMPLED) {
227
+ if (sampleResult.decision === SamplingDecision.RECORD_AND_SAMPLED) {
232
228
  super.onEnd(span);
233
229
  }
234
230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocket-tools/tracing",
3
- "version": "1.4.1",
3
+ "version": "1.4.4",
4
4
  "description": "Utilities for tracing",
5
5
  "keywords": [
6
6
  "tracing"
@@ -66,44 +66,47 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@opentelemetry/api": "1.9.0",
69
- "@opentelemetry/context-async-hooks": "1.25.1",
70
- "@opentelemetry/core": "1.25.1",
71
- "@opentelemetry/exporter-trace-otlp-grpc": "0.52.1",
72
- "@opentelemetry/exporter-trace-otlp-http": "0.52.1",
69
+ "@opentelemetry/context-async-hooks": "1.26.0",
70
+ "@opentelemetry/core": "1.26.0",
71
+ "@opentelemetry/exporter-trace-otlp-grpc": "0.53.0",
72
+ "@opentelemetry/exporter-trace-otlp-http": "0.53.0",
73
73
  "@opentelemetry/id-generator-aws-xray": "1.2.2",
74
- "@opentelemetry/instrumentation": "0.52.1",
75
- "@opentelemetry/instrumentation-aws-sdk": "0.43.1",
76
- "@opentelemetry/instrumentation-dataloader": "0.11.0",
77
- "@opentelemetry/instrumentation-express": "0.41.1",
78
- "@opentelemetry/instrumentation-graphql": "0.42.0",
79
- "@opentelemetry/instrumentation-http": "0.52.1",
80
- "@opentelemetry/instrumentation-knex": "0.39.0",
81
- "@opentelemetry/instrumentation-mysql2": "0.40.0",
82
- "@opentelemetry/instrumentation-net": "0.38.0",
83
- "@opentelemetry/propagator-aws-xray": "1.25.1",
84
- "@opentelemetry/resource-detector-aws": "1.5.2",
85
- "@opentelemetry/resources": "1.25.1",
86
- "@opentelemetry/sdk-node": "0.52.1",
87
- "@opentelemetry/sdk-trace-base": "1.25.1",
88
- "@opentelemetry/sdk-trace-node": "1.25.1",
89
- "@opentelemetry/semantic-conventions": "1.25.1",
90
- "@prisma/instrumentation": "5.19.0",
91
- "@sentry/node": "8.27.0",
92
- "@sentry/opentelemetry": "8.27.0",
93
- "tslib": "2.6.3"
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
+ "@opentelemetry/instrumentation-knex": "0.40.0",
81
+ "@opentelemetry/instrumentation-mysql2": "0.41.0",
82
+ "@opentelemetry/instrumentation-net": "0.39.0",
83
+ "@opentelemetry/propagator-aws-xray": "1.26.0",
84
+ "@opentelemetry/resource-detector-aws": "1.6.1",
85
+ "@opentelemetry/resources": "1.26.0",
86
+ "@opentelemetry/sdk-node": "0.53.0",
87
+ "@opentelemetry/sdk-trace-base": "1.26.0",
88
+ "@opentelemetry/sdk-trace-node": "1.26.0",
89
+ "@opentelemetry/semantic-conventions": "1.27.0",
90
+ "@prisma/instrumentation": "5.19.1",
91
+ "@sentry/node": "8.30.0",
92
+ "@sentry/opentelemetry": "8.30.0",
93
+ "tslib": "2.7.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@jest/globals": "29.7.0",
97
97
  "@pocket-tools/eslint-config": "workspace:*",
98
98
  "@types/jest": "29.5.12",
99
- "@types/node": "^20.16",
99
+ "@types/node": "^22.5.2",
100
100
  "jest": "29.7.0",
101
101
  "semantic-release": "24.1.0",
102
102
  "semantic-release-monorepo": "8.0.2",
103
- "ts-jest": "29.2.4",
103
+ "ts-jest": "29.2.5",
104
104
  "ts-node": "10.9.2",
105
105
  "tsconfig": "workspace:*",
106
106
  "tsup": "8.2.4",
107
107
  "typescript": "5.5.4"
108
+ },
109
+ "publishConfig": {
110
+ "access": "public"
108
111
  }
109
112
  }