Repository navigation
feat(server-utils): Map Mastra classifier evaluations to gen_ai.evaluate spans - #25044
Conversation
size-limit report 📦
|
d3c4b79 to
1b15020
Compare
1b15020 to
4c71676
Compare
549d28a to
01f4a44
Compare
| import { safeChannelCallback } from '../tracing-channel'; | ||
| import * as diagnosticsChannel from '../utils/diagnosticsChannel'; | ||
|
|
||
| interface ClassifierEvaluateChannelContext { |
There was a problem hiding this comment.
not specific to this PR, but I think we have an object that looks (almost) exactly like this in most or all of our integrations. we should probably refactor that at some point too
There was a problem hiding this comment.
Agreed, filed JS-3892 to add one shared orchestrion payload type.
| safeChannelCallback(() => { | ||
| const call = calls.get(message as object); | ||
| if (call) { | ||
| finishClassifierEvaluation(call, message as ClassifierEvaluateChannelContext); |
There was a problem hiding this comment.
m/h: it seems mastra default-configures some filters that run on span events, for instance a sensitive data filter: https://mastra.ai/reference/observability/tracing/processors/sensitive-data-filter
iiuc this message object that is copied to the outputs here is stored from the original input so these filters are probably not applied yet? I am concerned this could leak sensitive data
There was a problem hiding this comment.
Good catch. I ended up running their processors over the data before storing it in f12213b.
I was debating wether we should reconstruct the data at all, but figured we are in the o11y business and it makes sense to do so. I'll file an issue upstream.
15ef1ec to
c3f2fa5
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c3f2fa5. Configure here.
…ate spans Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c3f2fa5 to
17acb4b
Compare
## What Adds a node-mastra e2e test that runs a real Jev evaluation through a Mastra `Classifier` (via OpenRouter) and checks the `gen_ai.evaluate` span. ## Why Covers the classifier instrumentation from #25044 against the real provider, not only a mock model.

What
Mastra classifier evaluations (Jev calls through Mastra's
Classifier, its processors and scorers) now show up asgen_ai.evaluatespans with model, provider and token usage. When gen_ai recording is on, they also record the evaluated state, questions and answers.Why
These calls skip the AI SDK hook, and our Mastra exporter dropped their spans, so they were invisible.
Closes: #25031