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

MCP: add a structured Cloudflare Workers summary to inspect_span

未关闭
#1,874 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
ai, observability

调研方向

Start with the UI Cloudflare adapter in packages/ui/src/lib/cloud-platforms/cloudflare.ts to see how it detects Workers and maps fields, then read apps/ai/src/mcp/tools/inspect-span.ts for the raw attribute output. The change moves detection and mapping into shared pure logic and adds an optional Workers section to the MCP result. Done means tests cover missing fields, zero timing values, and a renamed custom span that keeps its stored name and IDs, and the guidance text covers the clock, sampling, and propagation limits.

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

描述

Problem

Maple's web UI already interprets Cloudflare Workers attributes, but MCP inspect_span exposes those fields as raw span/resource attribute maps. An agent must repeatedly work out which fields identify the script, version, execution region, CPU time, wall time, TTFB, and Ray ID.

A compact structured Cloudflare summary would make incident analysis more consistent and reduce the amount of attribute interpretation each agent must do.

Existing support and code

Maple already documents native Workers OTLP destinations. Checked against main at 7edfccb17c3f524f9d793e0a11893fcf0535737e:

  • The UI Cloudflare adapter detects Workers and displays script/version, handler, execution model, CPU/wall time, TTFB, colo/region, location, outcome, and Ray ID.
  • inspect_span provides raw attributes and a special decoded view for AI spans.

Proposed change

Add an optional Cloudflare Workers section to the structured and text output of inspect_span. Align its detection and field mapping with the existing UI adapter, preferably through shared pure logic that has no UI dependency.

Include fields when present: script name/version, handler, execution model, colo/region, CPU time in ms, wall time in ms, TTFB in ms, outcome, and Ray ID. Preserve the full raw attribute maps. Missing fields should stay missing; zero is a valid timing value.

Add concise Workers-specific interpretation notes to MCP guidance:

  • Zero-duration spans can result from the Workers clock advancing on I/O; they do not prove that no CPU work occurred.
  • A trace ID in a log or response does not guarantee that spans were stored. Logs can retain IDs when tracing is disabled or a request is not sampled.
  • The current spanContext().traceFlags value does not reflect head sampling and must not be used to construct downstream traceparent headers.
  • Automatic trace-context propagation has limits; missing downstream spans do not prove that no downstream call occurred.

Relation to the latest Cloudflare update

The October 26, 2026 update adds spanContext(), setStatus(), and updateName(). It makes native custom spans easier to identify and interpret. The summary should retain the stored operation name and trace/span IDs so an agent can correlate an application-supplied ID with its renamed operation and Cloudflare context.

The requested Cloudflare summary builds on existing exported attributes. Those attributes predate this update. Generic single-span status exposure is tracked separately in #1873. This Cloudflare summary can be implemented independently.

References: Cloudflare custom-span API and limits, Maple's documented Workers caveats.

Acceptance criteria

  • A native Workers span has a consistent Cloudflare summary in MCP and the web UI.
  • Non-Cloudflare spans retain their current response; empty projected cloudflare.* keys do not cause false detection.
  • Tests cover missing fields, zero timing values, and Cloudflare context supplied through span/resource attributes.
  • A fixture with a renamed custom span retains its stored name and IDs through the MCP result.
  • MCP guidance explains the clock, sampling, and propagation limits without claiming that sampling or a root cause can be determined from those fields alone.

Evidence: source and documentation inspection. A live Cloudflare-to-Maple export has not been tested for this report.

主要语言
TypeScript
星标
1.8k
派生
120
平均合并
8 小时 11 分钟
30 天内合并 PR
667

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

MapleTechLabs/maple 的其他 Issue

查看 MapleTechLabs/maple 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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