otel4s instrumentation for fs2-grpc.
Important
This project is archived.
The integration has moved to the main typelevel/fs2-grpc repository. New users should use fs2-grpc-otel4s-trace from fs2-grpc instead of this repository.
Warning
It's experimental software. Use at your own risk.
- Integrates otel4s tracing with fs2-grpc ClientAspect and ServiceAspect
- Propagates context through gRPC metadata
This repository is no longer the recommended source for the integration.
Use fs2-grpc-otel4s-trace from typelevel/fs2-grpc. While it remains unreleased there, consume the snapshot published from that repository.
The last artifact published from this archived repository was:
libraryDependencies += "io.github.irevive" %% "fs2-grpc-otel4s-trace" % "0.4.0-R1"The API shown below reflects the tracing integration now maintained in fs2-grpc.
The example wires the trace aspects into a generated fs2-grpc service. TestService denotes your service implementation.
import org.typelevel.fs2grpc.trace.*
def tracedService(using TracerProvider[IO]): Resource[IO, ServerServiceDefinition] =
for {
serviceAspect <- Resource.eval(TraceServiceAspect.create[IO])
dispatcher <- Dispatcher.parallel[IO]
} yield TestServiceFs2Grpc.serviceFull(dispatcher, new TestService, serviceAspect, ServerOptions.default)
def tracedClient(channel: Channel)(using TracerProvider[IO]): Resource[IO, TestServiceFs2Grpc[IO, Metadata]] =
for {
clientAspect <- Resource.eval(TraceClientAspect.create[IO])
dispatcher <- Dispatcher.parallel[IO]
} yield TestServiceFs2Grpc.mkClientFull(dispatcher, channel, clientAspect, ClientOptions.default)TraceClientAspect and TraceServiceAspect expose a Config that can be refined before creation.
withTracerNameselects the tracer acquired from the provided TracerProvider.withTextMapUpdater/withTextMapGetteradjust metadata injection - default ASCII key.withSpanNameandwithAttributesoverride naming and attributes - defaults use the gRPC method descriptor and RPC semantic conventions.withFinalizationStrategysets theSpanFinalizer.Strategy- defaults toreportAbnormal.