@mastra/observability 1.17.9-alpha.2 → 1.18.0-alpha.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/dist/index.js CHANGED
@@ -3186,6 +3186,7 @@ var BaseSpan = class BaseSpan {
3186
3186
  requestContext: this.requestContext,
3187
3187
  isEvent: this.isEvent,
3188
3188
  isRootSpan: this.isRootSpan,
3189
+ ...this.isInternal ? { isInternal: true } : {},
3189
3190
  parentSpanId: this.getParentSpanId(includeInternalSpans),
3190
3191
  externalParentSpanId: this.getExportedExternalParentSpanId(includeInternalSpans),
3191
3192
  ...this.isRootSpan && this.tags?.length ? { tags: this.tags } : {}
@@ -4691,11 +4692,13 @@ var BaseObservabilityInstance = class extends MastraBase {
4691
4692
  const enrichedMetadata = this.extractMetadataFromRequestContext(requestContext, mergedMetadata, traceState);
4692
4693
  const finalMetadata = !options.parent ? injectEnvironmentMetadata(enrichedMetadata, this.#mastraEnvironment) : enrichedMetadata;
4693
4694
  const tags = !options.parent ? tracingOptions?.tags : void 0;
4695
+ const name = !options.parent && tracingOptions?.rootSpanName ? tracingOptions.rootSpanName : rest.name;
4694
4696
  const traceId = !options.parent ? options.traceId ?? tracingOptions?.traceId : options.traceId;
4695
4697
  const parentSpanId = options.parentSpanId;
4696
4698
  const externalParentSpanId = !options.parent ? options.externalParentSpanId ?? tracingOptions?.parentSpanId : options.externalParentSpanId;
4697
4699
  const span = this.createSpan({
4698
4700
  ...rest,
4701
+ name,
4699
4702
  traceId,
4700
4703
  parentSpanId,
4701
4704
  externalParentSpanId,
@@ -4745,7 +4748,8 @@ var BaseObservabilityInstance = class extends MastraBase {
4745
4748
  metadata: cached.metadata,
4746
4749
  entityType: cached.entityType,
4747
4750
  entityId: cached.entityId,
4748
- entityName: cached.entityName
4751
+ entityName: cached.entityName,
4752
+ tracingPolicy: cached.isInternal ? { internal: InternalSpans.ALL } : void 0
4749
4753
  });
4750
4754
  this.wireSpanLifecycle(span);
4751
4755
  return span;