Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
@cacoco Some light reading, I see. Thanks! I suspect I might enjoy another IPA - and dive into this twitter bliss tomorrow. Cheers! :)
Abel Miguez
Hi all, quick question here: what would you say is the minimal finagle version supporting scala 2.13.x? I thought Finagle 20.4.1 but I am not sure as I saw some more recent twitter/finatra@26c1e81 indicating that they would get it closer to 2.13 support. From @yugangong message I would understand is the February release.
3 replies
Brian P. Holt
Is there a way to add extra code to the companion objects generated by scrooge? I have some typeclass instances that could usefully be placed there to take advantage of the way implicit resolution works, but it’s not clear to me how one could do that.
2 replies
Niko Dziemba


Is it possible to disable finagle's tracing for a given http request after it has already been selected
for sampling? I'm looking for something like c.t.f.tracing.Trace.cancelSampling() which I can call in my http handler.

Usecase: We have an http server with fairly low RPS and thus a high sampling rate.
We now want to exclude all healthcheck requests from tracing though since they are high in volume
and not needed (they cannot be extracted to an admin http server or similar for various reasons)


Hamdi Allam

@dziemba You can adjust the sampled flag in of the current trace id.

// in handler
Trace.letIdOption(Trace.idOption.map(id => id.copy(_sampled = Some(false)))) { ... continue the http handler here  ... }

This would only prevent the code within the closure from tracing. Depending on where in the stack this closure is placed, some of finagle's default traces could still be emitted. Can you create an GH issue about this? Are you using barebones finagle or finatra for your http server?

Niko Dziemba
@hamdiallam I had a similar idea but I think that won't help much since in the http handler itself nothing happens that would create more traces. We need to cancel the "outer" traces somehow. I'm using bare finagle. Sure, I'll create a GH issue for this. Thanks!
Niko Dziemba
Prateek Jain
Is there a way to refresh the SSL context of an existing finagle client without disposing and recreating the client again ?
Perhaps this is a feature request for Scrooge but I'd like to know if it is possible to support getting an immutable binary type such as com.twitter.io.Buf when generating scala code? The fact that ByteBuffer is mutable might cause all sorts of trouble if you're not careful. Just copying it without using asReadOnly changes the underlying position in the array and if you try to protect yourself with read only it can fail in the thrift service with java.nio.ReadOnlyBufferException. To me it feels like Buf would be the safer option here, ofc something that can be configurable but please correct me if I'm wrong :)
@rogern would you mind creating a github issue to explain your feature request a little more? ty!
1 reply
Hi (this is a crosspost of a SO question: https://stackoverflow.com/questions/66746668/finagle-ketamashardingservicebuilder-is-unknown) I was wondering if someone knows if shardingService and KetamaShardingServiceBuilder have moved to another package or project? To me it looks removed.
11 replies
Dermot Haughey
does Finagle use dependency injection? (manual constructor injection or otherwise)
Christopher Coco
@hderms no, Finagle does not.
At least not via a framework. Some code may be structured to use inversion of control. But for what is classically termed dependency injection, no.
Alessandro Vermeulen
When using backup requests we see that the first request(s) always have a backup request send, presumably because the average response time is 0 or something. How can we fix this?
Alessandro Vermeulen
@cacoco I always envision the params in the stack client to be a kind of DI..
And the use of Java services
Christopher Coco
@spockz since Finatra uses Guice I generally interpret this question as “does Fingale use Guice (or something like it)” and the answer is no. If you’re talking about the general pattern of DI the answer is of course as any framework uses lots of different design patterns and Finagle is no exception.
Alessandro Vermeulen
Right 😊
Alessandro Vermeulen
When using DTAB, does the | just failover on lookup or does it also force failover if the endpoints on the LHS are down?
Denis Mikhaylov
Hi! We've upgraded to Finagle 21.2.0 and Scala 2.13 and now Finagle can't find HttpZipkinTracer even though it's definitely on the classpath. Any ideas why is this happening? Thank you!
15 replies
Alessandro Vermeulen
What happens if you ask the Java service factory for something of that type manually? Do you see it?
Denis Mikhaylov
@spockz was your question addressed to me?
Alessandro Vermeulen
@notxcain not sure I don’t see names in reply threads
Hi Finagle experts, does anyone know why my finagle server throws a CancelledRequestException after one minute? Context: My finagle server calls a downstream server that is really slow and needs longer than 1 minute to answer a request. And, unfortunately, my finagle server never waits for that downstream server's reply, but instead raises a CancelledRequestException after one minute.
Christopher Coco
@bollmann see: http://twitter.github.io/finagle/guide/FAQ.html. The request to you is likely hanging up as it is taking too long for your server to answer.
@cacoco Thanks! I have the same situation: curl ----> (my finagle server, downstream client) -----> some downstream server. Are you saying that curl cancels the request after one minute and that this the reason why my finagle server propagates this cancellation to the downstream client, which will then fail with a CancelledRequestException?
Christopher Coco
@bollmann either curl cuts it or your server configuration cuts it (what’s the request timeout configured by your server) or something between the curl client and your server cuts it after a minute (is the request going through some type of proxy) but yes the interrupt happens to cancel unnecessary work in your Finagle server since no one is listening anymore to receive your response.

@cacoco: The server config is as follows:

      .withAdmissionControl.concurrencyLimit(settings.maxConcurrencyLimit, settings.maxNumberOfWaitingClients)

So I thought that would mean that there is no request timeout imposed by the finagle server by default. Also, my curl client connects via an AWS ELB to the finagle server (maybe this AWS ELB drops the connection after one minute?)

Christopher Coco
@bollmann very likely the ELB
A minute is a really long time
By default neither the Finagle server or curl have a request timeout so what’s left is the ELB.
yes, I'll double check the load-balancer now. I doubt that curl drops the connection itself because even when permitting curl to take longer with --max-time it also drops the connection after one minute
@cacoco exactly. Thanks for making me realise this! :-)
@cacoco: thanks, I just found that my ELB's idle timeout was set to just 60 seconds. So that exactly explains the behavior :-)
@cacoco thanks for debugging my head!
Christopher Coco
@bollmann no problem, happy to be a duck
sukanta ghosh
Hey, I am new to Scala and trying out Finagle, I am stuck with the following configuration where the client is always returning 400. Is there anything missing in the configuration? Some help is appreciated.
 val client: Service[http.Request, http.Response] = Http.client.newService("api.ratesapi.io:443")
  val request = http.Request(http.Method.Get, "/api/latest")
  request.host = "https://api.ratesapi.io"
  request.headerMap.add("Content-Type", "application/json")
  val response: Future[http.Response] = client(request)
  Await.result(response.onSuccess { resp: http.Response => println("Get success" + resp.status) })
