Documentation
¶
Overview ¶
Package pubsubtrace contains tracing logic for the cloud.google.com/go/pubsub instrumentation.
WARNING: this package SHOULD NOT import cloud.google.com/go/pubsub or cloud.google.com/go/pubsub/v2.
The motivation of this package is to support orchestrion, which cannot use the main package because it imports the package, and since orchestrion modifies the library code itself, this would cause an import cycle.
Index ¶
- type Message
- type Option
- type OptionFn
- type Subscription
- type Topic
- type Tracer
- func (tr *Tracer) TraceAdmin(opts ...Option) ...
- func (tr *Tracer) TracePublish(ctx context.Context, topic Topic, msg *Message, opts ...Option) (context.Context, func(serverID string, err error))
- func (tr *Tracer) TraceReceiveFunc(s Subscription, opts ...Option) func(ctx context.Context, msg *Message) (context.Context, func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option describes options for the Pub/Sub integration.
type OptionFn ¶
type OptionFn func(*config)
OptionFn represents options applicable to WrapReceiveHandler or Publish.
func WithMeasured ¶
func WithMeasured() OptionFn
WithMeasured sets the measured tag for traces started by WrapReceiveHandler or Publish.
func WithPropagationAsSpanLinks ¶
func WithPropagationAsSpanLinks() OptionFn
WithPropagationAsSpanLinks configures the receive handler to record the producer span as a span link rather than as a parent span
func WithService ¶
WithService sets the service name tag for traces started by WrapReceiveHandler or Publish.
type Subscription ¶
type Subscription interface {
String() string
}
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func NewTracer ¶
func NewTracer(instr *instrumentation.Instrumentation, componentName instrumentation.Package) *Tracer
func (*Tracer) TraceAdmin ¶
func (tr *Tracer) TraceAdmin(opts ...Option) func(ctx context.Context, method, resourcePath string) (context.Context, func(err error))
TraceAdmin returns a function that starts a span for a Pub/Sub admin operation (e.g. CreateTopic, ListSubscriptions, DeleteSchema). Version-specific unary client interceptors in the pubsub.v1 and pubsub.v2 contrib modules call the returned function after mapping the request to a resource path.