Automatically trace Cap'n Web RPC calls with Workers custom spans
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- api
Línea de trabajo
Start by tracing the common local dispatch path used by the HTTP batch and WebSocket transports, and review the Agents SDK Cloudflare tracing adapter at packages/agents/src/observability/tracing/cloudflare.ts. Determine how method and property calls can create Workers custom spans, remain active through asynchronous results, and fall back to a no-op runtime. Done means both transports are covered without application instrumentation and existing cross-runtime behavior is preserved.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
Cap'n Web RPC calls do not currently produce a span per method call. Workers automatically traces native Workers RPC calls, but calls using Cap'n Web's HTTP batch or WebSocket transports only have the surrounding runtime spans unless the application instruments every method itself.
Workers now exposes a custom spans API that libraries can use for this:
https://developers.cloudflare.com/workers/observability/traces/custom-spans/
What users have to do today
After enabling observability.traces.enabled, every RPC method that should appear in a trace must be wrapped manually:
import { tracing } from "cloudflare:workers";
import { RpcTarget } from "capnweb";
class Api extends RpcTarget {
getUser(id: string) {
return tracing.enterSpan("capnweb.rpc.getUser", async (span) => {
span.setAttribute("user.id", id);
return loadUser(id);
});
}
}
This is repetitive, easy to omit, and requires application code to know about a runtime-specific API. It also makes consistent span naming and attributes difficult across Cap'n Web applications.
Desired experience
Ideally, users enable Workers tracing and write no Cap'n Web-specific tracing code:
import { RpcTarget } from "capnweb";
class Api extends RpcTarget {
getUser(id: string) {
return loadUser(id);
}
}
Cap'n Web could automatically create a server-side custom span around each incoming method call or property operation. The span should remain active until an asynchronous result settles so nested runtime operations such as fetch(), KV, D1, and user-created spans become children. Errors should still end the span correctly.
The behavior should degrade to a no-op on runtimes that do not expose the Workers tracing API, preserving Cap'n Web's cross-runtime support. The Agents SDK's Cloudflare tracing adapter is a useful example: it imports the cloudflare:workers namespace, detects tracing.startActiveSpan, and falls back to a no-op runtime without changing application behavior:
Design questions
- Should automatic spans be enabled by default whenever Workers tracing is enabled, or exposed through a session option?
- What span name and attributes should identify the method/property path and transport?
- How should spans be bounded for long-lived WebSocket sessions, where calls arrive after the upgrade handler has returned?
- Can the implementation instrument the common local dispatch path so HTTP batch and WebSocket transports behave consistently?
- Lenguaje dominante
- TypeScript
- Estrellas
- 4k
- Forks
- 151
- Merge medio
- 16 h 46 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cloudflare/capnweb
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
cloudflare/capnweb#260 ·
Los mantenedores suelen responder en 2 días
-
onRpcBroken should return a Disposable so registrations can be undoneQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
cloudflare/capnweb#234 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
support `Map` serialization typePosiblemente ocupada @srikrsna la tomó hace 89 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
cloudflare/capnweb#230 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
cloudflare/capnweb#228 ·
Los mantenedores suelen responder en 2 días
-
onRpcBroken callbacks are retained for the session's lifetime after their import is disposed (and fire at teardown)Posiblemente ocupada @ndisidore la tomó hace 11 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
cloudflare/capnweb#210 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de cloudflare/capnweb
Issues similares
-
Add: Yichang TVAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
vtselect: data race in Tempo search tags APIs for invalid TraceQL queriesPosiblemente ocupada @Shubham19032004 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
VictoriaMetrics/VictoriaTraces#304 ·
Los mantenedores suelen responder en 1 día
-
test: claim-conflict drop leaves both facts active and is never re-proposed (untested review cell)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/vscode-pull-request-github#9159 ·
Los mantenedores suelen responder en 1 día
-
[Feature]: Usage page should show API-equivalent cost and say when a connected plan shows info onlyAbiertoenhancement from-x
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
nightly-labs/openbot#4867 ·
Los mantenedores suelen responder en 1 día