Finagle v6.24.0 Release Notes

  • 💥 Breaking API Changes

    
    * 🚚 finagle-core: Remove `c.t.f.client.StackClient.Role.loadBalancer`, which
      was unused and duplicated by `c.t.f.loadbalancer.LoadBalancerFactory.role`.
    
    * 🚚 finagle-core: `c.t.f.Namer.orElse` was removed; composing Namers
      may be accomplished by constructing an appropriate Dtab.
    
    * 🚚 finagle-core: removed experimental `enum` / `expand` from
      `c.t.f.Namer` and `alt` / `union` from `c.t.f.Dtab`.
    
    * 🚚 finagle-http: Remove `c.t.f.http.CheckRequestFilter` along with
      `c.t.f.http.CheckHttpRequestFilter`. The functionality has been
      added to `c.t.f.http.codec.HttpServerDispatcher`. In addition,
      the codecError in `c.t.f.http.BadHttpRequest` has been replaced
      with the exception thrown by the HttpServerCodec.
    
    * 🚚 finagle-httpx: Remove deprecated code, limited scope of access on internal
      classes.
    
    * finagle-mux: `c.t.f.mux.lease.exp.WindowedByteCounter` no longer
      calls `Thread.start()` in its constructor. This should be now be
      done by the caller.
    
    * finagle-mux: The experimental session API is discontinued.
    
    * finagle-mux: Introduce new Request and Response types for mux services.
      The new mux request includes a `destination` path so that, which corresponds
      to the `destination` field in Tdispatch requests. Furthermore, these new
      types expose `c.t.io.Buf` instead of Netty's ChannelBuffers.
    
    * finagle-thrift,finagle-thriftmux: `c.t.f.Thrift.Client`, `c.t.f.Thrift.Server`,
      `c.t.f.ThriftMux.Client` and `c.t.f.ThriftMux.Server` have their
      `TProtocolFactory` configured via a `c.t.f.thrift.param.ProtocolFactory`
      `Stack.Param`.
    
    * finagle-thriftmux: `c.t.f.ThriftMux.Client` now has its `ClientId`
      configured via a `c.t.f.thrift.param.ClientId` `Stack.Param`.
    
    
    * Traces (``com.twitter.finagle.tracing.Trace``) lose their local-state mutating methods:
      ``Trace.clear``, ``Trace.pushId``, ``Trace.setId``, ``Trace.setTerminalId``, ``Trace.pushTracer``,
      ``Trace.pushTracerAndSetNextId``,
      ``Trace.state_=``, and ``Trace.unwind``.
      Let-bound versions of these are introduced in their stead.
      This makes it simple to ensure that state changes are properly delimited;
      further, these are always guaranteed to be delimited properly by Finagle.
    
        ::
    
          Trace.setTracer(tracer)
          codeThatUsesTracer()
    
          // Let-bound version:
          Tracer.letTracer(tracer) {
            codeThatUsesTracer()
          }
    
    * 🚚 Context handlers (``com.twitter.finagle.Context``) are removed.
      They are replaced by the use of marshalled request contexts
      (``com.twitter.finagle.context.Contexts.broadcast``).
      Marshalled request contexts do not require the use of service loading,
      so their use no longer requires build system coordination.
      We show Finagle's trace context:
      the first version uses the old context handler mechanism;
      the second uses ``Contexts.broadcast``.
    
        ::
    
          // The old context handler for Finagle's tracing context. Note that this
          // also required the file
          // finagle-core/src/main/resources/META-INF/services/com.twitter.finagle.ContextHandler
          // to contain the fully qualifed class path of the below object.
          class TraceContext extends ContextHandler {
            val key = Buf.Utf8("com.twitter.finagle.tracing.TraceContext")
    
            def handle(body: Buf) {
              // Parse 'body' and mutate the trace state accordingly.
            }
    
            def emit(): Option[Buf] = {
              // Read the trace state and marshal to a Buf.
            }
          }
    
          // New definition. No service loading required.
          private[finagle] val idCtx = new Contexts.broadcast.Key[TraceId] {
            val marshalId = Buf.Utf8("com.twitter.finagle.tracing.TraceContext")
    
            def marshal(id: TraceId): Buf = {
              // Marshal the given trace Id
            }
    
            def tryUnmarshal(body: Buf): Try[TraceId] = {
              // Try to marshal 'body' into a trace id.
            }
          }
    
    
    ⚙ Runtime Behavior Changes
    
    • finagle-mux: Mark the ServiceFactory available again if the underlying Service is no longer available. This permits it to be closed and reused.

    • finagle-mux: Rename the "lease_counter" counter to "leased" on mux clients.

    🗄 Deprecations

    
    * 🗄 finagle-core: Deprecated the mechanisms of FailureAccrual that use
      factory Transformers.  It's better to just use the Params to
      configure the existing FailureAccrualFactory.  However, if you've
      actually written your own failure accrual transformer that's
      significantly different, then you can do stack.replace() to swap it
      in.
    
    * finagle-memcached: Have cas() operation return false on NotFound()
      state instead of throw IllegalStateException
    
    🆕 New Features
    
    • finagle-core: All Stack.Params used in ClientBuilder and ServerBuilder are now publicly exposed for configuration parity.

    • finagle-mux: Drain mux servers properly, so that shutdowns can be graceful.

    • finagle-core: Introduce Service.status which supersedes Service.isAvailable. Service.status is a fine-grained health indicator. The default definition of Service.isAvailable is now defined in terms of Service.status; this definition will soon be made final.

    • finagle-mux: Inject bound residual paths into mux requests.

    • Request contexts. Request contexts replace the direct use of com.twitter.util.Local and of com.twitter.finagle.Context. Request contexts are environments of request-local bindings; they are guaranteed to be delimited by Finagle, and their API admits only properly delimited binding. They come in two flavors: Contexts.local are always local to handling a single request; bindings in Contexts.broadcast may be marshalled and transmitted across process boundaries where there is protocol support. Currently, both Thrift and Mux (and thus also ThriftMux) support marshalled contexts. See com.twitter.finagle.contexts.Context for more details.