https://kotlinlang.org logo
#ktor
Title
# ktor
m

Matias Reparaz

08/11/2021, 2:06 PM
Hi, I had the next scenario, some client calls a service A with header H, service A needs to call service B propagating the same header H. Is there any feature, or plug-in, or something to do this without moving around this information all over the A service? I’m using ktor client and server in each service
a

Aleksei Tirman [JB]

08/11/2021, 3:35 PM
What do you mean by moving around this information all over the A service? Could you just call a service B in the first place?
m

Matias Reparaz

08/11/2021, 8:31 PM
I mean that the request is handled in a class (e.g. SomethingHandler) that delegates to some action, that depends on some gateway and that gateway calls the service B. I don’t want to add the headers through all this layers
m

Michael Strasser

08/12/2021, 1:22 AM
You might find ideas in https://github.com/mjstrasser/ktor-features-zipkin I wrote it a while ago to investigate how tracing might be implemented in Ktor. (It does not actually emit trace information to Prometheus or anything so it is incomplete.) But you could use the technique to attach headers into
ApplicationCall
and use them in clients.
👏 1
👀 1
m

Matias Reparaz

08/12/2021, 12:54 PM
Great, thank you!
2 Views