properties

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package filter provides event filtering functionality.

Package properties provides the core data models and types for property configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionConfig added in v0.35.0

type ConditionConfig struct {
	Name string     `yaml:"name"`
	Type FilterType `yaml:"type"`
	// TestMode when true sets metadata only instead of excluding events
	TestMode   bool   `yaml:"test_mode"`
	Expression string `yaml:"expression"`
}

ConditionConfig defines a single filter condition.

type CustomColumnConfig added in v0.45.0

type CustomColumnConfig struct {
	Name           string
	Scope          CustomColumnScope
	Type           CustomColumnType
	DependsOn      schema.DependsOnEntry
	Implementation NestedLookupConfig
}

CustomColumnConfig is normalized custom-column config used by runtime builders.

type CustomColumnScope added in v0.45.0

type CustomColumnScope string

CustomColumnScope defines where the resulting column is written.

const (
	CustomColumnScopeEvent              CustomColumnScope = "event"
	CustomColumnScopeSession            CustomColumnScope = "session"
	CustomColumnScopeSessionScopedEvent CustomColumnScope = "session_scoped_event"
)

type CustomColumnType added in v0.45.0

type CustomColumnType string

CustomColumnType defines output type for the resulting column.

const (
	CustomColumnTypeString  CustomColumnType = "string"
	CustomColumnTypeInt64   CustomColumnType = "int64"
	CustomColumnTypeFloat64 CustomColumnType = "float64"
	CustomColumnTypeBool    CustomColumnType = "bool"
)

type FilterType added in v0.35.0

type FilterType string

FilterType indicates the type of filter (exclude or allow).

const (
	// FilterTypeExclude removes matching events from sessions.
	FilterTypeExclude FilterType = "exclude"
	// FilterTypeAllow removes non-matching events from sessions.
	FilterTypeAllow FilterType = "allow"
)

type FiltersConfig added in v0.35.0

type FiltersConfig struct {
	Fields     []string          `yaml:"fields"`
	Conditions []ConditionConfig `yaml:"conditions"`
}

FiltersConfig defines the complete filters configuration.

func ParseFilterConfig added in v0.35.0

func ParseFilterConfig(configFilePath string) (FiltersConfig, error)

ParseFilterConfig reads the filters section from a YAML config file.

type NestedLookupConfig added in v0.45.0

type NestedLookupConfig struct {
	SourceScope       NestedLookupSourceScope
	SourceInterfaceID schema.InterfaceID
	SourceField       string
	MatchField        string
	MatchEquals       any
	ValueField        string
	Pick              NestedLookupPickStrategy
}

NestedLookupConfig stores normalized nested source lookup details.

type NestedLookupPickStrategy added in v0.45.0

type NestedLookupPickStrategy string

NestedLookupPickStrategy defines deterministic value-picking strategy for repeated sources.

const (
	NestedLookupPickStrategyLastNonNull NestedLookupPickStrategy = "last_non_null"
)

type NestedLookupSourceScope added in v0.45.0

type NestedLookupSourceScope string

NestedLookupSourceScope defines where the source records are read from.

const (
	NestedLookupSourceScopeEvent   NestedLookupSourceScope = "event"
	NestedLookupSourceScopeSession NestedLookupSourceScope = "session"
)

type NotFoundError added in v0.19.4

type NotFoundError struct {
	PropertyID string
}

func NewNotFoundError added in v0.19.4

func NewNotFoundError(propertyID string) *NotFoundError

func (*NotFoundError) Error added in v0.19.4

func (e *NotFoundError) Error() string

type Settings

type Settings struct {
	PropertyID   string
	PropertyName string
	// In some cases (like matomo) the measurement ID is the same as the property ID.
	// In other cases (like GA4) the measurement ID is a separate ID.
	PropertyMeasurementID string

	ProtocolID string

	SplitByUserID              bool
	SplitByCampaign            bool
	SplitByTimeSinceFirstEvent time.Duration
	SplitByMaxEvents           int

	SessionTimeout            time.Duration
	SessionJoinBySessionStamp bool
	SessionJoinByUserID       bool

	Filters       *FiltersConfig
	CustomColumns []CustomColumnConfig
}

Settings holds the tracking configuration for a property.

func (Settings) CustomColumnsSafe added in v0.45.0

func (s Settings) CustomColumnsSafe() []CustomColumnConfig

CustomColumnsSafe returns the custom columns configuration, ensuring it is never nil.

func (Settings) FiltersSafe added in v0.35.0

func (s Settings) FiltersSafe() FiltersConfig

FiltersSafe returns the filters configuration, ensuring it is never nil.

type SettingsRegistry

type SettingsRegistry interface {
	GetByMeasurementID(trackingID string) (*Settings, error)
	GetByPropertyID(propertyID string) (*Settings, error)
}

SettingsRegistry is a registry of property configurations.

func NewStaticSettingsRegistry

func NewStaticSettingsRegistry(props []Settings, opts ...StaticSettingsRegistryOptions) SettingsRegistry

NewStaticSettingsRegistry creates a new static property source from a list of property configurations.

func NewTestSettingRegistry added in v0.13.0

func NewTestSettingRegistry(opts ...TestSettingsOption) SettingsRegistry

NewTestSettingRegistry is a test property source that returns a static property configuration.

type StaticSettingsRegistry

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

StaticSettingsRegistry is a static property settings registry that stores property settings in a map.

func (StaticSettingsRegistry) GetByMeasurementID

func (s StaticSettingsRegistry) GetByMeasurementID(trackingID string) (*Settings, error)

GetByMeasurementID gets a property configuration by tracking ID.

func (StaticSettingsRegistry) GetByPropertyID

func (s StaticSettingsRegistry) GetByPropertyID(propertyID string) (*Settings, error)

GetByPropertyID gets a property configuration by property ID.

type StaticSettingsRegistryOptions

type StaticSettingsRegistryOptions func(s *StaticSettingsRegistry)

StaticSettingsRegistryOptions are options for the static property source.

func WithDefaultConfig

func WithDefaultConfig(settings *Settings) StaticSettingsRegistryOptions

WithDefaultConfig sets the default configuration for the static property source.

type TestSettingsOption added in v0.13.0

type TestSettingsOption func(*Settings)

TestSettingsOption configures test settings.

func WithSessionTimeout added in v0.19.8

func WithSessionTimeout(d time.Duration) TestSettingsOption

WithSessionTimeout sets the session timeout for test settings.

Jump to

Keyboard shortcuts

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