twitter/finagle

Let's support non-RPC spans

Open

#541 opened on Aug 9, 2016

View on GitHub
 (10 comments) (2 reactions) (0 assignees)Scala (8,864 stars) (1,435 forks)batch import
help wanted

Description

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.

Contributor guide