Documentation
¶
Index ¶
- func ContextWithSpan(ctx context.Context, span trace.Span) context.Context
- func SpanFromContext(ctx context.Context) trace.Span
- func SpanMiddleware(next http.Handler) http.Handler
- type Config
- type Provider
- type WorkflowTracer
- func (w *WorkflowTracer) RecordError(span trace.Span, err error)
- func (w *WorkflowTracer) SetSuccess(span trace.Span)
- func (w *WorkflowTracer) StartStep(ctx context.Context, stepName, stepType string) (context.Context, trace.Span)
- func (w *WorkflowTracer) StartTrigger(ctx context.Context, triggerName, triggerType string) (context.Context, trace.Span)
- func (w *WorkflowTracer) StartWorkflow(ctx context.Context, workflowType, action string) (context.Context, trace.Span)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithSpan ¶
ContextWithSpan wraps trace.ContextWithSpan for convenience.
func SpanFromContext ¶
SpanFromContext returns the current span from context, useful for adding attributes from within workflow handlers.
Types ¶
type Config ¶
type Config struct {
// Endpoint is the OTLP HTTP endpoint (e.g., "localhost:4318").
Endpoint string
// ServiceName is the service name reported in traces.
ServiceName string
// ServiceVersion is the optional service version.
ServiceVersion string
// Insecure disables TLS for the OTLP exporter.
Insecure bool
// SampleRate controls the trace sampling ratio (0.0 to 1.0). 0 means default (always sample).
SampleRate float64
}
Config holds configuration for the TracerProvider setup.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider wraps an OpenTelemetry TracerProvider and handles lifecycle.
func NewProvider ¶
NewProvider creates a new TracerProvider from the given config and sets it as the global provider.
func (*Provider) Shutdown ¶
Shutdown gracefully shuts down the tracer provider, flushing pending spans.
func (*Provider) TracerProvider ¶
func (p *Provider) TracerProvider() *sdktrace.TracerProvider
TracerProvider returns the underlying SDK TracerProvider.
type WorkflowTracer ¶
type WorkflowTracer struct {
// contains filtered or unexported fields
}
WorkflowTracer provides convenience methods for creating spans around workflow execution lifecycle events.
func NewWorkflowTracer ¶
func NewWorkflowTracer(tracer trace.Tracer) *WorkflowTracer
NewWorkflowTracer creates a WorkflowTracer. If tracer is nil, the global tracer provider is used.
func (*WorkflowTracer) RecordError ¶
func (w *WorkflowTracer) RecordError(span trace.Span, err error)
RecordError records an error on the given span and sets the span status.
func (*WorkflowTracer) SetSuccess ¶
func (w *WorkflowTracer) SetSuccess(span trace.Span)
SetSuccess marks a span as successful.
func (*WorkflowTracer) StartStep ¶
func (w *WorkflowTracer) StartStep(ctx context.Context, stepName, stepType string) (context.Context, trace.Span)
StartStep begins a child span for a workflow step.
func (*WorkflowTracer) StartTrigger ¶
func (w *WorkflowTracer) StartTrigger(ctx context.Context, triggerName, triggerType string) (context.Context, trace.Span)
StartTrigger begins a span for a trigger invocation.
func (*WorkflowTracer) StartWorkflow ¶
func (w *WorkflowTracer) StartWorkflow(ctx context.Context, workflowType, action string) (context.Context, trace.Span)
StartWorkflow begins a new span for a workflow execution.