
finaglehelper on develop
finagle-http: Remove expensive … (compare)
finaglehelper on develop
Revert "finagle-core: return an… (compare)
finaglehelper on develop
finagle-core: Deprecate Legacy … (compare)
finaglehelper on develop
finagle-core: Add `CertsAndKey`… (compare)
finaglehelper on develop
finagle-core: return an empty b… (compare)
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
@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?
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 :)
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.
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?
@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?)
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) })
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")
connect https:// so the tls handshake happens on the proxy
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!
Future.join[A, B](Future[A], Future[B]): Future[(A, B)] as well as Future[A]#join[B](Future[B]): Future[(A, B)]