Skip to content

Conversation

subsunj
Copy link
Contributor

@subsunj subsunj commented Jun 15, 2023

These changes would give feature parity (and a bit more) with trace4cats-sttp. Example use case needed in my team: set peer.service attribute based on the request URL.

Changes in the PR:

  • Add request attributes getter
  • Add response attributes getter
  • Add dropHeadersWhen

This PR is a shared effort with @BjoernJeschke

import trace4cats.optics.{Getter, Lens}
import trace4cats.{Span, ToHeaders}

trait ClientSyntax {
implicit class TracedClient[F[_]](client: Client[F]) {

@deprecated("Use liftTraceExtended instead", "0.14.1")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Scala doesn't allow overloading methods with default arguments, bincompat issue couldn't be solved here by making this method package private and overloading with the new method. Hence, this method is deprecated and the newer method had a different name. This also comes with the cost that people will be forced to change to the new method anyways. The alternate (maybe better) option here would be to introduce a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that trace4cats-kafka recently went with a breaking change and a release of the http4s integration should also include the open PR and hence the changes coming from CE 3.5, I think we can go for a breaking change and keep the code clean. If bincompat was taken seriously, we would require MiMa setup anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, let's keep the code clean and go for a breaking change then.

Getter[Response[G], Map[String, AttributeValue]](_ => Map.empty)
)

def liftTraceExtended[G[_]](
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too sure of the naming here.

  - Results in cleaner code
Copy link
Contributor

@ybasket ybasket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ybasket ybasket merged commit d0959a0 into trace4cats:master Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants