Ryan O'Neill

@ryanoneill

Posted January 14, 2019

January 2019 Release Notes - Version 19.1.0 🎉

Happy New Year folks! Hopefully new years resolutions are still on pace. In the meantime, let’s kick off 2019 with a fresh new release of libraries.

Finagle

New Features

  • finagle-core: c.t.f.s.StackBasedServer has been changed to extend the c.t.f.Stack.Transformable trait. This brings StackBasedServer into parity with c.t.f.c.StackBasedClient, which already extends the Stack.Transformable trait. 9f637b5e

  • finagle-http: HttpMuxer propagates the close signal to the underlying handlers. 6475680d

  • finagle-stats-core: introduce flag to allow logging metrics on service shutdown. 4588bc1f

Breaking API Changes

  • finagle-core: The deprecated c.t.f.b.ServerBuilder.stack method which takes a function has been removed. Uses of this method should be changed to use the c.t.f.b.ServerBuilder.stack method which takes a c.t.f.s.StackBasedServer instead. a05e5e7b

  • finagle-core: The type of c.t.f.b.ServerConfig.nilServer has been changed from Server\[Req, Rep\] to StackBasedServer\[Req, Rep\]. 4be953d4

  • finagle-core: The access level of the c.t.f.b.ServerBuilder.copy method has changed from protected to private. 4be953d4

  • finagle-core: The bridge type c.t.f.b.Server has been removed. Users should change to use c.t.f.ListeningServer instead. Uses of the previously deprecated Server.localAddress should use ListeningServer.boundAddress instead. eb66ee71

  • finagle-core: The deprecated c.t.f.t.Transport.localAddress and c.t.f.t.Transport.remoteAddress methods are now final and can no longer be extended. Users should migrate to the respective c.t.f.t.TransportContext methods. b85f43a0

  • finagle-thrift: The c.t.f.t.ThriftRichClient.protocolFactory and c.t.f.t.ThriftRichServer.protocolFactory methods have been removed. Users should switch to using ThriftRichClient.clientParam.protocolFactory and ThriftRichServer.serverParam.protocolFactory instead. In addition, implementations of the protocolFactory method have been removed from the concrete c.t.f.Thrift and c.t.f.ThriftMux client and server. e33baf82

Bug Fixes

  • finagle-core: Failed writes on Linux due to a remote peer disconnecting should now be properly seen as a c.t.f.ChannelClosedException instead of a c.t.f.UnknownChannelException. 8f5774cb

  • finagle-http: Compression level of 0 was failing on the server-side when speaking h2c. Updated so that it can handle a request properly. 5f96fcb2

  • finagle-thriftmux: A Java compatibility issue for users trying to call withOpportunisticTls on ThriftMux clients and servers has been fixed. e57d2a91

Runtime Behavior Changes

  • finagle-core: ServiceFactory.const propagates the close from the ServiceFactory to the underlying service, instead of ignoring it. 6475680d

Finatra

Added

  • finatra-kafka-streams: SumAggregator and CompositeSumAggregator only support enhanced window aggregations for the sum operation. Deprecate SumAggregator and CompositeSumAggregator and create an AggregatorTransformer class that can perform arbitrary aggregations. f588970e

  • finatra-streams: Open-source Finatra Streams. Finatra Streams is an integration between Kafka Streams and Finatra which we’ve been using internally at Twitter for the last year. The library is not currently open-source. 47cce546

  • inject-server: Add lint rule to alert when deprecated util-logging JUL flags from the c.t.inject.server.DeprecatedLogging trait are user defined. This trait was mixed-in only for backwards compatibility when TwitterServer was moved to the slf4j-api and the flags are not expected to be configured. By default, util-app based applications will fail to start if they are passed a flag value at startup which they do not define. Users should instead configure their chosen slf4j-api logging implementation directly. 388bf8f9

  • finatra-thrift: c.t.finatra.thrift.Controllers now support per-method filtering and access to headers via c.t.scrooge.{Request, Response} wrappers. To use this new functionality, create a Controller which extends the c.t.finatra.thrift.Controller(SomeThriftService) abstract class instead of constructing a Controller that mixes in the SomeThriftService.BaseServiceIface trait. With this, you can now provide implementations in form of c.t.scrooge.Request/c.t.scrooge.Response wrappers by calling the handle(ThriftMethod) method. Note that a Controller constructed this way cannot also extend a BaseServiceIface.

    handle(SomeMethod).filtered(someFilter).withFn { req: Request[SomeMethod.Args] =>
      val requestHeaders = req.headers
      // .. implementation here
    
      // response: Future[Response[SomeMethod.SuccessType]]
    }
    

    Note that if Request/Response based implementations are used the types on any existing ExceptionMappers should be adjusted accordingly. Also, if a DarkTrafficFilterModule was previously used, it must be swapped out for a ReqRepDarkTrafficFilterModule 9d891cd1

