Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Brian P. Holt
@bpholt
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
@dziemba

Hey!

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)

Cheers

Hamdi Allam
@hamdiallam

@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
@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
@dziemba
Prateek Jain
@prateek13688
Is there a way to refresh the SSL context of an existing finagle client without disposing and recreating the client again ?
Roger
@rogern
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 :)
joybestourous
@joybestourous
@rogern would you mind creating a github issue to explain your feature request a little more? ty!
1 reply
jeroen
@dr-jerry
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
@hderms
does Finagle use dependency injection? (manual constructor injection or otherwise)
Christopher Coco
@cacoco
@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
@spockz
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
@spockz
@cacoco I always envision the params in the stack client to be a kind of DI..
And the use of Java services
Christopher Coco
@cacoco
@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
@spockz
Right 😊
Alessandro Vermeulen
@spockz
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
@notxcain
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
@spockz
What happens if you ask the Java service factory for something of that type manually? Do you see it?
Denis Mikhaylov
@notxcain
@spockz was your question addressed to me?
Alessandro Vermeulen
@spockz
@notxcain not sure I don’t see names in reply threads
bollmann
@bollmann
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
@cacoco
@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.
bollmann
@bollmann
@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
@cacoco
@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.
bollmann
@bollmann

@cacoco: The server config is as follows:

Http.server
      .withTransport.tls(sslConfiguration)
      .withMaxRequestSize(StorageUnit.fromBytes(settings.maxRequestSize.toBytes))
      .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
@cacoco
@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.
bollmann
@bollmann
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! :-)
bollmann
@bollmann
@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
@cacoco
@bollmann no problem, happy to be a duck
sukanta ghosh
@sontu23_twitter
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
Pegerto
@pegerto
Hi,
I am trying to understand how to configure a proxy in a http client, should be simple.
      val clientBuilder = Http.client
        .withLabel(settings.label)
        .withRequestTimeout(settings.requestTimeout)
        .withTransport.connectTimeout(settings.connectTimeout)
        .withHttpStats
        .withTransport.httpProxyTo("api-aa:443")
        .withStatsReceiver(TalonStatsReceiver())
        .withStack(x => x.remove(ClientNackFilter.module.role))
        .withHttp2

      val secureClient = if (false) clientBuilder.withTlsWithoutValidation else clientBuilder
      secureClient.newService("localhost:9222")
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
@fuCtor
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
@mosesn
@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
bollmann
@bollmann

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)]
Vladimir Ivanovskiy
@vi-p4f
Hi! I created simple finatra http service and see "Elevated metric creation requests" lint warning in admin interface. I tried to find why it complains and see that some metric counters are incremented with every HTTP request served. Example: https://github.com/twitter/finagle/blob/develop/finagle-netty4-http/src/main/scala/com/twitter/finagle/netty4/http/handler/BadRequestHandler.scala#L29 Can you give me an advice what should I do about high metric creation requests or it is known feature which should be ignored?
15 replies
Vladimir Ivanovskiy
@vi-p4f
Hi again, one more question. Is the use of heapster lib (https://github.com/mariusae/heapster) in admin UI recommended/supported way to make heap profiles?