Skip to content

Add mastra auto-instrumentation#1901

Open
Stephen Belanger (Qard) wants to merge 8 commits intomainfrom
mastra-auto-instrumentation
Open

Add mastra auto-instrumentation#1901
Stephen Belanger (Qard) wants to merge 8 commits intomainfrom
mastra-auto-instrumentation

Conversation

@Qard
Copy link
Copy Markdown
Contributor

Fixes #1890

Summary

  • add Mastra auto-instrumentation configs and wire them into the hook, bundler plugin, webpack loader, and public exports
  • add Mastra tracing channels and a runtime plugin for agent, tool, workflow run, and workflow step spans with current-span context binding
  • add focused Mastra tests and an e2e scenario covering agent generate/stream, Tool.execute, workflow runs, and workflow-step tool nesting

Testing

  • pnpm --dir js exec vitest run src/auto-instrumentations/configs/mastra.test.ts src/instrumentation/plugins/mastra-plugin.test.ts src/instrumentation/registry.test.ts
  • pnpm run test:e2e -- mastra-instrumentation

Notes

  • pnpm --dir js test -- mastra and pnpm --dir js test -- auto-instrumentations still hit unrelated existing network-dependent failures in src/framework.test.ts and src/logger-misc.test.ts
  • pnpm run formatting still reports pre-existing unformatted fixture files under js/tests/auto-instrumentations/fixtures/test-files/

Copy link
Copy Markdown
Member

@lforst Luca Forstner (lforst) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add the mastra e2e test scenario to the ci summary?

Copy link
Copy Markdown
Member

@lforst Luca Forstner (lforst) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the e2e test summary it looks like we don't capture LLM spans.

Image

Do you think that is an issue?

Stephen Belanger (Qard) and others added 8 commits May 6, 2026 18:28
…a directly to interface

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pes for groq/mastra

groq and mastra are runtime-only defaults not user-configurable via
InstrumentationConfig, so they don't belong in the public interface.
Widen getDefaultConfig() and readEnvConfig() return types to
Record<string, boolean> so groq/mastra can be included as defaults
without adding them to the public InstrumentationConfig interface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… unused types

- Remove mastra from BraintrustPluginConfig inline type (api-compat flags
  any change to the inline type string; use getIntegrationConfig dynamic
  lookup instead, same pattern as groq in other integration PRs)
- Remove unused IntegrationName/IntegrationMap type aliases (no longer
  referenced after widening getDefaultConfig/readEnvConfig return types)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Qard Stephen Belanger (Qard) force-pushed the mastra-auto-instrumentation branch from c01e4fd to ffcc4ea Compare May 7, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automatic instrumentation for Mastra

2 participants