Changelog¶
Changes by Version¶
0.17.2 (2015-09-18)¶
- VCR no longer matches on hostport to better support ephemeral ports.
- Fixed a bug with thriftrw where registering an endpoint twice could fail.
0.17.1 (2015-09-17)¶
- Made “service” optional for
thrift.load()
. The first argument should be a path, but backwards compatibility is provided for 0.17.0.
0.17.0 (2015-09-14)¶
- It is now possible to load Thrift IDL files directly with
tchannel.thrift.load
. This means that the code generation step using the Apache Thrift compiler can be skipped entirely. Check the API documentation for more details. - Accept host file in advertise:
TChannel.advertise()
now accepts a parameter,router_file
that contains a JSON stringified format of the router list. - Add
TChannel.is_listening
method to return whether the tchannel instance is listening or not.
0.16.6 (2015-09-14)¶
- Fixed a bug where Zipkin traces were not being propagated correctly in
services using the
tchannel.TChannel
API.
0.16.5 (2015-09-09)¶
- Actually fix status code being unset in responses when using the Thrift scheme.
- Fix request TTLs not being propagated over the wire.
0.16.4 (2015-09-09)¶
- Fix bug where status code was not being set correctly on call responses for application errors when using the Thrift scheme.
0.16.3 (2015-09-09)¶
- Make
TChannel.listen
thread-safe and idempotent.
0.16.2 (2015-09-04)¶
- Fix retry_limit in TChannel.call not allowing 0 retries.
0.16.1 (2015-08-27)¶
- Fixed a bug where the ‘not found’ handler would incorrectly return serialization mismatch errors..
- Fixed a bug which prevented VCR support from working with the sync client.
- Fixed a bug in VCR that prevented it from recording requests made by the sync
client, and requests made with
hostport=None
. - Made
client_for
compatible withtchannel.TChannel
. - Brought back
tchannel.sync.client_for
for backwards compatibility.
0.16.0 (2015-08-25)¶
- Introduced new server API through methods
tchannel.TChannel.thrift.register
,tchannel.TChannel.json.register
, andtchannel.TChannel.raw.register
- when these methods are used, endpoints are passed atchannel.Request
object, and are expected to return atchannel.Response
object or just a response body. The deprecatedtchannel.tornado.TChannel.register
continues to function how it did before. Note the breaking change to the top-level TChannel on the next line. - Fixed a crash that would occur when forking with an unitialized
TChannel
instance. - Add
hooks
property in thetchannel.TChannel
class. - BREAKING -
tchannel.TChannel.register
no longer has the same functionality astchannel.tornado.TChannel.register
, instead it exposes the new server API. See the upgrade guide for details. - BREAKING - remove
retry_delay
option in thetchannel.tornado.send
method. - BREAKING - error types have been reworked significantly. In particular,
the all-encompassing
ProtocolError
has been replaced with more granualar/actionable exceptions. See the upgrade guide for more info. - BREAKING - Remove third
proxy
argument from the server handler interface. - BREAKING -
ZipkinTraceHook
is not longer registered by default. - BREAKING -
tchannel.sync.client.TChannelSyncClient
replaced withtchannel.sync.TChannel
.
0.15.2 (2015-08-07)¶
- Raise informative and obvious
ValueError
when anything but a map[string]string is passed as headers to theTChannel.thrift
method. - First param, request, in
tchannel.thrift
method is required.
0.15.1 (2015-08-07)¶
- Raise
tchannel.errors.ValueExpectedError
when calling a non-void Thrift procedure that returns no value.
0.15.0 (2015-08-06)¶
- Introduced new top level
tchannel.TChannel
object, with new request methodscall
,raw
,json
, andthrift
. This will eventually replace the akwardrequest
/send
calling pattern. - Introduced
tchannel.thrift_request_builder
function for creating a request builder to be used with thetchannel.TChannel.thrift
function. - Introduced new simplified examples under the
examples/simple
directory, moved the Guide’s examples toexamples/guide
, and deleted the remaining examples. - Added ThriftTest.thrift and generated Thrift code to
tchannel.testing.data
for use with examples and playing around with TChannel. - Fix JSON arg2 (headers) being returned a string instead of a dict.
0.14.0 (2015-08-03)¶
- Implement VCR functionality for outgoing requests. Check the documentation
for
tchannel.testing.vcr
for details. - Add support for specifying fallback handlers via
TChannel.register
by specifyingTChannel.fallback
as the endpoint. - Fix bug in
Response
wherecode
expected an object instead of an integer. - Fix bug in
Peer.close
where a future was expected instead ofNone
.
0.13.0 (2015-07-23)¶
- Add support for specifying transport headers for Thrift clients.
- Always pass
shardKey
for TCollector tracing calls. This fixes Zipkin tracing for Thrift clients.
0.12.0 (2015-07-20)¶
- Add
TChannel.is_listening()
to determine iflisten
has been called. - Calling
TChannel.listen()
more than once raises atchannel.errors.AlreadyListeningError
. TChannel.advertise()
will now automatically start listening for connections iflisten()
has not already been called.- Use
threadloop==0.4
. - Removed
print_arg
.
0.11.2 (2015-07-20)¶
- Fix sync client’s advertise - needed to call listen in thread.
0.11.1 (2015-07-17)¶
- Fix sync client using
0.0.0.0
host which gets rejected by Hyperbahn during advertise.
0.11.0 (2015-07-17)¶
- Added advertise support to sync client in
tchannel.sync.TChannelSyncClient.advertise
. - BREAKING - renamed
router
argument torouters
intchannel.tornado.TChannel.advertise
.
0.10.3 (2015-07-13)¶
- Support PyPy 2.
- Fix bugs in
TChannel.advertise
.
0.10.2 (2015-07-13)¶
- Made
TChannel.advertise
retry on all exceptions.
0.10.1 (2015-07-10)¶
- Previous release was broken with older versions of pip.
0.10.0 (2015-07-10)¶
- Add exponential backoff to
TChannel.advertise
. - Make transport metadata available under
request.transport
on the server-side.
0.9.1 (2015-07-09)¶
- Use threadloop 0.3.* to fix main thread not exiting when
tchannel.sync.TChannelSyncClient
is used.
0.9.0 (2015-07-07)¶
- Allow custom handlers for unrecognized endpoints.
- Released
tchannel.sync.TChannelSyncClient
andtchannel.sync.thrift.client_for
.
0.8.5 (2015-06-30)¶
- Add port parameter for
TChannel.listen
.
0.8.4 (2015-06-17)¶
- Fix bug where False and False-like values were being treated as None in Thrift servers.
0.8.3 (2015-06-15)¶
- Add
as
attribute to the response header.
0.8.2 (2015-06-11)¶
- Fix callable
traceflag
being propagated to the serializer. - Fix circular imports.
- Fix
TimeoutError
retry logic.
0.8.1 (2015-06-10)¶
- Initial release.
Upgrade Guide¶
Migrating to a version of TChannel with breaking changes? This guide documents what broke and how to safely migrate to newer versions.
From 0.15 to 0.16¶
tchannel.TChannel.register
no longer mimickstchannel.tornado.TChannel.register
, instead it exposes the new server API like so:Before:
from tchannel.tornado import TChannel tchannel = TChannel('my-service-name') @tchannel.register('endpoint', 'json') def endpoint(request, response, proxy): response.write({'resp': 'body'})
After:
from tchannel import TChannel tchannel = TChannel('my-service-name') @tchannel.json.register def endpoint(request): return {'resp': 'body'} # Or, if you need to return headers with your response: from tchannel import Response return Response({'resp': 'body'}, {'header': 'foo'})
TChannelSyncClient
has been replaced withtchannel.sync.TChannel
. This new synchronous client has been significantly re-worked to more closely match the asynchronousTChannel
API.tchannel.sync.thrift.client_for
has been removed andtchannel.thrift_request_builder
should be used instead (tchannel.thrift.client_for
still exists for backwards compatibility but is not recommended). This new API allows specifying headers, timeouts, and retry behavior with Thrift requests.Before:
from tchannel.sync import TChannelSyncClient from tchannel.sync.thrift import client_for from generated.thrift.code import MyThriftService tchannel_thrift_client = client_for('foo', MyThriftService) tchannel = TChannelSyncClient(name='bar') future = tchannel_thrift_client.someMethod(...) result = future.result()
After:
from tchannel import thrift_request_builder from tchannel.sync import TChannel from tchannel.retry import CONNECTION_ERROR_AND_TIMEOUT from generated.thrift.code import MyThriftService tchannel_thrift_client = thrift_request_builder( service='foo', thrift_module=MyThriftService, ) tchannel = TChannel(name='bar') future = tchannel.thrift( tchannel_thrift_client.someMethod(...) headers={'foo': 'bar'}, retry_on=CONNECTION_ERROR_AND_TIMEOUT, timeout=1000, ) result = future.result()
from tchannel.tornado import TChannel
is deprecated.Removed
retry_delay
option fromtchannel.tornado.peer.PeerClientOperation.send
method.Before:
tchannel.tornado.TChannel.request.send(retry_delay=300)
After: no more
retry_delay
intchannel.tornado.TChannel.request.send()
If you were catching
ProtocolError
you will need to catch a more specific type, such asTimeoutError
,BadRequestError
,NetworkError
,UnhealthyError
, orUnexpectedError
.If you were catching
AdvertiseError
, it has been replaced byTimeoutError
.If you were catching
BadRequest
, it may have been masking checksum errors and fatal streaming errors. These are now raised asFatalProtocolError
, but in practice should not need to be handled when interacting with a well-behaved TChannel implementation.TChannelApplicationError
was unused and removed.Three error types have been introduced to simplify retry handling:
NotRetryableError
(for requests should never be retried),RetryableError
(for requests that are always safe to retry), andMaybeRetryableError
(for requests that are safe to retry on idempotent endpoints).
From 0.14 to 0.15¶
- No breaking changes.
From 0.13 to 0.14¶
- No breaking changes.
From 0.12 to 0.13¶
- No breaking changes.
From 0.11 to 0.12¶
- Removed
print_arg
. Userequest.get_body()
instead.
From 0.10 to 0.11¶
Renamed
tchannel.tornado.TChannel.advertise
argumentrouter
torouters
. Since this is a required arg and the first positional arg, only clients who are using as kwarg will break.Before:
tchannel.advertise(router=['localhost:21300'])
After:
tchannel.advertise(routers=['localhost:21300'])