Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LayerKey = attribute.Key("chainloop.layer")
LayerKey is the span attribute key used to tag spans by architectural layer. Values: "service", "biz", "data", "interceptor", "middleware", "job", "consumer".
Functions ¶
func RecordError ¶
RecordError records an error on the span and sets its status to Error.
func SetDisabledLayers ¶
SetDisabledLayers configures which layers should not produce spans. Call once at startup from the server initialization.
Types ¶
type LayeredTracer ¶
type LayeredTracer struct {
// ServiceName is the service prefix (e.g. "chainloop-controlplane").
ServiceName string
// Name is the full scope name (e.g. "biz/workflow").
Name string
// Layer is the architectural layer prefix (e.g. "biz", "data", "middleware").
Layer string
}
LayeredTracer carries the layer name for automatic tagging and filtering. Created at package init time via Tracer(), but the disabled check happens lazily in Start so the config can load first.
func Tracer ¶
func Tracer(serviceName, name string) *LayeredTracer
Tracer returns a LayeredTracer scoped to a chainloop service. The serviceName identifies the service ("chainloop-controlplane" or "chainloop-cas"). The name should follow "layer/component" (e.g. "biz/workflow", "data/organization"). Safe to call at package init time — the disabled check is deferred to span creation.
type TraceCarrier ¶
TraceCarrier holds W3C trace context for propagation across async boundaries. Embed this in job arg structs so the originating request's trace context is carried to the worker.
func InjectTraceContext ¶
func InjectTraceContext(ctx context.Context) TraceCarrier
InjectTraceContext extracts the current span's trace context into a TraceCarrier. Call this when enqueueing a job to capture the originating request's trace.