Yufan Gong

@yufangong

Posted March 9, 2020

March 2020 Release Notes - Version 20.3.0

Days are getting longer🌻, March has arrived. Here’s what we have done in this release.

Finagle

New Features

  • finagle-opencensus-tracing: Add support for providing a custom TextFormat for header propagation. a02d377a

Runtime Behavior Changes

  • finagle-netty4: When not using the JDK implementation, the Netty reference counted SSL types are used which move SSL cleanup out of the GC cycle, reducing pause durations. 466aa5bf

  • finagle-base-http: Support for the SameSite cookie attribute is now on by default. This can be manipulated via the com.twitter.finagle.http.cookie.supportSameSiteCodec flag. This means that cookies that have a value other than Unset for the sameSite field will have the attribute encoded (by servers) and decoded (by clients). See this Chromium blog post for more information about the SameSite attribute. f96c3729

  • finagle-core: The default NullTracer for ClientBuilder has been removed. Affected clients may now see tracing enabled by default via the Java ServiceLoader, as described in the Finagle User’s Guide. 6b3f0940

  • finagle-http2: The HTTP/2 frame logging tools now log at level INFO. This is symmetric with the behavior of the ChannelSnooper tooling which serves a similar purpose which is to aid in debugging data flow and isn’t intended to be enabled in production. 78e4596b

Bug Fixes

  • finagle-zipkin-scribe: add a logical retry mechanism to scribe’s TRY_LATER response 23ff595b

  • finagle-http2: Initialize state in H2Pool before use in the gauge to avoid a NullPointerException. 289de8a3

  • finagle-http2: HTTP/2 server pipeline now traps close calls to ensure that events from the initial HTTP/1.x pipeline don’t close the HTTP/2 session. For example, the initial pipeline was subject to session timeouts even though the tail of the socket pipeline was effectively dead. Closing of HTTP/2 server pipelines is now handled through the H2ServerFilter. 670dbf74

  • finagle-http2: HTTP/2 servers clean out unused channel handlers when upgrading from a HTTP/1.x pipeline, removing some traps such as unintended timeouts. 3dfe8226

  • finagle-opencensus-tracing: Fixed internal server error when invalid or no propagation headers are provided. a02d377a

  • finagle-zipkin-scribe: export application metrics under a consistent zipkin-scribe scope. Finagle client stats under clnt/zipkin-scribe a17659dd

Breaking API Changes

  • finagle-zipkin-scribe: update the deprecated FutureIface to MethodPerEndpoint 23ff595b

  • finagle-zipkin-scribe: Coalesce ScribeRawZipkinTracer apply methods into two simple ones. a17659dd

  • finagle-zipkin-scribe: DefaultSampler moved to c.t.f.zipkin.core in finagle-zipkin-core. ac9c7ec1

  • finagle-zipkin-scribe: initialSampleRate GlobalFlag is moved to finagle-zipkin-core, under the same package scope c.t.f.zipkin. ac9c7ec1

Finatra

Added

  • finatra-kafka-streams: Add method to c.t.f.kafkastreams.test.TopologyTesterTopic to write Kafka messages with custom headers to topics. a9fef3dc

  • finatra-http: Add toBufReader to get the underlying Reader of Buf from StreamingResponse. If the consumed Stream primitive is not Buf, the returned reader streams a serialized JSON array. 876d0ba9

  • inject-app: Add functions to c.t.inject.app.AbstractApp to provide better ergonomics for Java users to call and use basic App lifecycle callbacks. f04772df

  • inject-server: Add functions to c.t.inject.server.AbstractTwitterServer to provide better ergonomics for Java users to call and use basic TwitterServer lifecycle callbacks. f04772df

  • inject-slf4j: Add a way to retrieve the currently stored Local Context map backing the MDC. 12b9410e

  • finatra-jackson: Added new functionality in the CaseClassDeserializer to support more Jackson annotations during deserialization. See documentation for more information. 49014890

  • finatra: Add NullKafkaProducer for unit tests to avoid network connection failures in the log. d8d4d5db

Changed

  • finatra-validation|jackson: Remove Jackson dependency from finatra/validation. This was for ErrorCode reporting but can be moved to finatra/jackson. f024f929

  • finatra-kafka-streams: (BREAKING API CHANGE) Update AsyncTransformer to preserve record context. be5dd08f

  • finatra-jackson: Better handling of Scala enumeration mapping errors. Currently, if mapping of a Scala enumeration during deserialization fails a java.util.NoSuchElementException is thrown which escapes deserialization error handling. Update to instead handle this failure case in order to correctly translate into a CaseClassFieldMappingException which will be wrapped into a CaseClassMappingException. 4753c6e8

  • finatra: Update Google Guice version to 4.2.0 76506c35

  • finatra: Bumped version of Joda to 2.10.2 and Joda-Convert to 1.5. 9adef421

  • finatra-jackson|finatra-http-annotations: Move http-releated Jackson “injectablevalues” annotations from finatra/jackson to finatra/http-annotations.