Changed

  • inject-core, inject-server: Remove deprecated @Bind support from test mixins. Users should instead prefer using the bind[T] DSL in tests. 841f6974

  • inject-app: Remove deprecated bind\[T\] DSL methods from c.t.inject.app.BindDSL.

    Instead of:

    injector.bind[T](instance)
    injector.bind[T, Ann](instance)
    injector.bind[T](ann, instance)
    

    Users should instead use the more expressive forms of these methods, e.g.,:

    injector.bind[T].toInstance(instance)
    injector.bind[T].annotatedWith[Ann].toInstance(instance)
    injector.bind[T].annotatedWith(ann).toInstance(instance)
    

    which more closely mirrors the scala-guice binding DSL. 2690003d

  • finatra-thrift: For services that wish to support dark traffic over c.t.scrooge.Request/c.t.scrooge.Response-based services, a new dark traffic module is available: c.t.finatra.thrift.modules.ReqRepDarkTrafficFilterModule 9d891cd1

  • finatra-thrift: Creating a c.t.finatra.thrift.Controller that extends a ThriftService.BaseServiceIface has been deprecated. See the related bullet point in “Added” with the corresponding PHAB_ID to this one for how to migrate. 9d891cd1

  • inject-core, inject-server: Remove deprecated WordSpec testing utilities. The framework default ScalaTest testing style is FunSuite though users are free to mix their testing style of choice with the framework provided test mixins as per the documentation. 41767c6e

  • finatra-thrift: Instead of failing (potentially silently) c.t.finatra.thrift.routing.ThriftWarmup now explicitly checks that it is using a properly configured c.t.finatra.thrift.routing.Router e2dc8b30

  • finatra-inject: c.t.finatra.inject.server.PortUtils has been modified to work with c.t.f.ListeningServer only. Methods which worked with the now-removed c.t.f.b.Server have been modified or removed. 642d7260

  • finatra-kafka-streams: Finatra Queryable State methods currently require the window size to be passed into query methods for windowed key value stores. This is unnecessary, as the queryable state class can be passed the window size at construction time. We also now save off all FinatraKeyValueStores in a global manager class to allow query services (e.g. thrift) to access the same KeyValueStore implementation that the FinatraTransformer is using. c51e174b

Fixed

  • finatra-kafka-streams: Fix bug where KeyValueStore#isOpen was throwing an exception when called on an uninitialized key value store d3f833a1

Scrooge

  • Update asm, cglib, jmock dependencies 688cd29e

Twitter Server

  • Propagate the admin server’s shutdown to the handlers that are registered with the admin server. 8a164d46

Util

New Features

  • util-core: Added Reader.map/flatMap to transform Reader[A] to Reader[B]. Added fromFuture() and value() in the Reader object to construct a new Reader. ac15ad8b

Breaking API Changes

  • util-core: The implicit conversions classes in c.t.conversions.SomethingOps have been renamed to have unique names. This allows them to be used together with wildcard imports. See Github issue (https://github.com/twitter/util/issues/239). 2d5d6da9

  • util-core: Both c.t.io.Writer.FailingWriter and c.t.io.Writer.fail were removed. Build your own instance should you need to. 63815225