twitter/finagle

Let's support non-RPC spans

开放

#541 创建于 2016年8月9日

 (10 条评论) (2 个反应) (0 位负责人)Scala (1,435 个派生)batch import
help wanted

仓库指标

星标
 (8,864 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

The current tracing system is special-cased for client and server spans. There are non-rpc spans, such as expensive local code or messaging activity that are not currently representable in finagle. Let's make them possible!

Expected behavior

I'd like to be able to indicate the start and finish of an abstract operation, without relying on annotation values. For example:

Trace.recordStart() -> Tracer.record(Annotation.Start())
Trace.recordOperation(message: operation) -> Tracer.record(Annotation.Operation(operation))
Trace.recordFinish() -> Tracer.record(Annotation.Finish())
Trace.recordError(message: String) -> Tracer.record(Annotation.Error(message))

These annotations control the authoritative start and finish (success or error) of an abstract span. Annotation.Operation is the same use as Annotation.Rpc, except it more clearly indicates it isn't necessarily an RPC (ex a one-way message).

Actual behavior

Right now, you can only authoritatively create and finish RPC spans. If you create a different type of span, you end up with a "finagle.flush" annotation 2 minutes later as the tracer has no idea that the span is complete. It is also impossible to create a span that only includes binary annotations.

贡献者指南