Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Eve provider ignores parentTraceContext, so eve.turn is always a root span

已关闭 适合新手
#2,552 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
observability

调研方向

从 src/instrumentation/plugins/eve-instrumentation.ts 中的 turn-started handler 开始,然后将其处理方式与 Eve 的 turn.started 事件所描述的 parentTraceContext 字段进行比较。当一个具有 parentTraceContext 且没有 parentLineage 的 turn 嵌套在所提供的 trace ID 和 span ID 下,同时现有的 parentLineage 和 root span 行为保持不变时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Summary

braintrustEveInstrumentation() always starts eve.turn as a root span, so Eve sessions created inside a traced request show up as separate traces instead of nesting under the caller's span.

Eve already propagates the caller's context. When a session request carries a W3C traceparent, Eve (0.56) sets parentTraceContext on the provider's turn.started event (dist/src/instrumentation/native-events.js). The SDK declares the field on EveProviderTurnStartedEvent (3.35.0, index.d.ts), but the provider bridge's turn-started handler in src/instrumentation/plugins/eve-instrumentation.ts never reads it. When parentLineage is absent, it always uses:

parentSpanIds: { parentSpanIds: [], rootSpanId }   // rootSpanId = this turn's own spanId

startSpan also runs under withCurrent(NOOP_SPAN, ...), so async context can't supply a parent either.

Expected

If turn.started has parentTraceContext and no parentLineage, parent the turn to it:

parentSpanIds: { rootSpanId: parentTraceContext.traceId, spanId: parentTraceContext.spanId }

This assumes the caller's span IDs are W3C-compatible (OTel ID mode), so injectTraceContext() on the caller and Eve's traceparent handling line up. If parentTraceContext.traceFlags marks the context as unsampled, Eve already drops the session, so nothing else is needed.

Repro

  1. Inside traced(...) in a Next.js route, create an Eve session through eve/client and send a traceparent header from injectTraceContext().
  2. Eve 0.56 server with braintrustEveInstrumentation({ metadata }) exported from agent/instrumentation.
  3. In Braintrust logs, eve.turn is the root of its own trace. You can only find it from the caller's trace by searching for eve.session_id.

Versions

  • braintrust 3.33.0 and 3.35.0
  • eve 0.56.0

Why it matters

Online scoring rules on the caller's span can't see Eve's tool calls, such as data an agent loads from its sandbox. Following one request currently means jumping between traces by eve.session_id.

主要语言
TypeScript
星标
29
派生
16
平均合并
1 天 19 小时
30 天内合并 PR
69

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

braintrustdata/braintrust-sdk-javascript 的其他 Issue

查看 braintrustdata/braintrust-sdk-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。