I also switched from ICE to thrift. At least on the Java side, we accomplish
something similar by using an aspect oriented class which intercepts calls to
our thrift service. It also gives us a single point to catch all exceptions
and convert then into Thrift exceptions. Here is very early version of how it
works. We have statistics gathering in here as well now.
@Aspect
public class ThriftAspect {
private static final Logger logger =
org.slf4j.LoggerFactory.getLogger(ThriftAspect.class);
@Pointcut("within(@com.plowrender.plow.thrift.ThriftService *)")
public void thriftService() {}
@Pointcut("execution(* *(..))")
public void methodPointcut() {}
@Around("thriftService() && methodPointcut()")
public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
try {
return joinPoint.proceed();
}
catch (Throwable t) {
logger.warn("Eception " + joinPoint.getSignature().getName(), t);
// TODO: translate to all exceptions.
throw new PlowException(0, "Plow operation failed: " + t);
}
}
}
On Nov 10, 2014, at 8:22 PM, zj huang <[email protected]> wrote:
> I about to use thrift in our new project instead of ICE
> I hope this Packetbeat will help me
>
> 2014-11-11 1:22 GMT+08:00 Randy Abernethy <[email protected]>:
>
>> Very cool!
>>
>> On Mon, Nov 10, 2014 at 8:43 AM, Tudor Golubenco <[email protected]>
>> wrote:
>>> Hi Thrift users,
>>>
>>> I'd like to announce that Packetbeat, the open source application
>>> monitoring system, now supports monitoring and performance management for
>>> Thrift services. You can read more about it in this blog post:
>>>
>>> http://packetbeat.com/blog/apache-thrift-monitoring.html
>>>
>>> Packetbeat works by sniffing the traffic and decoding the messages, which
>>> means that it can make performance metrics with zero latency
>>> overhead. Providing the Thrift IDL files to the Packetbeat agent is
>>> optional. The binary Thrift messages include the called method name and
>>> enough structure information to decode the messages without the need of
>> the
>>> IDL files. However, if you provide the IDL files, Packetbeat can also
>>> resolve the service name, the arguments and exceptions names.
>>>
>>> Any feedback on or off list is welcome!
>>>
>>> Best Regards,
>>> Tudor
>>>
>>> --
>>> Tudor Golubenco http://packetbeat.com
>>>
>>> Beware of bugs in the above code; I have only proved it correct,
>>> not tried it. -- Donald Knuth
>>