pubsubtrace

package
v2.4.0-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 6 Imported by: 2

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID              string
	Data            []byte
	OrderingKey     string
	Attributes      map[string]string
	DeliveryAttempt *int
	PublishTime     time.Time
}

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 WithService

func WithService(serviceName string) OptionFn

WithService sets the service name tag for traces started by WrapReceiveHandler or Publish.

type Subscription

type Subscription interface {
	String() string
}

type Topic

type Topic 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) TracePublish

func (tr *Tracer) TracePublish(ctx context.Context, topic Topic, msg *Message, opts ...Option) (context.Context, func(serverID string, err error))

func (*Tracer) TraceReceiveFunc

func (tr *Tracer) TraceReceiveFunc(s Subscription, opts ...Option) func(ctx context.Context, msg *Message) (context.Context, func())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL