@moostjs/otel 0.4.14 → 0.4.15

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/dist/index.cjs CHANGED
@@ -217,8 +217,17 @@ class SpanInjector extends moost.ContextInjector {
217
217
  if (method === '__SYSTEM__') {
218
218
  return;
219
219
  }
220
+ const { getSpan } = useOtelContext();
220
221
  if (name === 'Handler:not_found') {
221
222
  const chm = this.getControllerHandlerMeta();
223
+ const span = getSpan();
224
+ if (span) {
225
+ const eventType = this.getEventType();
226
+ if (eventType === 'HTTP') {
227
+ const req = this.getRequest();
228
+ span.updateName(`${req?.method || ''} ${req?.url}`);
229
+ }
230
+ }
222
231
  this.startEventMetrics(chm.attrs, route);
223
232
  }
224
233
  else if (name === 'Controller:registered') {
@@ -227,7 +236,6 @@ class SpanInjector extends moost.ContextInjector {
227
236
  if (!chm.ignoreMeter) {
228
237
  this.startEventMetrics(chm.attrs, _route);
229
238
  }
230
- const { getSpan } = useOtelContext();
231
239
  const span = getSpan();
232
240
  if (span) {
233
241
  span.setAttributes(chm.attrs);
package/dist/index.mjs CHANGED
@@ -215,8 +215,17 @@ class SpanInjector extends ContextInjector {
215
215
  if (method === '__SYSTEM__') {
216
216
  return;
217
217
  }
218
+ const { getSpan } = useOtelContext();
218
219
  if (name === 'Handler:not_found') {
219
220
  const chm = this.getControllerHandlerMeta();
221
+ const span = getSpan();
222
+ if (span) {
223
+ const eventType = this.getEventType();
224
+ if (eventType === 'HTTP') {
225
+ const req = this.getRequest();
226
+ span.updateName(`${req?.method || ''} ${req?.url}`);
227
+ }
228
+ }
220
229
  this.startEventMetrics(chm.attrs, route);
221
230
  }
222
231
  else if (name === 'Controller:registered') {
@@ -225,7 +234,6 @@ class SpanInjector extends ContextInjector {
225
234
  if (!chm.ignoreMeter) {
226
235
  this.startEventMetrics(chm.attrs, _route);
227
236
  }
228
- const { getSpan } = useOtelContext();
229
237
  const span = getSpan();
230
238
  if (span) {
231
239
  span.setAttributes(chm.attrs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/otel",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "@moostjs/otel",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -39,6 +39,6 @@
39
39
  "dependencies": {
40
40
  "@opentelemetry/api": "^1.9.0",
41
41
  "@opentelemetry/sdk-trace-base": "^1.25.1",
42
- "moost": "0.4.14"
42
+ "moost": "0.4.15"
43
43
  }
44
44
  }