event_schema

package
v1.8.0-preview.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package event_schema Handling HTTP requests to expose the schemas

Index

Constants

View Source
const (
	EVENT_MODELS_TABLE    = "event_models"
	SCHEMA_VERSIONS_TABLE = "schema_versions"
)

Variables

This section is empty.

Functions

func GetInstance

func GetInstance() types.EventSchemasI

GetInstance returns an instance of EventSchemaManagerT

func Init

func Init()

func Init2

func Init2()

Types

type CounterItem

type CounterItem struct {
	Value     string
	Frequency float64
}

type CounterTypeT

type CounterTypeT string
const (
	LossyCount    CounterTypeT = "LossyCount"
	StickySampler CounterTypeT = "StickySampler"
)

type EventIdentifier

type EventIdentifier string

type EventModelMapT

type EventModelMapT map[WriteKey]map[EventType]map[EventIdentifier]*EventModelT

EventModelMapT : <writeKey, eventType, eventIdentifier> to EventModel Mapping

type EventModelT

type EventModelT struct {
	ID              int
	UUID            string `json:"EventID"`
	WriteKey        string `json:"WriteKey"`
	EventType       string `json:"EventType"`
	EventIdentifier string `json:"EventIdentifier"`
	CreatedAt       time.Time
	Schema          json.RawMessage
	Metadata        json.RawMessage `json:"-"`
	PrivateData     json.RawMessage `json:"-"`
	LastSeen        time.Time

	TotalCount int64
	Archived   bool
	// contains filtered or unexported fields
}

EventModelT is a struct that represents EVENT_MODELS_TABLE

type EventPayloadT

type EventPayloadT struct {
	WriteKey   string
	ReceivedAt string
	Batch      []EventT
}

EventPayloadT : Generic type for gateway event payload

type EventSchemaManagerT

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

EventSchemaManagerT handles all event-schemas related features

func (*EventSchemaManagerT) GetEventModelMetadata

func (manager *EventSchemaManagerT) GetEventModelMetadata(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) GetEventModels

func (manager *EventSchemaManagerT) GetEventModels(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) GetEventVersions

func (manager *EventSchemaManagerT) GetEventVersions(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) GetJsonSchemas

func (manager *EventSchemaManagerT) GetJsonSchemas(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) GetKeyCounts

func (manager *EventSchemaManagerT) GetKeyCounts(w http.ResponseWriter, r *http.Request)

TODO: Complete this

func (*EventSchemaManagerT) GetSchemaVersionMetadata

func (manager *EventSchemaManagerT) GetSchemaVersionMetadata(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) GetSchemaVersionMissingKeys

func (manager *EventSchemaManagerT) GetSchemaVersionMissingKeys(w http.ResponseWriter, r *http.Request)

func (*EventSchemaManagerT) NewSchemaVersion

func (*EventSchemaManagerT) NewSchemaVersion(versionID string, schema map[string]string, schemaHash, eventModelID string) *SchemaVersionT

NewSchemaVersion should be used when a schemaVersion is not found in its cache and requires, a schemaVersionID for the newSchema and the eventModelID to which it belongs along with schema and schemaHash

func (*EventSchemaManagerT) RecordEventSchema

func (*EventSchemaManagerT) RecordEventSchema(writeKey, eventBatch string) bool

RecordEventSchema : Records event schema for every event in the batch

func (*EventSchemaManagerT) Setup

func (manager *EventSchemaManagerT) Setup()

type EventT

type EventT map[string]interface{}

EventT : Generic type for singular event

type EventType

type EventType string

type FrequencyCounter

type FrequencyCounter struct {
	Name        string
	CounterType CounterTypeT
	Counter     countish.LossyCounter
}

func NewFrequencyCounter

func NewFrequencyCounter(name string) *FrequencyCounter

func NewPeristedFrequencyCounter

func NewPeristedFrequencyCounter(persistedFc *FrequencyCounter) *FrequencyCounter

func (*FrequencyCounter) ItemsAboveThreshold

func (fc *FrequencyCounter) ItemsAboveThreshold() []countish.Entry

func (*FrequencyCounter) Observe

func (fc *FrequencyCounter) Observe(key *string)

type GatewayEventBatchT

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

GatewayEventBatchT : Type sent from gateway

type JSPropertyT

type JSPropertyT struct {
	Property map[string]interface{} `json:"properties"`
}

type JSPropertyTypeT

type JSPropertyTypeT struct {
	Type []string `json:"type"`
}

type JsonSchemaT

type JsonSchemaT struct {
	Schema            map[string]interface{} `json:"schema"`
	SchemaType        string                 `json:"schemaType"`
	SchemaTIdentifier string                 `json:"schemaIdentifier"`
}

type MetaDataT

type MetaDataT struct {
	SampledEvents []interface{}
	TotalCount    int64
	Counters      map[string][]*CounterItem `json:"FrequentValues"`
}

type OffloadedModelT

type OffloadedModelT struct {
	UUID            string
	LastSeen        time.Time
	WriteKey        string
	EventType       string
	EventIdentifier string
}

type OffloadedSchemaVersionT

type OffloadedSchemaVersionT struct {
	UUID         string
	EventModelID string
	LastSeen     time.Time
	SchemaHash   string
}

type PrivateDataT

type PrivateDataT struct {
	FrequencyCounters []*FrequencyCounter
}

type ReservoirSample

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

func NewReservoirSampler

func NewReservoirSampler(reservoirSize, currSize int, totalCount int64) (rs *ReservoirSample)

type SchemaVersionMapT

type SchemaVersionMapT map[string]map[string]*SchemaVersionT

SchemaVersionMapT : <event_model_id, schema_hash> to SchemaVersion Mapping

type SchemaVersionT

type SchemaVersionT struct {
	ID           int64
	UUID         string `json:"VersionID"`
	SchemaHash   string `json:"-"`
	EventModelID string
	Schema       json.RawMessage
	Metadata     json.RawMessage `json:"-"`
	PrivateData  json.RawMessage `json:"-"`
	FirstSeen    time.Time
	LastSeen     time.Time

	TotalCount int64
	Archived   bool
	// contains filtered or unexported fields
}

SchemaVersionT is a struct that represents SCHEMA_VERSIONS_TABLE

type WriteKey

type WriteKey string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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