events

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package events provides a thin HTTP client for the analytics collector.

Commerce fires events via HTTP to the analytics-collector sidecar rather than writing directly to ClickHouse. This decouples analytics from the commerce binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.36.0

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

Client sends events to the analytics-collector via HTTP.

func NewClient added in v1.36.0

func NewClient(endpoint string) *Client

NewClient creates a new analytics client. Endpoint should be the analytics-collector base URL (e.g., "http://analytics-collector.hanzo.svc:8091").

func (*Client) Close added in v1.36.0

func (c *Client) Close() error

Close is a no-op for the HTTP client.

func (*Client) EmitOrderCompleted added in v1.36.0

func (c *Client) EmitOrderCompleted(ctx context.Context, order *Order) error

EmitOrderCompleted sends an order completed event to the collector.

func (*Client) EmitRaw added in v1.36.0

func (c *Client) EmitRaw(ctx context.Context, event map[string]interface{}) error

EmitRaw sends a raw event to the collector.

func (*Client) Flush added in v1.36.0

func (c *Client) Flush() error

Flush is a no-op for the HTTP client (collector handles batching).

type Order

type Order struct {
	ID       string
	UserID   string
	Email    string
	Total    float64
	Currency string
	Items    []OrderItem
	Status   string
	OrgID    string
}

Order represents a Commerce order for event emission.

type OrderItem

type OrderItem struct {
	ProductID   string
	ProductName string
	SKU         string
	Quantity    int
	Price       float64
}

OrderItem represents an item in an order.

Jump to

Keyboard shortcuts

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