5 replies
I am trying to understand how to configure a proxy in a http client, should be simple.
      val clientBuilder = Http.client
        .withStack(x => x.remove(ClientNackFilter.module.role))

      val secureClient = if (false) clientBuilder.withTlsWithoutValidation else clientBuilder
my proxy is http, but the end connection is https, so I been stuck trying to undertand how can send a connect https:// so the tls handshake happens on the proxy
Instead it connects to the proxy and send a clear http request to an https endpoint 443
Alexey Shcherbakov
Hi, I know that ThriftMux client support partitioning, finagle-partitioning package exists. How can I use partitioning for Http client or this client doesn't support it?
Moses Nakamura
@pegerto sorry for the delayed response. I don’t think that’s possible today in Finagle, unfortunately. we would potentially be open to a PR to add that though!
it’s a bit tricky though–we would need to figure out how to move the TLS handshake to be after the CONNECT
@fuCtor it doesn’t currently support it, but we would be open to a PR to add support for it! I think it should be relatively straightforward

Hi, finagle experts. Suppose, I've got two future computations that return values of different types. Is there a way to easily compose these two computations in parallel? Currently, my solution is the following

val computation1: Future[A] = ...
val computation2: Future[B] = ...

val runInParallel: Future[(A, B)] = Future
  .collect(computation1, computation2)
  .map { case Seq(c1, c2) => (c1.asInstanceOf[A], c2.asInstanceOf[B]) }

However, this looks quite clunky in my opinion, so I wonder whether there is a better way to launch computations in parallel and being able to access the results at their concrete types afterwards.

If anybody knows, I'd appreciate a pointer :-) Thanks!

available both as Future.join[A, B](Future[A], Future[B]): Future[(A, B)] as well as Future[A]#join[B](Future[B]): Future[(A, B)]