0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

[MASTRA-2223] Dual Tracing and Tracing Fix (#3453)

## Description

This PR handles two things:
- it adds dual tracing, allowing for both local tracing as well as
tracing using providers
- It fixes an issue with local traces where we were infinitely recursing
when hitting the /api/telemetry endpoint.

The local tracing issue was as such:
- we had setup operation that created traces
- these traces were sent to /api/telemetry to store into the db

However, the act of hitting this endpoint and storing the traces created
more traces, which caused us to hit the endpoint again and store more
traces, which kept going into a loop. It gets to the point where even
starting the server causes upwards of 200,000 traces to be inserted
without any user activity due to this issue.

We solve this issue by filtering out these traces at the exporter level,
ensuring we don't hit the endpoint with traces that are related to the
endpoint.

## Related Issue(s)

<!-- Link to the issue(s) this PR addresses, using hashtag notation:
#123 -->

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [ ] Test update

## Checklist

- [ ] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation (if
applicable)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] I have generated a changeset for this PR
This commit is contained in:
NikAiyer 2025-04-04 14:08:59 -05:00 • committed by GitHub
commit febc8a6412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 119 additions and 19 deletions