@mastra/observability 0.0.0-feat-mcp-embedded-docs-tools-clean-20260108083625 → 0.0.0-feat-mcp-embedded-docs-tools-clean-20260108110334

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
@@ -4234,9 +4234,7 @@ var CloudExporter = class extends BaseExporter {
4234
4234
  super(config);
4235
4235
  const accessToken = config.accessToken ?? process.env.MASTRA_CLOUD_ACCESS_TOKEN;
4236
4236
  if (!accessToken) {
4237
- this.setDisabled(
4238
- "MASTRA_CLOUD_ACCESS_TOKEN environment variable not set.\n\u{1F680} Sign up at https://cloud.mastra.ai to see your AI traces online and obtain your access token."
4239
- );
4237
+ this.setDisabled("MASTRA_CLOUD_ACCESS_TOKEN environment variable not set.");
4240
4238
  }
4241
4239
  const endpoint = config.endpoint ?? process.env.MASTRA_CLOUD_TRACES_ENDPOINT ?? "https://api.mastra.ai/ai/spans/publish";
4242
4240
  this.config = {
@@ -6035,11 +6033,26 @@ var BaseObservabilityInstance = class extends MastraBase {
6035
6033
  // ============================================================================
6036
6034
  /**
6037
6035
  * Start a new span of a specific SpanType
6036
+ *
6037
+ * Sampling Decision:
6038
+ * - For root spans (no parent): Perform sampling check using the configured strategy
6039
+ * - For child spans: Inherit the sampling decision from the parent
6040
+ * - If parent is a NoOpSpan (not sampled), child is also a NoOpSpan
6041
+ * - If parent is a valid span (sampled), child is also sampled
6042
+ *
6043
+ * This ensures trace-level sampling: either all spans in a trace are sampled or none are.
6044
+ * See: https://github.com/mastra-ai/mastra/issues/11504
6038
6045
  */
6039
6046
  startSpan(options) {
6040
6047
  const { customSamplerOptions, requestContext, metadata, tracingOptions, ...rest } = options;
6041
- if (!this.shouldSample(customSamplerOptions)) {
6042
- return new NoOpSpan({ ...rest, metadata }, this);
6048
+ if (options.parent) {
6049
+ if (!options.parent.isValid) {
6050
+ return new NoOpSpan({ ...rest, metadata }, this);
6051
+ }
6052
+ } else {
6053
+ if (!this.shouldSample(customSamplerOptions)) {
6054
+ return new NoOpSpan({ ...rest, metadata }, this);
6055
+ }
6043
6056
  }
6044
6057
  let traceState;
6045
6058
  if (options.parent) {
@@ -6611,6 +6624,9 @@ var Observability = class extends MastraBase {
6611
6624
  }
6612
6625
  }
6613
6626
  if (config.default?.enabled) {
6627
+ console.warn(
6628
+ '[Mastra Observability] The "default: { enabled: true }" configuration is deprecated and will be removed in a future version. Please use explicit configs with DefaultExporter, CloudExporter, and SensitiveDataFilter instead. See https://mastra.ai/docs/observability/tracing/overview for the recommended configuration.'
6629
+ );
6614
6630
  const defaultInstance = new DefaultObservabilityInstance({
6615
6631
  serviceName: "mastra",
6616
6632
  name: "default",