Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Clarify the usage of Self reference
Browse files Browse the repository at this point in the history
Cf. #397, #411
  • Loading branch information
yurishkuro committed Feb 17, 2020
1 parent cacf145 commit 47258d8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,22 @@ However it is not the default propagation format, see [here](zipkin/README.md#Ne

## SelfRef

Jaeger Tracer supports an additional [reference](https://github.com/opentracing/specification/blob/1.1/specification.md#references-between-spans)
type call `Self`. This allows a caller to provide an already established `SpanContext`.
This allows loading and continuing spans/traces from offline (ie log-based) storage. The `Self` reference
bypasses trace and span id generation.


Usage requires passing in a `SpanContext` and the jaeger `Self` reference type:
Jaeger Tracer supports an additional [span reference][] type call `Self`, which was proposed
to the OpenTracing Specification (https://github.com/opentracing/specification/issues/81)
but not yet accepted. This allows the caller to provide an already created `SpanContext`
when starting a new span. The `Self` reference bypasses trace and span id generation,
as well as sampling decisions (i.e. the sampling bit in the `SpanContext.flags` must be
set appropriately by the caller).

The `Self` reference supports the following use cases:
* the ability to provide externally generated trace and span IDs
* appending data to the same span from different processes, such as loading and continuing spans/traces from offline (ie log-based) storage

Usage requires passing in a `SpanContext` and the `jaeger.Self` reference type:
```
span := tracer.StartSpan(
"continued_span",
SelfRef(yourSpanContext),
jaeger.SelfRef(yourSpanContext),
)
...
defer span.finish()
Expand All @@ -310,3 +315,4 @@ defer span.finish()
[ot-url]: http://opentracing.io
[baggage]: https://github.com/opentracing/specification/blob/master/specification.md#set-a-baggage-item
[timeunits]: https://golang.org/pkg/time/#ParseDuration
[span reference]: https://github.com/opentracing/specification/blob/1.1/specification.md#references-between-spans

0 comments on commit 47258d8

Please sign in to comment.