dbwriter

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPartition          = ckdb.TimeFuncTwelveHour
	DefaultPerfEventPartition = ckdb.TimeFuncHour
	IO_EVENT_TYPE_READ        = "read"
	IO_EVENT_TYPE_WRITE       = "write"
)
View Source
const (
	EVENT_DB = "event"
)

Variables

View Source
var EventCounter uint32

Functions

func AlertEventColumns

func AlertEventColumns() []*ckdb.Column

func EventColumns

func EventColumns(hasMetrics bool) []*ckdb.Column

func GenAlertEventCKTable

func GenAlertEventCKTable(cluster, storagePolicy, ckdbType string, ttl int, coldStorage *ckdb.ColdStorage) *ckdb.Table

func GenEventCKTable

func GenEventCKTable(cluster, storagePolicy, table, ckdbType string, ttl int, coldStorage *ckdb.ColdStorage) *ckdb.Table

func ReleaseAlertEventStore

func ReleaseAlertEventStore(e *AlertEventStore)

func ReleaseEventStore

func ReleaseEventStore(e *EventStore)

Types

type AlertEventStore

type AlertEventStore struct {
	Time uint32

	PolicyId     uint32
	PolicyType   uint8
	AlertPlicy   string
	MetricValue  float64
	EventLevel   uint8
	TargetTags   string
	TagStrKeys   []string
	TagStrValues []string
	TagIntKeys   []string
	TagIntValues []int64

	XTargetUid   string
	XQueryRegion string

	UserId uint32
	OrgId  uint16
	TeamID uint16
	// contains filtered or unexported fields
}

func AcquireAlertEventStore

func AcquireAlertEventStore() *AlertEventStore

func (*AlertEventStore) GenerateNewFlowTags

func (e *AlertEventStore) GenerateNewFlowTags(cache *flow_tag.FlowTagCache)

func (*AlertEventStore) OrgID

func (e *AlertEventStore) OrgID() uint16

func (*AlertEventStore) Release

func (e *AlertEventStore) Release()

func (*AlertEventStore) SetId

func (e *AlertEventStore) SetId(time, analyzerID uint32)

func (*AlertEventStore) Table

func (e *AlertEventStore) Table() string

func (*AlertEventStore) WriteBlock

func (e *AlertEventStore) WriteBlock(block *ckdb.Block)

type ClusterNode

type ClusterNode struct {
	Addr string
	Port uint16
}

type EventStore

