Repository navigation
Re-enable injectK / traceK / liftTrace / TracedProducer.create on fs2-kafka 4.1.0 - #293
Merged
alejandrohdezma merged 2 commits intoSep 28, 2026
Conversation
…on fs2-kafka 4.1.0 fs2-kafka 4.1.0 ships `mapK` on the committable types and `imapK` on `KafkaProducer` (typelevel/fs2-kafka#1522), so the four areas disabled in 0.15.0-RC1 can be restored: - `TracedConsumer.injectK` - the `injectK` / `traceK` stream syntax in `Fs2KafkaSyntax` - `TracedProducer.create` - the `liftTrace` producer syntax in `Fs2KafkaSyntax` Bump fs2-kafka from 4.0.0 to 4.1.0. `TracedProducer.create` drops the redundant `Monad[G]` context bound, since the implicit `MonadCancelThrow[G]` already implies it, so the method compiles cleanly under -Werror. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4.1.0 starts polling at subscribe time instead of when the stream is consumed (typelevel/fs2-kafka#1524), which surfaces as `NoOffsetForPartitionException` restart loops. 4.1.1 reverts that and still ships `CommittableConsumerRecord#mapK` and `KafkaProducer#imapK`, which this branch builds on.
alejandrohdezma
marked this pull request as ready for review
September 28, 2026 15:49
This was referenced Sep 28, 2026
scala-steward
pushed a commit
to scala-steward/trace4cats-kafka
that referenced
this pull request
Oct 1, 2026
fs2-kafka 4 removed `CommittableOffset#consumerGroupId`, so the migration in trace4cats#293 dropped the `consumer.group` attribute from `kafka.receive` spans. The group id is still reachable through `KafkaCommitter#metadata`, which calls the blocking `groupMetadata()` on the underlying consumer, so it is fetched once per committer and cached for the rest of the stream. A failing fetch (no `group.id` configured) falls back to an empty string, as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fs2-kafka 4.1.0 is out on Maven Central, and it ships the two pieces that
0.15.0-RC1was waiting on from typelevel/fs2-kafka#1522:mapKon the committable consumer types andimapKonKafkaProducer. With those available, the four areas that had to be temporarily disabled during the fs2-kafka 4.x migration can come back, which unblocks the final0.15.0.What this restores
TracedConsumer.injectK— lifts the traced stream intoGand rebuilds each record withCommittableConsumerRecord#mapK, which replaces the old package-privateCommittableOffsetreconstruction.TracedProducer.create— wraps the producer inGviaKafkaProducer#imapK, including the transactional methods that 4.x folded intoKafkaProducer.injectK/traceKstream syntax and theliftTraceproducer syntax inFs2KafkaSyntax, plus their imports.Dependency bump
fs2-kafkagoes from4.0.0to4.1.0inproject/dependencies.conf. That is the release that makesmapK/imapKavailable.Signature note
TracedProducer.createkeeps the intended shape from the sketch, with one small change: theMonad[G]context bound is dropped because the implicitMonadCancelThrow[G]already impliesMonad[G], and leaving it in trips-Werroras an unused implicit. Everything else matches the commented-out signatures that were left inmain.The
consumer.groupspan attribute stays dropped —CommittableOffset.consumerGroupIdis genuinely gone in fs2-kafka 4.x, so there is nothing to restore there.Checks
sbt ci-testis green locally: scalafmt / scalafix,versionPolicyCheck,mdoc,publishLocal, and+testall pass, cross-built on Scala 2.13.18 and 3.3.8.