Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduces LOCAL_COMPONENT("lc") binary annotation and example use-case #821

Merged
merged 1 commit into from
Nov 9, 2015

Conversation

codefromthecrypt
Copy link
Member

Local spans have been discussed at length, but have never been
formalized. This formalizes how to tag a span as local, including
rationale documentation. To help demonstrate the point, zipkin-web and
zipkin-query use this for bootstrap tracing.

Fixes #808

Here are example local spans from finatra and twitter-server bootstrap:

screen shot 2015-11-07 at 12 34 17 pm

screen shot 2015-11-07 at 12 35 28 pm

@codefromthecrypt
Copy link
Member Author

@codefromthecrypt
Copy link
Member Author

Note that finagle instrumentation doesn't yet support Span.duration. The workaround until that's not the case is add a ClientRecv("cr") annotation. That's because finagle needs some signal to know the span is complete. https://github.com/twitter/finagle/blob/develop/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/DeadlineSpanMap.scala#L110

@yurishkuro
Copy link
Contributor

Does this change require UI/JS changes? When I emit a span with LC only, without RPC-bounding annotations, the UI doesn't show it.

@codefromthecrypt
Copy link
Member Author

codefromthecrypt commented Nov 9, 2015 via email


/** If the span transport is set, trace accordingly, or disable tracing */
/** If the span transport is set, trace accordingly, or disable tracing. */
def premain {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurishkuro this was a bug!! maybe related to your inability to see spans. pushing a fix now.

Local spans have been discussed at length, but have never been
formalized. This formalizes how to tag a span as local, including
rationale documentation. To help demonstrate the point, zipkin-web and
zipkin-query use this for bootstrap tracing.
@codefromthecrypt
Copy link
Member Author

rebased with a fix to a bug where the tracers weren't initializing.

@yurishkuro @kristofa please take a look. I'd like to add support to this to brave, but want to make sure folks are on-board before raising that.

@codefromthecrypt
Copy link
Member Author

last call for feedback, I'll merge in a couple hours and address anything else post-merge

@yurishkuro
Copy link
Contributor

looks good

codefromthecrypt pushed a commit that referenced this pull request Nov 9, 2015
Introduces LOCAL_COMPONENT("lc") binary annotation and example use-case
@codefromthecrypt codefromthecrypt merged commit 38c20e7 into master Nov 9, 2015
@codefromthecrypt codefromthecrypt deleted the local-spans branch November 9, 2015 15:38
@yurishkuro
Copy link
Contributor

@adriancole I pulled this, but still not able to see local spans, even though I do send ts and duration. Your screenshots above show "cr" for both examples of local spans. Did you try it without having any RPC annotations on the local span?

@codefromthecrypt
Copy link
Member Author

good point. so we have a test that shows spanstore doesn't require annotations, but maybe there's some special casing in the web process subverting this. Should be possible to reproduce by making json and then posting it to the query server. I'll have a look.

@yurishkuro
Copy link
Contributor

the json result from query service does not return that local span either, so it might be deeper than web layer

codefromthecrypt pushed a commit to openzipkin/brave that referenced this pull request Nov 20, 2015
A local span can represent bootstrap, codec, file i/o or other activity
that notably impacts performance.

Local spans always have a binary annotation "lc" which indicates the
component name. Usings zipkin's UI or Api, you can query by for spans
that use a component like this: `lc=spring-boot`

Here's an example of allocating precise duration for a local span:
```java
tracer.startSpan("codec", "encode");
try {
  return codec.encode(input);
} finally {
  tracer.finishSpan();
}
```

Fixes #111
See openzipkin/zipkin#821
@nishantshobhit
Copy link

brave user here: The trace_id generate for a span generated from the local tracer is different from other spans for the same trace. may be that's the problem here?

@codefromthecrypt
Copy link
Member Author

@nishantshobhit feel free to hop on openzipkin/zipkin even if the questions are about brave.

I have a working example of local tracer in the zipkin-java project. However, there's some important details about the implementation of span storage in brave you need to keep in mind. Look here for details: https://github.com/openzipkin/brave/blob/master/brave-core/src/main/java/com/github/kristofa/brave/LocalSpanState.java#L9

@codefromthecrypt codefromthecrypt added enhancement model Modeling of traces labels Oct 26, 2018
thgoexpt added a commit to thgoexpt/Java-distributed-tracing-implementation that referenced this pull request Apr 7, 2022
A local span can represent bootstrap, codec, file i/o or other activity
that notably impacts performance.

Local spans always have a binary annotation "lc" which indicates the
component name. Usings zipkin's UI or Api, you can query by for spans
that use a component like this: `lc=spring-boot`

Here's an example of allocating precise duration for a local span:
```java
tracer.startSpan("codec", "encode");
try {
  return codec.encode(input);
} finally {
  tracer.finishSpan();
}
```

Fixes #111
See openzipkin/zipkin#821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement model Modeling of traces
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants