Skip to content

Commit

Permalink
Add note to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
Pijus Navickas committed Feb 1, 2023
1 parent a0b9b6d commit c19e2f7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bridge/opentracing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,24 @@ When you have started an OpenTracing Span, make sure the OpenTelemetry knows abo
// Propagate the otSpan to both OpenTracing and OpenTelemetry
// instrumentation by using the ctxWithOTAndOTelSpan context.
```

## Extended Functionality

While the bridge does not expose functionality that is not implemented by OpenTelemetry, it does expose some that is part of OpenTelemetry API and not OpenTracing API.

**`SpanContext.IsSampled`**

Proxies underlying `trace.IsSampled` method (see [documentation](https://pkg.go.dev/go.opentelemetry.io/otel/trace#SpanContext.IsSampled)). In order to use it, you have to cast it:

```go
type samplable interface {
IsSampled() bool
}

var sc opentracing.SpanContext = ...
if sc.(samplable).IsSampled() {
// Span is expected to be sampled.
} else {
// Span will be discarded.
}
```

0 comments on commit c19e2f7

Please sign in to comment.