package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Packages

Package service contains a gRPC service to be used for remote inflight span access.

# Functions

CheckRecordedSpans checks whether a recording looks like an expected one represented by a string with one line per expected span and one line per expected event (i.e.
ChildSpan creates a child span of the current one, if any, via the WithParent option.
ContextWithRecordingSpan returns a context with an embedded trace Span.
ContextWithSpan returns a Context wrapping the supplied Span.
CountLogMessages counts the messages containing msg.
EnsureChildSpan looks at the supplied Context.
EnsureForkSpan is like ForkSpan except that, if there is no span in ctx, it creates a root span.
FindMsgInRecording returns the index of the first Span containing msg in its logs, or -1 if no Span is found.
ForkSpan forks the current span, if any[1].
LogsContainMsg returns true if a Span's logs contain the given message.
MakeTrace constructs a Trace.
NewTracer creates a Tracer with default options.
NewTracerWithOpt creates a Tracer and configures it according to the passed-in options.
RedactAndTruncateError redacts the error and truncates the string representation of the error to a fixed length.
RegisterTagRemapping sets the Span tag name that corresponds to the given log tag name.
SpanFromContext returns the *Span contained in the Context, if any.
SpanInclusionFuncForClient is used as a SpanInclusionFunc for the client-side of RPCs, deciding for which operations the gRPC tracing interceptor should create a span.
SpanInclusionFuncForServer is used as a SpanInclusionFunc for the server-side of RPCs, deciding for which operations the gRPC tracing interceptor should create a span.
SpanMetaFromProto converts a TraceInfo proto to SpanMeta.
TraceToJSON returns the string representation of the trace in JSON format.
WithClusterSettings configures the Tracer according to the relevant cluster settings.
WithDetachedRecording configures the span to not be included in the parent's recording (if any) under most circumstances.
WithEventListeners registers eventListeners to the span.
WithFollowsFrom instructs StartSpan to link the child span to its parent using a different kind of relationship than the regular parent-child one, should a child span be created (i.e.
WithForceRealSpan forces StartSpan to create of a real Span regardless of the Tracer's tracing mode (instead of a low-overhead non-recordable noop span).
WithLogTags returns a SpanOption that sets the Span tags to the given log tags.
WithParent instructs StartSpan to create a child Span from a (local) parent Span.
WithRecording configures the span to record in the given mode.
WithRemoteParentFromLocalSpan is equivalent to WithRemoteParentFromSpanMeta(sp.Meta()), but doesn't allocate.
WithRemoteParentFromSpanMeta instructs StartSpan to create a child span descending from a parent described via a SpanMeta.
WithRemoteParentFromTraceInfo is like WithRemoteParentFromSpanMeta, except the remote parent info is passed in as *TraceInfo.
WithSpanKind configures a span with an OpenTelemetry kind.
WithSpanReusePercent configures the Tracer span reuse ratio, overriding the environmental default.
WithSterile configures the span to not permit any child spans.
WithTestingKnobs configures the Tracer with the specified knobs.
WithTracingMode configures the Tracer's tracing mode.
WithUseAfterFinishOpt allows control over the Tracer's behavior when a Span is used after it had been Finish()ed.

# Constants

EventConsumed indicates that the event has been "consumed" by the EventListener, so neither other listeners for the span nor the ancestor spans should be notified about it.
EventNotConsumed indicates that the event wasn't "consumed" by the EventListener, so other listeners as well as any ancestor spans should be notified about the event.
These constants are used to form keys to represent tracing context information in "carriers" to be transported across RPC boundaries.
TracingModeActiveSpansRegistry means that Spans are always created.
TracingModeFromEnv configures tracing according to enableTracingByDefault.
TracingModeOnDemand means that Spans will no be created unless there's a particular reason to create them (i.e.

# Variables

EnableActiveSpansRegistry controls Tracers configured as WithTracingMode(TracingModeFromEnv) (which is the default).
WithClientSpanKind is a shorthand for server spans, frequently saving allocations.
WithServerSpanKind is a shorthand for server spans, frequently saving allocations.
ZipkinCollector is the cluster setting that specifies the Zipkin instance to send traces to, if any.

# Structs

MapCarrier is an implementation of the Carrier interface for a map of string pairs.
MetadataCarrier is an implementation of the Carrier interface for gRPC metadata.
SnapshotInfo represents minimal info about a stored snapshot, as returned by Tracer.GetSnapshots().
Span is the tracing Span that we use in CockroachDB.
SpanMeta is information about a Span that is not local to this process.
SpanRegistry is a map that references all non-Finish'ed local root spans, i.e.
SpansSnapshot represents a snapshot of all the open spans at a certain point in time.
Trace represents the recording of a span and all its descendents.
Tracer implements tracing requests.
TracerTestingKnobs contains knobs for a Tracer.

# Interfaces

Carrier is what's used to capture the serialized data.
EventListener is an object that can be registered to listen for Structured events recorded by the span and its children.
LazyTag is a tag value that expands into a series of key-value tags when included in a recording.
RegistrySpan is the interface used by clients of the active span registry.
SpanOption is the interface satisfied by options to `Tracer.StartSpan`.
Structured is an opaque protobuf that can be attached to a trace via `Span.RecordStructured`.
T is a subset of testing.TB.
TracerOption is implemented by the arguments to the Tracer constructor.

# Type aliases

EventConsumptionStatus describes whether the structured event has been "consumed" by the EventListener.
SnapshotID identifies a spans snapshot.
SpanReusePercentOpt is the option produced by WithSpanReusePercent(), configuring the Tracer's span reuse policy.
TracingMode specifies whether span creation is enabled or disabled by default, when other conditions that don't explicitly turn tracing on don't apply.