Documentation
¶
Index ¶
- Constants
- func Command() *cli.Command
- func ProjectionsCommand() *cli.Command
- type Batch
- type ClickHouseSink
- func (s *ClickHouseSink) BackgroundErrors() <-chan error
- func (s *ClickHouseSink) Close() error
- func (s *ClickHouseSink) EnsureSchema(ctx context.Context, mode string) error
- func (s *ClickHouseSink) HasMembershipRows(ctx context.Context, exporterID, resourceID string) (bool, error)
- func (s *ClickHouseSink) MaxIngestVersion(ctx context.Context, exporterID string) (uint64, error)
- func (s *ClickHouseSink) ResolvePurge(ctx context.Context, purge PurgeRow) (PurgeRow, error)
- func (s *ClickHouseSink) WriteBatch(ctx context.Context, batch Batch) error
- type Common
- type Config
- type FenceRow
- type LifecycleRow
- type MembershipRow
- type PayloadMode
- type Processor
- func (p *Processor) BackgroundErrors() <-chan error
- func (p *Processor) Bootstrap(ctx context.Context, events processruntime.EventClient, ...) (string, error)
- func (p *Processor) ContentType() string
- func (p *Processor) Flush(ctx context.Context) error
- func (p *Processor) Handle(ctx context.Context, event processruntime.EventEnvelope) error
- func (p *Processor) Load(raw json.RawMessage) error
- func (p *Processor) SetLeaseGeneration(generation uint64) error
- func (p *Processor) Snapshot() (json.RawMessage, error)
- type Projection
- type ProjectionFailureRow
- type ProjectionRow
- type ProjectionSet
- type ProjectionTable
- type PurgeRow
- type RunningProcessor
- type Sink
- type StartOptions
Constants ¶
const ( PayloadMetadata PayloadMode = "metadata" PayloadProjected PayloadMode = "projected" PayloadFull PayloadMode = "full" RetentionManaged = "managed" RetentionExternal = "external" PurgeManaged = "managed" PurgeRecordOnly = "record-only" PurgeExternal = "external" )
const ( // ProjectionRowsOne writes one row per matching resource. ProjectionRowsOne = "one" // ProjectionRowsMany writes zero or more rows per matching resource. ProjectionRowsMany = "many" )
Variables ¶
This section is empty.
Functions ¶
func ProjectionsCommand ¶ added in v0.5.0
ProjectionsCommand shows each projection table's manifest chain, combined columns, and logic routing. A chain's definition is spread across several manifests, so this reads the configured manifests without connecting to ClickHouse.
Types ¶
type Batch ¶
type Batch struct {
ID string
ExporterID string
FirstCursor string
LastCursor string
ObservedAt time.Time
Lifecycle []LifecycleRow
Fences []FenceRow
Purges []PurgeRow
Memberships []MembershipRow
Projections []ProjectionRow
ProjectionFailures []ProjectionFailureRow
}
type ClickHouseSink ¶
type ClickHouseSink struct {
// contains filtered or unexported fields
}
func (*ClickHouseSink) BackgroundErrors ¶
func (s *ClickHouseSink) BackgroundErrors() <-chan error
func (*ClickHouseSink) Close ¶
func (s *ClickHouseSink) Close() error
func (*ClickHouseSink) EnsureSchema ¶
func (s *ClickHouseSink) EnsureSchema(ctx context.Context, mode string) error
EnsureSchema claims only an empty database or validates this exact current baseline.
func (*ClickHouseSink) HasMembershipRows ¶ added in v0.6.0
func (s *ClickHouseSink) HasMembershipRows(ctx context.Context, exporterID, resourceID string) (bool, error)
HasMembershipRows reports whether an earlier membership export left rows for resourceID. The processor calls it only while membership export is off.
func (*ClickHouseSink) MaxIngestVersion ¶ added in v0.6.0
MaxIngestVersion returns the highest row version stored for exporterID across every versioned table, including registered projection tables.
func (*ClickHouseSink) ResolvePurge ¶ added in v0.6.0
func (*ClickHouseSink) WriteBatch ¶
func (s *ClickHouseSink) WriteBatch(ctx context.Context, batch Batch) error
type Config ¶
type Config struct {
ExportMemberships bool
ExporterID string
Addresses []string
Protocol string
Database string
Username string
Password string
PasswordFile string
TLS bool
CAFile string
AllowInsecureClickHouse bool
SchemaMode string
PayloadMode PayloadMode
AllowDecryptedContent bool
MetadataKeys []string
ProjectionPaths []string
ProjectionFailurePolicy string
ProjectionReplayID string
Disable []string
RetentionMode string
PurgeMode string
LifecycleRetention time.Duration
TombstoneRetention time.Duration
ProjectionRetention time.Duration
ProjectionFailureRetention time.Duration
TailOnlyDevelopment bool
BatchEvents int
BatchRows int
BatchBytes int
MaxRecordBytes int
BatchDelay time.Duration
RetryMin time.Duration
RetryMax time.Duration
}
Config controls one analytics export.
type LifecycleRow ¶
type MembershipRow ¶ added in v0.6.0
type PayloadMode ¶
type PayloadMode string
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func (*Processor) BackgroundErrors ¶
func (*Processor) Bootstrap ¶
func (p *Processor) Bootstrap(ctx context.Context, events processruntime.EventClient, save func(context.Context) error) (string, error)
func (*Processor) ContentType ¶
func (*Processor) Handle ¶
func (p *Processor) Handle(ctx context.Context, event processruntime.EventEnvelope) error
func (*Processor) SetLeaseGeneration ¶
type Projection ¶
type Projection struct {
Name string
Digest string
Resource string
Ordering string
// Selector is the content type or memory kind the manifest adds to its chain. It is
// empty for later manifests that only replace logic or add columns.
Selector string
TableName string
RowMode string
ColumnNames []string
Columns map[string]projectionColumn
// Previous names the manifest before this one; it is empty for the first manifest of a chain.
Previous string
ProjectionRegoReplaces string
ProjectionRegoFrom string
AddColumns map[string]projectionColumn
// contains filtered or unexported fields
}
Projection is one loaded AnalyticsProjection manifest. Manifests form chains: the first manifest of a chain defines the table, and each later manifest names the manifest before it. After loading, TableName, RowMode, ColumnNames, and Columns describe the chain's shared table, so every manifest in a chain writes the same column set.
func (*Projection) Rows ¶
func (p *Projection) Rows(ctx context.Context, base ProjectionRow, input map[string]any) ([]ProjectionRow, string)
Rows evaluates the projection for one resource snapshot. It returns the rows to write, or a payload-free error code when any row is invalid. The base row supplies the shared resource identity and event metadata.
func (*Projection) TombstoneRow ¶
func (p *Projection) TombstoneRow(base ProjectionRow) ProjectionRow
TombstoneRow returns the row that marks the resource as deleted in the projection table.
type ProjectionFailureRow ¶
type ProjectionRow ¶
type ProjectionRow struct {
Common
ProjectionName string
TableName string
ResourceID string
ConversationID string
ConversationGroupID string
IsDeleted bool
// Multi marks rows for tables created with `rows: many`; RowIndex and RowCount are only written for them.
Multi bool
RowIndex uint32
RowCount uint32
ColumnNames []string
Values []any
}
type ProjectionSet ¶
type ProjectionSet struct {
Items []*Projection
Tables []*ProjectionTable
Digest string
// contains filtered or unexported fields
}
func LoadProjectionSet ¶
func LoadProjectionSet(ctx context.Context, paths []string) (*ProjectionSet, error)
func (*ProjectionSet) Match ¶ added in v0.5.0
func (s *ProjectionSet) Match(resource, selector string) []*Projection
Match returns the manifests whose logic projects resources of the given kind and selector, one per table, ordered by table name.
type ProjectionTable ¶ added in v0.5.0
type ProjectionTable struct {
Name string
Resource string
RowMode string
Ordering string
// Manifests lists the chain in order, starting with the manifest that defines the table.
Manifests []*Projection
// ColumnNames is sorted; Columns holds the first manifest's columns plus every addColumns.
ColumnNames []string
Columns map[string]projectionColumn
// ColumnOrder is the physical column order: the first manifest's columns sorted by name,
// then each manifest's addColumns sorted by name, in chain order.
ColumnOrder []string
// ColumnOwners maps each column to the manifest that declared it.
ColumnOwners map[string]string
// Logic maps each covered content type or memory kind to the manifest whose logic
// projects it.
Logic map[string]*Projection
}
ProjectionTable is one projection chain and the table its manifests write to.
type RunningProcessor ¶
type RunningProcessor struct {
// contains filtered or unexported fields
}
func StartProcessor ¶
func StartProcessor(ctx context.Context, opts StartOptions) (*RunningProcessor, error)
func (*RunningProcessor) Wait ¶
func (p *RunningProcessor) Wait() error
type StartOptions ¶
type StartOptions struct {
Capabilities capabilityClient
Endpoint string
ClientID string
APIKey string
OIDC processruntime.OIDCConfig
AfterCursor string
CheckpointInterval time.Duration
LeaseTTL time.Duration
HealthAddress string
GRPCTLS bool
GRPCCAFile string
AllowInsecureGRPC bool
Config Config
Events processruntime.EventClient
Checkpoints processruntime.CheckpointClient
Sink Sink
}