segment

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyAPIToken indicates an empty API token was provided.
	ErrEmptyAPIToken = platformerrors.New("empty Segment API token")
)

Functions

func NewSegmentEventReporter

func NewSegmentEventReporter(logger logging.Logger, tracerProvider tracing.TracerProvider, apiKey string, circuitBreaker circuitbreaking.CircuitBreaker) (analytics.EventReporter, error)

NewSegmentEventReporter returns a new Segment-backed EventReporter.

Types

type Config

type Config struct {
	APIToken string `env:"API_TOKEN" json:"apiToken"`
}

func (*Config) ValidateWithContext

func (cfg *Config) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a Config struct.

type EventReporter

type EventReporter struct {
	// contains filtered or unexported fields
}

EventReporter is a Segment-backed EventReporter.

func (*EventReporter) AddUser

func (c *EventReporter) AddUser(ctx context.Context, userID string, properties map[string]any) error

AddUser upsert's a user's identity.

func (*EventReporter) Close

func (c *EventReporter) Close()

Close wraps the internal client's Close method.

func (*EventReporter) EventOccurred

func (c *EventReporter) EventOccurred(ctx context.Context, event, userID string, properties map[string]any) error

EventOccurred associates events with a user.

func (*EventReporter) EventOccurredAnonymous

func (c *EventReporter) EventOccurredAnonymous(ctx context.Context, event, anonymousID string, properties map[string]any) error

EventOccurredAnonymous records an event for an anonymous user.

Jump to

Keyboard shortcuts

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