analytics

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package analytics records individual usage events per layer, coordinate and user, unlike telemetry's aggregate counters

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAnalytics

func RegisterAnalytics(reg AnalyticsRegistration)

func RegisteredAnalyticsNames

func RegisteredAnalyticsNames() []string

Types

type Analytics

type Analytics interface {
	Record(ctx context.Context, event Event) error
}

Record runs on the request goroutine after the response, so must not block. Errors are only reported, never surfaced

type AnalyticsDeps added in v0.11.0

type AnalyticsDeps struct {
	Datastores    datastore.DatastoreRegistry
	ErrorMessages config.ErrorMessages
}

New dependencies are added as fields so the Initialize signature stays stable

type AnalyticsRegistration

type AnalyticsRegistration interface {
	Name() string
	Initialize(config any, deps AnalyticsDeps) (Analytics, error)
	InitializeConfig() any
}

func RegisteredAnalytics

func RegisteredAnalytics(name string) (AnalyticsRegistration, bool)

type Event

type Event struct {
	Time time.Time
	// The configured ID, not the URL name. Matches per-layer telemetry metrics so the two can be correlated
	LayerID string
	// Exactly as requested, which differs from LayerID for pattern layers
	LayerName string
	Z         int
	X         int
	Y         int
	// Empty when anonymous. Only the jwt and custom auth modules populate this
	UserID string
	// Resolved from the module's configuration. Nil when none are configured
	Fields map[string]any
}

A single successful tile delivery. Everything but Fields is always populated

Jump to

Keyboard shortcuts

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