package otobserver
import "github.com/opentracing-contrib/go-observer"
Index ¶
Types ¶
type Observer ¶
type Observer interface { // Create and return a span observer. Called when a span starts. // If the Observer is not interested in the given span, it must return (nil, false). // E.g : // func StartSpan(opName string, opts ...opentracing.StartSpanOption) { // var sp opentracing.Span // sso := opentracing.StartSpanOptions{} // spanObserver, ok := observer.OnStartSpan(span, opName, sso); // if ok { // // we have a valid SpanObserver // } // ... // } OnStartSpan(sp opentracing.Span, operationName string, options opentracing.StartSpanOptions) (SpanObserver, bool) }
Observer can be registered with a Tracer to recieve notifications about new Spans. Tracers are not required to support the Observer API. The actual registration depends on the implementation, which might look like the below e.g : observer := myobserver.NewObserver() tracer := client.NewTracer(..., client.WithObserver(observer))
type SpanObserver ¶
type SpanObserver interface { // Callback called from opentracing.Span.SetOperationName() OnSetOperationName(operationName string) // Callback called from opentracing.Span.SetTag() OnSetTag(key string, value interface{}) // Callback called from opentracing.Span.Finish() OnFinish(options opentracing.FinishOptions) }
SpanObserver is created by the Observer and receives notifications about other Span events.
Source Files ¶
- Version
- v0.0.0-20250314031746-df52693353bc (latest)
- Published
- Mar 14, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 month ago –
Tools for package owners.