type EventStore struct {
	pool.ReferenceCount

	Time uint32 `json:"time" category:"$tag" sub:"flow_info"` // s

	StartTime int64 `json:"start_time" category:"$tag" sub:"flow_info"` // us
	EndTime   int64 `json:"end_time" category:"$tag" sub:"flow_info"`   // us

	Tagged uint8

	SignalSource     uint8  `json:"signal_source" category:"$tag" sub:"capture_info" enumfile:"perf_event_signal_source"` // Resource / File IO
	EventType        string `json:"event_type" category:"$tag" sub:"event_info" enumfile:"perf_event_type"`
	EventDescription string
	ProcessKName     string `json:"process_kname" category:"$tag" sub:"service_info"` // us

	GProcessID uint32 `json:"gprocess_id" category:"$tag" sub:"universal_tag"`

	RegionID     uint16 `json:"region_id" category:"$tag" sub:"universal_tag"`
	AZID         uint16 `json:"az_id" category:"$tag" sub:"universal_tag"`
	L3EpcID      int32  `json:"l3_epc_id" category:"$tag" sub:"universal_tag"`
	HostID       uint16 `json:"host_id" category:"$tag" sub:"universal_tag"`
	PodID        uint32 `json:"pod_id" category:"$tag" sub:"universal_tag"`
	PodNodeID    uint32 `json:"host_node_id" category:"$tag" sub:"universal_tag"`
	PodNSID      uint16 `json:"pod_ns_id" category:"$tag" sub:"universal_tag"`
	PodClusterID uint16 `json:"pod_cluster_id" category:"$tag" sub:"universal_tag"`
	PodGroupID   uint32 `json:"pod_group_id" category:"$tag" sub:"universal_tag"`
	L3DeviceType uint8  `json:"l3_device_type" category:"$tag" sub:"universal_tag"`
	L3DeviceID   uint32 `json:"l3_device_id" category:"$tag" sub:"universal_tag"`
	ServiceID    uint32 `json:"service_id" category:"$tag" sub:"universal_tag"`
	VTAPID       uint16 `json:"agent_id" category:"$tag" sub:"universal_tag"`
	SubnetID     uint16 `json:"subnet_id" category:"$tag" sub:"universal_tag"`
	IsIPv4       bool   `json:"is_ipv4" category:"$tag" sub:"network_layer"`
	IP4          uint32 `json:"ip4" category:"$tag" sub:"network_layer" to_string:"IPv4String"`
	IP6          net.IP `json:"ip6" category:"$tag" sub:"network_layer"  to_string:"IPv6String"`

	// Not stored, only determines which database to store in.
	// When Orgid is 0 or 1, it is stored in database 'event', otherwise stored in '<OrgId>_event'.
	OrgId  uint16 `json:"org_id" category:"$tag"`
	TeamID uint16 `json:"team_id" category:"$tag"`

	AutoInstanceID   uint32 `json:"auto_instance_id" category:"$tag" sub:"universal_tag"`
	AutoInstanceType uint8  `json:"auto_instance_type" category:"$tag" sub:"universal_tag" enumfile:"auto_instance_type"`
	AutoServiceID    uint32 `json:"auto_service_id" category:"$tag" sub:"universal_tag"`
	AutoServiceType  uint8  `json:"auto_service_type" category:"$tag" sub:"universal_tag" enumfile:"auto_service_type"`

	AppInstance string `json:"app_instance" category:"$tag" sub:"service_info"`

	AttributeNames  []string `json:"attribute_names" category:"$tag" sub:"native_tag" data_type:"[]string"`
	AttributeValues []string `json:"attribute_values" category:"$tag" sub:"native_tag" data_type:"[]string"`

	HasMetrics bool
	Bytes      uint32 `json:"bytes" category:"$metrics" sub:"throughput"`
	Duration   uint64 `json:"duration" category:"$metrics" sub:"delay"`
	// contains filtered or unexported fields
}

func AcquireEventStore

func AcquireEventStore() *EventStore

func (*EventStore) DataSource

func (e *EventStore) DataSource() uint32

func (*EventStore) EncodeTo

func (e *EventStore) EncodeTo(protocol config.ExportProtocol, utags *utag.UniversalTagsManager, cfg *config.ExporterCfg) (interface{}, error)

func (*EventStore) GenerateNewFlowTags

func (e *EventStore) GenerateNewFlowTags(cache *flow_tag.FlowTagCache)

func (*EventStore) GetFieldValueByOffsetAndKind

func (e *EventStore) GetFieldValueByOffsetAndKind(offset uintptr, kind reflect.Kind, dataType utils.DataType) interface{}

func (*EventStore) OrgID

func (e *EventStore) OrgID() uint16

func (*EventStore) QueryUniversalTags

func (e *EventStore) QueryUniversalTags(utags *utag.UniversalTagsManager) *utag.UniversalTags

func (*EventStore) Release

func (e *EventStore) Release()

func (*EventStore) SetId

func (e *EventStore) SetId(time, analyzerID uint32)

func (*EventStore) Table

func (e *EventStore) Table() string

func (*EventStore) TimestampUs

func (e *EventStore) TimestampUs() int64

func (*EventStore) WriteBlock

func (e *EventStore) WriteBlock(block *ckdb.Block)

type EventWriter

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

func NewAlertEventWriter

func NewAlertEventWriter(config *config.Config) (*EventWriter, error)

func NewEventWriter

func NewEventWriter(eventType common.EventType, decoderIndex int, config *config.Config) (*EventWriter, error)

func (*EventWriter) Write

func (w *EventWriter) Write(e *EventStore)

func (*EventWriter) WriteAlertEvent

func (w *EventWriter) WriteAlertEvent(e *AlertEventStore)

type SignalSource

type SignalSource uint8
const (
	SIGNAL_SOURCE_UNKNOWN SignalSource = iota
	SIGNAL_SOURCE_RESOURCE
	SIGNAL_SOURCE_IO
	SIGNAL_SOURCE_K8S
)

Jump to

Keyboard shortcuts

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