typelevel/fs2-grpc
59.5
Adequate · 20 September 2026
3.8k
lines of production code
Scala
primary language
1
measurement over time
What this system is
This system is an fs2-based gRPC library for Scala that provides a runtime for building streaming-capable client and server applications with middleware support. It includes a code generator that produces Scala service definitions from Protocol Buffers, featuring configurable options for Scala 3 compatibility and context handling. The library integrates OpenTelemetry for distributed tracing and enforces backpressure to manage memory usage during high-throughput streaming operations.
How it got here
2018–2020 — Initial project setup and e2e testing
5 changes.
The project was initialized with a Scala 3 build infrastructure, integrating fs2, Cats Effect, and ScalaPB for gRPC code generation. Comprehensive end-to-end tests were added to verify the code generator's handling of proto3 features, various gRPC service shapes, and client/server aspects.
2021–2026 — async runtime and observability overhaul
14 changes.
This period focused on replacing the client and server runtimes with async implementations featuring configurable middleware, backpressure, and shutdown controls. It also introduced comprehensive code generation options for Scala 3 and added a new OpenTelemetry tracing module for distributed observability.
Features
Add fs2-grpc-otel4s-trace module for OpenTelemetry tracing
The new fs2-grpc-otel4s-trace module introduces client and service tracing aspects that integrate OpenTelemetry with fs2-grpc. It provides TraceClientAspect and TraceServiceAspect to create spans for all gRPC call types (unary, streaming, and trailer-based), automatically propagating trace context through gRPC metadata using TextMapGetters and TextMapUpdaters. The module includes GrpcSpanFinalizers to record response status codes, error types, and exceptions on spans according to OpenTelemetry semantic conventions, and CommonAttributes to standardize RPC attributes like rpc.system and rpc.method.
otel4s-trace · high confidence
Initial project setup and documentation
The repository has been initialized with the fs2-grpc library, including configuration files for the Scala Steward bot and Scalafmt (version 3.11.5), an updated .gitignore for IDE and build artifacts, and a comprehensive README.md detailing SBT configuration, client/server creation, code generation options, and OpenTelemetry tracing support.
(repo-wide) · high confidence
Introduce Fs2UnaryCallHandler for unary and streaming gRPC calls
Added Fs2UnaryCallHandler to manage unary and streaming gRPC client calls, implementing backpressure for sending streams and supporting trailers metadata. The handler uses a state machine to process messages and errors, ensuring proper flow control and error handling for both unary and streaming scenarios.
runtime/src/main/scala/fs2/grpc/client/internal · high confidence
New async client runtime with middleware support and configurable options
The client runtime has been replaced with a new async implementation that introduces a \ClientAspect\ and \ClientAspectMiddleware\ system, allowing users to inject custom logic like logging or metrics around gRPC calls. This new runtime also exposes \ClientOptions\ for configuring call behavior, including a \prefetchN\ parameter to control message buffering and an \errorAdapter\ for custom exception mapping.
runtime/src/main/scala/fs2/grpc/client · high confidence
New code generator options for trailers, context rendering, and service suffixes
The sbt-fs2-grpc plugin now exposes several new configuration options to customize generated gRPC code. Users can disable the generation of trailer files via \Fs2GrpcDisableTrailers\, control how context parameters are rendered in Scala 3 using \Fs2GrpcRenderContextAsImplicit\ (switching between \implicit\ and \using\), and append a custom suffix to generated service names with \Fs2GrpcServiceSuffix\. Additionally, support for Scala 3 source generation (\Scala3Sources\) and disabling lenses (\NoLenses\) are now available as explicit code generator options.
plugin · high confidence
Support for client and server aspects in generated companions
The \GeneratedCompanion\ trait in the runtime module now exposes methods to configure client and server behaviors using \ClientAspect\ and \ServiceAspect\. This allows users to inject custom logic, such as metadata modification or context handling, into gRPC client stubs and server service bindings via new \mkClientFull\ and \serviceFull\ methods, alongside their simpler counterparts that use default aspect implementations.
runtime/src/main/scala/fs2/grpc · high confidence
Behavioural changes
Configurable shutdown timeouts for gRPC server and channel resources
The \fs2.grpc.syntax\ package now provides syntax extensions for \ManagedChannelBuilder\ and \ServerBuilder\ that allow users to control how long the system waits for orderly shutdown before forcing termination. In addition to the existing default 30-second timeout, new \resourceWithShutdownTimeout\ and \streamWithShutdownTimeout\ methods accept a \FiniteDuration\ parameter, enabling precise control over cleanup behavior. The API also exposes \resourceWithShutdown\ and \streamWithShutdown\ for fully custom shutdown logic, while maintaining binary compatibility with existing code.
runtime/src/main/scala/fs2/grpc/syntax · high confidence
Implement backpressure for streaming gRPC messages
The runtime now enforces backpressure for both sending and receiving streams. Incoming messages are buffered in an unbounded queue with a configurable prefetch limit to control memory usage, while outgoing streams wait for the underlying gRPC call to signal readiness before sending, preventing unbounded memory growth during high-throughput streaming.
runtime/src/main/scala/fs2/grpc/shared · high confidence
Refactored code generator with new configuration options and Scala 3 support
The code generator has been restructured to support Scala 3 wildcard imports and new configuration parameters. Users can now customize the generated service suffix via the \fs2\_grpc:service\_suffix\ option, disable trailer metadata handling with \fs2\_grpc:disable\_trailers\, and render the context parameter as an implicit (using Scala 3 \using\ clauses) with \fs2\_grpc:render\_context\_as\_implicit\. The internal printer classes have been refactored into a sealed trait hierarchy to support these variations.
codegen · high confidence
Server runtime refactored with new call handling and service aspect middleware
The server runtime in \runtime/src/main/scala/fs2/grpc/server\ has been restructured to introduce a new \ServiceAspect\ and \ServiceAspectMiddleware\ system, allowing users to inject custom logic like logging or metrics around gRPC service calls. This change also brings a new \Fs2ServerCallHandler\ and internal \Fs2UnaryServerCallHandler\ that implement non-blocking unary request handling and support for trailers metadata in streaming calls. Additionally, server configuration is now exposed via \ServerOptions\ (including a \prefetchN\ parameter) and \ServerCallOptions\ (for compression settings), providing finer control over server behavior.
runtime/src/main/scala/fs2/grpc/server · high confidence
Test coverage
Added Fs2GrpcSuite base test class; Added e2e test fixtures for proto3 optional support and gRPC service shapes; Added e2e tests for code generator output and client/server aspects; Added end-to-end tests for OpenTelemetry tracing aspects; Added test coverage for gRPC server call handling and middleware composition; Added tests for StreamIngest prefetch behavior; Added tests for the new async client runtime and middleware support.
Dependencies
Initial project setup with Scala 3, Cats Effect 3, and fs2 3
The build infrastructure is established for the first time, configuring the project to use sbt 1.13.0 and Scala 3. The dependency graph centers on Cats Effect 3.7.1 and fs2 3.14.0, integrating ScalaPB 0.11.20 for protocol buffer handling and otel4s 1.1.0 for OpenTelemetry tracing support. The build also includes sbt-typelevel 0.8.7 for standardized project structure and sbt-protoc 1.0.8 for code generation.
project · high confidence
Upgrade to Scala 3.3.8 and Scala 2.13.18
The project has updated its default Scala versions to 3.3.8 and 2.13.18 (with 2.12.21 still supported), upgrading the underlying Scala libraries and tooling. This change ensures compatibility with the latest Scala releases and includes necessary build configuration adjustments, such as updated MiMa binary compatibility filters and SBT plugin settings, to support the new language features and runtime behaviors.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 60.
Lenses
- Code Health 99
- Architecture 100
- Maturity 53
- Readiness 50
- Security 70
Changes since last survey
- 300 commits — 295 feature/other, 5 fixes
By area
- (repo) — 140 commits
- (root) — 47 commits
- project/build.properties — 36 commits
- project/plugins.sbt — 25 commits
- project/Dependencies.scala — 21 commits
- runtime/src — 13 commits
- .github/workflows — 8 commits
- e2e/src — 5 commits
- plugin/src — 2 commits
- codegen/src — 1 commit
- e2e-otel4s/src — 1 commit
- otel4s-trace/src — 1 commit
Notable commits
- fix: Fix for #800
- fix: Merge pull request #851 from iRevive/topic/fix-propagation
- fix: fix kind-polymorphic warnings
- fix: runtime: fix 2.12 missing parameter type
- fix: runtime: fix deprecated usage in server suite
- change: Add 'Reformat with scalafmt 3.10.2' to .git-blame-ignore-revs
- change: Add Fs2GrpcServiceSuffix, Fs2GrpcDisableTrailers, Fs2GrpcRenderContextAsImplicit code generator options to the README.md
- change: Add Scaladoc for Fs2Grpc services and methods
- change: Add Fs2GrpcRenderContextAsImplicit code generator option
- change: Add Fs2GrpcServiceSuffix code generator option
- change: Add configurable shutdown timeout for server resources and streams
- change: Add fs2-grpc-otel4s-trace module
- change: Add service descriptor to code generator
- change: Add {Client,Service}AspectMiddleware
- change: Allow disabling trailers
- change: Bump tlBaseVersion to 3.0
- change: Bump tlBaseVersion to 3.1
- change: Expose 'prefetchN' parameter in 'ServerOptions'. Move 'f.g.{client => shared}.StreamIngest'.
- change: Make changes binary compatible
- change: Merge branch 'main' into update/munit-cats-effect-2.2.0
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
typelevel/fs2-grpc was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit e8bdb1e99d72f4e8e75a6999398fb7c2d5ca1c83 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.