Specifically the follow have changed packages, c.t.finatra.request.QueryParam –> c.t.finatra.http.annotations.QueryParam c.t.finatra.request.RouteParam –> c.t.finatra.http.annotations.RouteParam c.t.finatra.request.FormParam –> c.t.finatra.http.annotations.FormParam c.t.finatra.request.Header –> c.t.finatra.http.annotations.Header c.t.finatra.request.JsonIgnoreBody –> c.t.finatra.http.annotations.JsonIgnoreBody

Users should update from finatra/jackson/src/main/java (finatra-jackson_2.12) to finatra/http-annotations/src/main/java (finatra-http-annotations_2.12). 77469e17

  • finatra-jackson: Updated Finatra Jackson integration to introduce a new ScalaObjectMapper and module to simplify configuration and creation of the mapper. See documentation for more information. 49014890

  • finatra-jackson: (BREAKING API CHANGE) Moved the java binding annotations, CamelCaseMapper and SnakeCaseMapper from c.t.finatra.annotations in finatra/jackson to c.t.finatra.json.annotations in finatra/json-annotations. Moved c.t.finatra.response.JsonCamelCase to c.t.finatra.json.annotations.JsonCamelCase which is also now deprecated. Users are encouraged to use the standard Jackson annotations or a mapper with the desired property naming strategy configured.

Many exceptions for case class deserialization were meant to be internal to the framework but are useful or necessary outside of the internals of JSON deserialization. As such we have cleaned up and made most JSON deserialization exceptions public. As a result, all the exceptions have been moved from c.t.finatra.json.internal.caseclass.exceptions to c.t.finatra.jackson.caseclass.exceptions.

c.t.finatra.json.internal.caseclass.exceptions.CaseClassValidationException has been renamed to c.t.finatra.jackson.caseclass.exceptions.CaseClassFieldMappingException. JsonInjectException, JsonInjectionNotSupportedException, and RequestFieldInjectionNotSupportedException have all been deleted and replaced with c.t.finatra.jackson.caseclass.exceptions.InjectableValuesException which represents the same error cases.

The FinatraJsonMappingException has been removed. Users are encouraged to instead use the general Jackson JsonMappingException (which the FinatraJsonMappingException extends).

RepeatedCommaSeparatedQueryParameterException has been moved tom finatra/http. 49014890

Fixed

  • finatra-jackson: Access to parameter names via Java reflection is not supported in Scala 2.11. Added a work around for the parsing of case class structures to support JSON deserialization in Scala 2.11 and forward. 59ec2c21

  • finatra-jackson: Fix for enforcing “fail on unknown properties” during deserialization. Previously, the CaseClassDeserializer was optimized to only read the fields in the case class constructor from the incoming JSON and thus ignored any unknown fields during deserialization. The fix will now properly fail if the DeserializationFeature is set or if the JsonProperties is configured accordingly. 49014890

Util

Breaking API Changes

  • util-core: The system property com.twitter.util.UseLocalInInterruptible no longer can be used to modulate which Local state is present when a Promise is interrupted. da638942

  • util-core: Future.unapply has been removed. Use Future.poll to retrieve Future’s state. 26beb347

Runtime Behavior Changes

  • util-core: Promises now exclusively use the state local to setting the interrupt handler when raising on a Promise. da638942

New Features

  • util-app: Add c.t.util.app.App#onExitLast to be able to provide better Java ergonomics for designating a final exit function. d523c0c5

  • util-core: Add c.t.io.Reader.concat to conveniently concatenate a collection of Reader to a single Reader. 68b28ac1

Bug Fixes

  • util-logging: Add a missing _* that could result in exceptions when using the Logger.apply(Level, Throwable, String, Any*) signature. c875d359

Twitter Server

  • Add c.t.server.AbstractTwitterServer#onExitLast to allow Java users to easily register a final exit function. 9a936b02

Scrooge

  • scrooge-generator: Add the ability to use a type in a file before you declare it. 14148321

  • scrooge-linter: Removed the TransitivePersistence and DocumentedPersisted lint rules, as they aren’t useful outside of Twitter. 80176dc0

  • scrooge-linter: Added the ability to load additional LintRule implementations dynamically via com.twitter.app.LoadService. 80176dc0