Documentation ¶
Index ¶
- Constants
- func AddEvent(ctx context.Context, name string, options ...trace.EventOption)
- func AttributeMoovKnownIssue() attribute.KeyValue
- func DropSpan() attribute.KeyValue
- func GetTracer(opts ...trace.TracerOption) trace.Tracer
- func HasSpanDrop(s tracesdk.ReadOnlySpan) bool
- func IsEmptyConsume(s tracesdk.ReadOnlySpan) bool
- func NewFilteredExporter(inner tracesdk.SpanExporter) tracesdk.SpanExporter
- func RecordError(ctx context.Context, err error, options ...trace.EventOption) error
- func SetAttributes(ctx context.Context, kv ...attribute.KeyValue)
- func SpanFromContext(ctx context.Context) trace.Span
- func StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func StructAttributes(s interface{}) (kv []attribute.KeyValue)
- type Config
- type HoneycombConfig
- type LinkedSpan
- func (l *LinkedSpan) AddEvent(name string, options ...trace.EventOption)
- func (l *LinkedSpan) ChildContext() context.Context
- func (l *LinkedSpan) ChildSpan() trace.Span
- func (l *LinkedSpan) End(options ...trace.SpanEndOption)
- func (l *LinkedSpan) ParentContext() context.Context
- func (l *LinkedSpan) ParentSpan() trace.Span
- func (l *LinkedSpan) RecordError(err error, options ...trace.EventOption)
- func (l *LinkedSpan) SetAttributes(kv ...attribute.KeyValue)
- func (l *LinkedSpan) SetName(name string)
- func (l *LinkedSpan) SetStatus(code codes.Code, description string)
- type OtelConfig
- type ShutdownFunc
- type TracerProvider
Constants ¶
const ( InstrumentationName = "moov.io" AttributeTag = "otel" MaxArrayAttributes = 10 )
const DropSpanKey = "span.drop"
const MoovKnownIssueKey = "moov.known_issue"
Variables ¶
This section is empty.
Functions ¶
func AddEvent ¶
func AddEvent(ctx context.Context, name string, options ...trace.EventOption)
AddEvent adds an event the Span in `ctx` with the provided name and options.
func AttributeMoovKnownIssue ¶
AttributeMoovKnownIssue is an attribute to mark a trace as a previously observed issue. IMPORTANT: if a trace has this attribute it will NOT fire a critical PD alert defined in https://github.com/moovfinancial/infra/blob/master/terraform-modules/apps/go-service/honeycomb.tf#L42
func GetTracer ¶
func GetTracer(opts ...trace.TracerOption) trace.Tracer
GetTracer returns a unique Tracer scoped to be used by instrumentation code to trace computational workflows.
func HasSpanDrop ¶
func HasSpanDrop(s tracesdk.ReadOnlySpan) bool
Allows for services to just flag a span to be dropped.
func IsEmptyConsume ¶
func IsEmptyConsume(s tracesdk.ReadOnlySpan) bool
Detects if its an event that was consumed but ignored. These can cause a lot of cluttering in the traces and we want to filter them out.
func NewFilteredExporter ¶
func NewFilteredExporter(inner tracesdk.SpanExporter) tracesdk.SpanExporter
func RecordError ¶
RecordError will record err as an exception span event for this span. It will also return the err passed in.
func SetAttributes ¶
SetAttributes sets kv as attributes of the Span. If a key from kv already exists for an attribute of the Span it will be overwritten with the value contained in kv.
func SpanFromContext ¶
SpanFromContext returns the current Span from ctx.
If no Span is currently set in ctx an implementation of a Span that performs no operations is returned.
func StartSpan ¶
func StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartSpan will create a Span and a context containing the newly created Span.
If the context.Context provided contains a Span then the new span will be a child span, otherwise the new span will be a root span.
OTEL recommends creating all attributes via `WithAttributes()` SpanOption when the span is created.
Created spans MUST be ended with `.End()` and is the responsibility of callers.
func StructAttributes ¶
StructAttributes creates an attribute.KeyValue for each field in the struct that has an "otel" tag defined. Nested structs will also be included, with attribute names formatted as "parent_attribute.nested_field_attribute".
Types ¶
type Config ¶
type Config struct { ServiceName string ServiceNamespace *string Stdout bool OpenTelemetryCollector *OtelConfig Honeycomb *HoneycombConfig // contains filtered or unexported fields }
func TestConfig ¶
Allows for testing where the output of the traces are sent to a io.Writer instance.
type HoneycombConfig ¶
type LinkedSpan ¶
type LinkedSpan struct {
// contains filtered or unexported fields
}
func StartLinkedRootSpan ¶
func StartLinkedRootSpan(ctx context.Context, name string, options ...trace.SpanStartOption) *LinkedSpan
StartLinkedRootSpan starts a new root span where the parent and child spans share links to each other. This is particularly useful in batch processing applications where separate spans are wanted for each subprocess in the batch, but without cluttering the parent span.
func (*LinkedSpan) AddEvent ¶
func (l *LinkedSpan) AddEvent(name string, options ...trace.EventOption)
func (*LinkedSpan) ChildContext ¶
func (l *LinkedSpan) ChildContext() context.Context
func (*LinkedSpan) ChildSpan ¶
func (l *LinkedSpan) ChildSpan() trace.Span
func (*LinkedSpan) End ¶
func (l *LinkedSpan) End(options ...trace.SpanEndOption)
func (*LinkedSpan) ParentContext ¶
func (l *LinkedSpan) ParentContext() context.Context
func (*LinkedSpan) ParentSpan ¶
func (l *LinkedSpan) ParentSpan() trace.Span
func (*LinkedSpan) RecordError ¶
func (l *LinkedSpan) RecordError(err error, options ...trace.EventOption)
func (*LinkedSpan) SetAttributes ¶
func (l *LinkedSpan) SetAttributes(kv ...attribute.KeyValue)
func (*LinkedSpan) SetName ¶
func (l *LinkedSpan) SetName(name string)
type OtelConfig ¶
type ShutdownFunc ¶
type ShutdownFunc func() error
var NoopShutdown ShutdownFunc = func() error { return nil }