dapr / dapr/java-sdk

[PROPOSAL] First-class distributed tracing

Abierto
#650 10 comentarios 2 reacciones 0 asignados Ver en GitHub
kind/enhancement
Lenguaje dominante
Java
Estrellas
300
Forks
230
Merge medio
5 d 1 h
PR fusionados (30 d)
5

Descripción

Over the past weeks, I've been struggling [to get distributed tracing to work](https://github.com/dapr/java-sdk/issues/647).

My observation is that a Java application that uses the Dapr SDK for Java does not propagate the `traceparent` HTTP-header from a call it receives _from_ the sidecar back _to_ the sidecar (e.g. one that does `invokeMethod` or `publishEvent`).

Looking at the code, I think that if the sidecar would use gRPC to invoke the Java application, it wouldn't work either - the `grpc-trace-bin`, `traceparent` or `tracestate` headers are propagated but read from an empty Context, it seems. But I haven't been able to let the sidecar talk gRPC to my Java apps, so I'm not 100% sure about this.

Nevertheless, in a platform that wants to simplify distributed systems, I think tracing is an essential thing. I'd love to see the Dapr SDK for Java make it as easy as possible to leverage what Dapr has to offer in this field.

## Describe the proposal
Provide the Dapr client code (at least `DaprClientBuilder`, `DaprHttpBuilder`, `DaprClientHttp` and `DaprClientGrpc` classes, maybe more) with a "strategy" to get a `traceparent` header value. Use that strategy to enrich calls from the application to the sidecar.

The default implementation should return an empty value. A user can supply their own implementation based on the frameworks they are using. For instance, I could envision an implementation that uses OpenTelemetry's `Span` class to find the correct value for the `traceparent` header.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza leyendo DaprClientBuilder, DaprHttpBuilder, DaprClientHttp y DaprClientGrpc; después, sigue cómo se propagan los metadatos HTTP y gRPC desde la aplicación hasta el sidecar. Se considera terminado cuando las API de cliente admiten una estrategia traceparent proporcionada por el usuario, el valor predeterminado devuelve un valor vacío y las llamadas pueden enriquecerse con el encabezado resultante.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
grpc, java
Área
backend-api-design, distributed-systems, observability-sre
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.