@mastra/observability 1.23.1-alpha.0 → 1.23.1-alpha.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/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/pricing-data.json +238 -217
- package/dist/spans/base.d.ts +2 -0
- package/dist/spans/base.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3737,6 +3737,11 @@ var BaseSpan = class BaseSpan {
|
|
|
3737
3737
|
this.correlationContext = void 0;
|
|
3738
3738
|
}
|
|
3739
3739
|
}
|
|
3740
|
+
/** Read at export time, not from the cached correlation context, so a service name set on update or end wins over the config. */
|
|
3741
|
+
resolveServiceName() {
|
|
3742
|
+
const value = this.metadata?.serviceName;
|
|
3743
|
+
return typeof value === "string" ? value : this.observabilityInstance.getConfig().serviceName;
|
|
3744
|
+
}
|
|
3740
3745
|
/**
|
|
3741
3746
|
* Build and cache the canonical correlation context for this live span.
|
|
3742
3747
|
*
|
|
@@ -3801,7 +3806,7 @@ var BaseSpan = class BaseSpan {
|
|
|
3801
3806
|
requestId: getMetadataString("requestId"),
|
|
3802
3807
|
environment: getMetadataString("environment") ?? this.observabilityInstance.getMastraEnvironment?.(),
|
|
3803
3808
|
source: getMetadataString("source"),
|
|
3804
|
-
serviceName:
|
|
3809
|
+
serviceName: this.resolveServiceName(),
|
|
3805
3810
|
experimentId: getMetadataString("experimentId")
|
|
3806
3811
|
};
|
|
3807
3812
|
return this.correlationContext;
|
|
@@ -3813,6 +3818,7 @@ var BaseSpan = class BaseSpan {
|
|
|
3813
3818
|
const nestedUnderParent = this.traceState?.nestedUnderParent ?? false;
|
|
3814
3819
|
const links = validLinks(this.links);
|
|
3815
3820
|
const correlation = this.getCorrelationContext();
|
|
3821
|
+
const serviceName = this.resolveServiceName();
|
|
3816
3822
|
const timeToFirstTokenMs = this.attributes?.timeToFirstTokenMs;
|
|
3817
3823
|
return {
|
|
3818
3824
|
id: this.id,
|
|
@@ -3837,6 +3843,7 @@ var BaseSpan = class BaseSpan {
|
|
|
3837
3843
|
isRootSpan: this.isRootSpan,
|
|
3838
3844
|
...this.isInternal ? { isInternal: true } : {},
|
|
3839
3845
|
...correlation.entityVersionId ? { entityVersionId: correlation.entityVersionId } : {},
|
|
3846
|
+
...serviceName ? { serviceName } : {},
|
|
3840
3847
|
...definedLineage(correlation),
|
|
3841
3848
|
parentSpanId: this.getParentSpanId(includeInternalSpans),
|
|
3842
3849
|
externalParentSpanId: this.getExportedExternalParentSpanId(includeInternalSpans),
|