Releases: twitter/finatra
Finatra 18.5.0
Added
- examples: Add external TwitterServer example. 1f48c588
Changed
-
inject-utils: Remove deprecated
c.t.inject.RootMonitor
. 6b60c676 -
finatra-http: Updated
c.t.finatra.http.AdminHttpServer
to isolate routes added to the
admin. a7e044a3
Fixed
-
inject-slf4j, finatra-http: Fix
c.t.inject.logging.FinagleMDCAdapter
to initialize
properly. We were lazily initializing the backingjava.util.Map
of theFinagleMDCAdapter
which could cause values to disappear when the map was not created eagerly enough. Typical
usage would add one of the MDC logging filters to the top of the request filter chain which would
put a value into the MDC thus creating the backingjava.util.Map
early in the request chain.
However, if a filter which puts to the MDC was not included and the first put happened in a
Future closure the map state would be lost upon exiting the closure.This change updates how the MDC mapping is stored to move from a
Local
to aLocalContext
and introduces new ergonomics for using/initializing the framework MDC integration.Initialization of the MDC integration should now go through the
c.t.inject.logging.MDCInitializer
(that is users are not expected to need to interact directly with theFinagleMDCAdapter
). E.g.,
to initialize the MDC:com.twitter.inject.logging.MDCInitializer.init()
This will initialize the
org.slf4j.MDC
and swap out the defaultorg.slf4j.spi.MDCAdapter
with
an instance of thec.t.inject.logging.FinagleMDCAdapter
allowing for reading/writing MDC values
across Future boundaries.Then to start the scoping of an MDC context, use
c.t.inject.logging.MDCInitializer#let
:com.twitter.inject.logging.MDCInitializer.let { // operations which set and read MDC values ??? }
Typically, this is done in a Filter wrapping the execution of the service in the Filter's apply,
For example, the framework provides this initialization and scoping in both the
c.t.finatra.http.filters.LoggingMDCFilter
and thec.t.finatra.thrift.filters.LoggingMDCFilter
.Simply including these at the top of the request filter chain for a service will allow MDC
integration to function properly. 37e1e77d -
inject-app: Ensure that installed modules are de-duped before creating injector.
ac123f0b
Finatra 18.4.0
Added
-
finatra-http: Added the ability for requests to have a maximum forward depth to
c.t.finatra.http.routing.HttpRouter
, which prevents requests from being forwarded
an infinite number of times. By default the maximum forward depth is 5.
cb236294 -
inject-thrift-client: Update
configureServicePerEndpoint
and
configureMethodBuilder
inThriftMethodBuilderClientModule
to also pass a
c.t.inject.Injector
instance which allows users to use bound instances from
the object graph when providing furtherthriftmux.MethodBuilder
or
ThriftMethodBuilderFactory
configuration.
ee16c1c6 -
inject-thrift-client: Update
configureThriftMuxClient
inThriftClientModuleTrait
to
also pass ac.t.inject.Injector
instance which allows users to use bound instances
from the object graph when providing furtherThriftMux.client
configuration.
e3047fe3 -
inject-server: Capture errors on close of the underlying TwitterServer. The embedded
testing utilities can now capture and report on an exception that occurs during close
of the underlying TwitterServer.EmbeddedTwitterServer#assertCleanShutdown
inspects
for any Throwable captured from closing the underlying server which it will then throw.
0e304bbc -
finatra-http: Created a new API into
c.t.f.h.response.StreamingResponse
which permits passing
atransformer
which is anAsynStream[T] => AsyncStream[(U, Buf)]
for serialization purposes,
as well as two callbacks --onDisconnect
, called when the stream is disconnected, andonWrite
,
which is arespond
side-effecting callback to every individual write to the stream.
ab44378c
Changed
-
inject-app: Update and improve the test
#bind[T]
DSL. The testing#bind[T]
DSL is lacking in
its ability to be used from Java and we would like to revise the API to be more expressive such
that it also includes binding from a Type to a Type. Due to wanting to also support the ability
to bind a Type to a Type, the DSL has been re-worked to more closely match the actual Guice
binding DSL.For Scala users the
#bind[T]
DSL now looks as follows:bind[T].to[U <: T] bind[T].to[Class[U <: T]] bind[T].toInstance(T) bind[T].annotatedWith[Ann].to[U <: T] bind[T].annotatedWith[Ann].to[Class[U <: T]] bind[T].annotatedWith[Ann].toInstance(T) bind[T].annotatedWith[Class[Ann]].to[U <: T] bind[T].annotatedWith[Class[Ann]].to[Class[U <: T]] bind[T].annotatedWith[Class[Ann]].toInstance(T) bind[T].annotatedWith(Annotation).to[U <: T] bind[T].annotatedWith(Annotation).to[Class[U <: T]] bind[T].annotatedWith(Annotation).toInstance(T) bindClass(Class[T]).to[T] bindClass(Class[T]).to[Class[U <: T]] bindClass(Class[T]).toInstance(T) bindClass(Class[T]).annotatedWith[Class[Ann]].to[T] bindClass(Class[T]).annotatedWith[Class[Ann]].[Class[U <: T]] bindClass(Class[T]).annotatedWith[Class[Ann]].toInstance(T) bindClass(Class[T]).annotatedWith(Annotation).to[T] bindClass(Class[T]).annotatedWith(Annotation).[Class[U <: T]] bindClass(Class[T]).annotatedWith(Annotation).toInstance(T)
For Java users, there are more Java-friendly methods:
bindClass(Class[T], T) bindClass(Class[T], Annotation, T) bindClass(Class[T], Class[Annotation], T) bindClass(Class[T], Class[U <: T]) bindClass(Class[T], Annotation, Class[U <: T]) bindClass(Class[T], Class[Annotation], Class[U <: T])
Additionally, these changes highlighted the lack of Java-support in the
TwitterModule
for
creating injectable Flags. Thusc.t.inject.TwitterModuleFlags
has been updated to also provide
Java-friendly flag creation methods:protected def createFlag[T](name: String, default: T, help: String, flggble: Flaggable[T]): Flag[T] protected def createMandatoryFlag[T](name: String, help: String, usage: String, flggble: Flaggable[T]): Flag[T]
-
inject-thrift-client: The "retryBudget" in the
c.t.inject.thrift.modules.ThriftMethodBuilderClientModule
should be aRetryBudget
and not the genericBudget
configuration Param. Updated the type.
8feea4bb -
inject-server: Move HTTP-related concerns out of the embedded testing utilities into
specific HTTP "clients". The exposedhttpAdminClient
in theEmbeddedTwitterServer
and thehttpClient
andhttpsClient
in theEmbeddedHttpServer
are no longer just
Finagle Services from Request to Response, but actual objects. The underlying Finagle
Service[Request, Response]
can be accessed viaClient.service
. 0e304bbc
Fixed
Closed
Finatra 18.3.0
finatra-18.3.0 (2018-03-05)
Added
-
inject-server: Add a lint rule in
c.t.inject.server.TwitterServer#warmup
. If a server does not
override the default implementation ofTwitterServer#warmup
a lint rule violation will appear
on the lint page of the HTTP admin interface. f0e9749a -
inject-server: Add
c.t.inject.server.TwitterServer#setup
lifecycle callback method. This is
run at the end of thepostInjectorStartup
phase and is primarily intended as a way for
servers to start pub-sub components on which the server depends. Users should prefer this method
over overriding thec.t.inject.server.TwitterServer#postWarmup
@Lifecycle-annotated method as
the callback does not require a call its super implementation for the server to correctly start
and is ideally less error-prone to use. e35f2873 -
inject-app: Add
c.t.inject.annotations.Flags#named
for getting an implementation of an@Flag
annotation. This is useful when trying to get or bind an instance of an@Flag
annotated type.
4baf6c9f
Changed
-
finatra-http:
ReaderDiscarded
failures writing inc.t.f.http.StreamingResponse
now only log
at the info level without a stack trace, while other failures log at the error level with
a stacktrace. ad7dee19 -
inject-thrift-client: Removed
withBackupRequestFilter
method on deprecated
c.t.inject.thrift.filters.ThriftClientFilterChain
. Instead of
c.t.inject.thrift.modules.FilteredThriftClientModule
, use
c.t.inject.thrift.modules.ThriftMethodBuilderClientModule
and use theidempotent
method on
c.t.inject.thrift.ThriftMethodBuilder
to configure backup requests. 8d3ae4cf. -
inject-app:
c.t.inject.annotations.FlagImpl
is no longer public and should not be used directly.
Usec.t.inject.annotations.Flags#named
instead. 4baf6c9f
Fixed
-
inject-thrift-client: Fix for duplicate stack client registration. The
c.t.inject.thrift.modules.ThriftMethodBuilderClientModule
was incorrectly calling the
ThriftMux.client
twice. Once to create a MethodBuilder and once to create a ServicePerEndpoint.
Now, the ServicePerEndpoint is obtained from the configured MethodBuilder. 37e477ba -
inject-thrift-client: Convert non-camel case
ThriftMethod
names, e.g., "get_tweets" to
camelCase, e.g., "getTweets" for reflection lookup on generatedServicePerEndpoint
interface in
c.t.inject.thrift.ThriftMethodBuilder
. 305c2f55
Finatra 18.2.0
Added
-
inject-thrift-client: Add methods to
c.t.inject.thrift.filters.ThriftClientFilterChain
to allow
Tunable timeouts and request timeouts. 72664be4 -
inject-thrift-client: Add
idempotent
andnonIdempotent
methods to
c.t.inject.thrift.ThriftMethodBuilder
, which can be used to configure retries and the sending of
backup requests. 7868964d -
inject-thrift-client: Add
c.t.inject.thrift.modules.ServicePerEndpointModule
for
building ThriftMux clients using thethriftmux.MethodBuilder
. 42ef3bcc
Changed
-
inject-thrift: Update
c.t.inject.thrift.PossibleRetryable
to specify a ResponseClassifier
and update usages in inject-thrift-client to use it. 582d46bc -
inject-thrift-client: Un-deprecate
c.t.inject.thrift.modules.ThriftClientModule
and update for parity withServicePerEndpointModule
in regards to ThriftMux
client configuration. Update documentation. RenameServicePerEndpointModule
to
the more descriptive and consistently namedThriftMethodBuilderClientModule
.
c4dc773e
Finatra 18.1.0
Added
-
finatra-thrift: Add support for building all types of Finagle Thrift clients to
the underlying embedded TwitterServer with thec.t.finatra.thrift.ThriftClient
test utility. See: https://twitter.github.io/scrooge/Finagle.html#creating-a-client
PHAB_ID=D123915
-
finatra-jackson: Added support to finatra/jackson for deserializing
com.twitter.util.Duration
instances from their String representations.PHAB_ID=D122366
Changed
- finatra-http: Change visibility of internal class
c.t.finatra.http.internal.marshalling.RequestInjectableValues
to be correctly specified as private to thehttp
package.PHAB_ID=D127975
Fixed
- finatra-http: Ensure we close resources in the
ResponseBuilder
. Addresses
#440.PHAB_ID=D120779
Closed
-
No Issues
Finatra 17.12.0
Added
- finatra-thrift: Add tests for new Scrooge
ReqRepServicePerEndpoint
functionalty. b8e919d3
Changed
- finatra-http: add a
multipart = true
arg to
EmbeddedHttpServer.httpMultipartFormPost
. c139d95 - inject-sever: Do not use the
c.t.inject.server.EmbeddedTwitterServer
InMemoryStatsReceiver
for embedded http clients. The http client stats are
emitted with the server under test stats which can be confusing, thus we now
create a newInMemoryStatsReceiver
when creating an embedded http client.
0c4a8ee5
Finatra 17.11.0
Finatra 17.10.0
We're now using date-based releases! E.g., YY.MM.patch,
hence this is release 17.10.0
.
Added
-
inject-core: Remove deprecated
c.t.inject.TestMixin#resetMocks
. Properly
usec.t.inject.Mockito
trait in tests. Deprecate resetting of mocks and
resettables inc.t.inject.IntegrationTestMixin
.PHAB_ID=D93876
-
finatra-http: Parameterize
@RouteParam
,@QueryParam
,@FormParam
, and
@Header
to allow specifying the field name to read from the params or
header map. Previously these annotations only looked for values by the
case class field name leading to possible ugliness when defining case
class fields (especially with@Header
). ``PHAB_ID=D94220
-
finatra: Add support for using a
java.lang.annotation.Annotation
instance
with the#bind[T]
testing DSL. This adds a way to bind instances in tests
that use the @nAmed binding annotation.PHAB_ID=D91330
-
finatra-http: Allow setting the content type of a Mustache view.
PHAB_ID=D91857
Changed
-
From now on, release versions will be based on release date in the format of
YY.MM.x where x is a patch number.PHAB_ID=D101244
-
finatra-utils: Remove deprecated
ExternalServiceExceptionMatcher
.PHAB_ID=D98343
-
finatra-jackson: ScalaType's
isMap
andisCollection
methods now check that
the given object's class is a subclass ofscala.collection.Map[Any, Any]
and
scala.collection.Iterable[Any]
, respectively. Previously the superclasses'
packages were unspecified. This is a runtime behavior change.
PHAB_ID=D93104
-
finatra-http: Require that route URIs and prefixes begin with forward slash (/).
PHAB_ID=D90895
-
inject-utils: (BREAKING API CHANGE) RichOption toFutureOrFail, toTryOrFail, and
toFutureOrElse signature changed to take the fail or else parameter by name.
PHAB_ID=D89544
-
inject-server: Remove usage of deprecated
c.t.inject.logging.Slf4jBridgeUtility
.
Change usages toc.t.util.logging.Slf4jBridgeUtility
.PHAB_ID=D88095
-
finatra-http, inject-thrift-client: Remove netty3 specific types and dependency.
In finatra-http, the code using these types is deprecated and can be removed allowing
us to remove netty3-specific dependencies. In inject-thrift-client we can default to
use the DefaultTimer for the backupRequestFilter method param instead of the
HashedWheelTimer.PHAB_ID=D88025
Fixed
-
finatra-http: Parameterized route callback inputs fail because the lookup of a
correspondingMessageBodyManager
reader lookup does not properly handle parameterized
types such as collections. This change updates theMessageBodyManager
MessageBodyReader
lookup to take into account parameterized types. This allows for a user to parse a
Seq[T]
, orMap[K, V]
as a route callback input type using the default Finatra
MessageBodyReader
.PHAB_ID=D104277
-
finatra-jackson: Fix issue causing
IllegalArgumentException
from Validations to
be swallowed. A catch clause in thec.t.finatra.json.internal.caseclass.jackson.FinatraCaseClassDeserializer
is too broad as it catches thrownIllegalArgumentException
s from field validations
when the annotation is applied to a field of the incorrect type, e.g., when@Max
is
applied to a String field.PHAB_ID=D95306
Finatra 2.13.0
Added
- inject-server: Add ability to fail embedded server startup on lint rule violation.
There is now a flag in the embedded servers that when set to true will fail
server startup if a lint rule violation is detected. This will then fail
the running test.PHAB_ID=D82399
Changed
-
finatra-http: No longer depend on bijection-util.
PHAB_ID=D86640
-
finatra-jackson: Deprecate c.t.finatra.json.utils.CamelCasePropertyNamingStrategy.
This object was created to reduce ambiguity with previous releases of Jackson in which
the default PropertyNamingStrategy was an abstract class with a default of camel case.
Users are encouraged to use the Jackson PropertyNamingStrategy
constants directly.PHAB_ID=D81707
Finatra 2.12.0
Added
- finatra-jackson: Add support for injecting a snake case FinatraObjectMapper by annotating
parameters with a new @SnakeCaseMapper binding annotation.PHAB_ID=D7798
Changed
-
finatra-http: Add close hook when constructing a StreamingResponse to allow for resource
release without consuming an entire AsyncStream.PHAB_ID=D64013
-
finatra-http: Unmarshalling JSON no longer consumes the body of a HTTP Request.
PHAB_ID=D74519
-
finatra-inject: RetryUtil.retry has been removed because it used a blocking call
to Thread.sleep. Blocking Finagle threads results in poor performance and
RetryUtil.retryFuture should be used instead.PHAB_ID=D73949