-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context service #1408
Context service #1408
Conversation
27f80f1
to
5fce04b
Compare
LGTM. It's probably worth updating the docs (e.g. https://higherkindness.io/mu-scala/guides/distributed-tracing) and the examples repo to reflect these changes. And maybe add a small how-to guide to the docs, showing how to use this feature to access the metadata? |
@cb372 yes! Initially, I was thinking about adding that in this PR, but this is getting bigger, and I prefer to keep this for code/implementation discussions and then open an issue to address that. Good point with the guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides my minor comment, shall we tag this PR as breaking-change
?
modules/fs2/src/main/scala/higherkindness/mu/rpc/internal/client/fs2/calls.scala
Outdated
Show resolved
Hide resolved
@juanpedromoreno this should be backward compatible (besides the deprecated warning) so I think this should be fine without the |
This PR makes the
Span[F]
context abstract so that you can make your service dependant on any "context."The idea comes from #1328
Pending tasks:
Currently, we provide some methods in the companion object for getting a parameterized algebra over
Span[F]
withKleisli
Given:
The method
MyService.tracingClient[F[_]]
provides a:And the method
MyService.bindTracingService[F[_]]
asks for an implicit instance implementation of the algebra parametized withKleisli[F, Span[F], *]
(MyService[Kleisli[F, Span[F], *]]
).In this PR, we're adding alternative methods to those "tracing" ones where you can specify any type as a context as soon you provide a couple of implicit implementations.
The new method
MyService.contextClient[F[_], C]
will require an implicitClientContext[F, C]
:mu-scala/modules/service/src/main/scala/higherkindness/mu/rpc/internal/context/ClientContext.scala
Lines 6 to 15 in 9a0e04b
While the new method
MyService.bindContextService[F[_]]
will require an implicitServerContext[F, C]
mu-scala/modules/service/src/main/scala/higherkindness/mu/rpc/internal/context/ServerContext.scala
Lines 6 to 10 in 9a0e04b
I've chosen
trait
s because the instances need to be parameterized overF
andC
but allow anyReq
andRes
(this is passed in theapply
). I'm open to suggestions for a more ergonomic or better way to provide these implementations.