datastore

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MonitoringID string
View Source
var NodeID string

Functions

This section is empty.

Types

type Address

type Address struct {
	IPs   []AddressIP   `json:"ips"`
	Ports []AddressPort `json:"ports"`
}

Subsets

type AddressIP

type AddressIP struct {
	Type      string `json:"type"` // pod or external
	ID        string `json:"id"`   // Pod UID or empty
	Name      string `json:"name"`
	Namespace string `json:"namespace"` // Pod Namespace or empty
	IP        string `json:"ip"`        // Pod IP or external IP
}

type AddressPort

type AddressPort struct {
	Port     int32  `json:"port"`     // Port number
	Protocol string `json:"protocol"` // TCP or UDP
	Name     string `json:"name"`
}

type AliveConnection added in v0.6.0

type AliveConnection struct {
	CheckTime int64 // connection is alive at this time, ms
	FromIP    string
	FromType  string
	FromUID   string
	FromPort  uint16
	ToIP      string
	ToType    string
	ToUID     string
	ToPort    uint16
}

type BackendDS

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

BackendDS is a backend datastore

func NewBackendDS

func NewBackendDS(parentCtx context.Context, conf config.BackendDSConfig) *BackendDS

func (*BackendDS) DoRequest

func (b *BackendDS) DoRequest(req *http.Request) error

func (*BackendDS) PersistAliveConnection added in v0.6.0

func (b *BackendDS) PersistAliveConnection(aliveConn *AliveConnection) error

func (*BackendDS) PersistContainer

func (b *BackendDS) PersistContainer(c Container, eventType string) error

func (*BackendDS) PersistDaemonSet

func (b *BackendDS) PersistDaemonSet(ds DaemonSet, eventType string) error

func (*BackendDS) PersistDeployment

func (b *BackendDS) PersistDeployment(d Deployment, eventType string) error

func (*BackendDS) PersistEndpoints

func (b *BackendDS) PersistEndpoints(ep Endpoints, eventType string) error

func (*BackendDS) PersistKafkaEvent added in v0.10.0

func (b *BackendDS) PersistKafkaEvent(ke *KafkaEvent) error

func (*BackendDS) PersistPod

func (b *BackendDS) PersistPod(pod Pod, eventType string) error

func (*BackendDS) PersistReplicaSet

func (b *BackendDS) PersistReplicaSet(rs ReplicaSet, eventType string) error

func (*BackendDS) PersistRequest

func (b *BackendDS) PersistRequest(request *Request) error

func (*BackendDS) PersistService

func (b *BackendDS) PersistService(service Service, eventType string) error

func (*BackendDS) PersistStatefulSet added in v0.8.0

func (b *BackendDS) PersistStatefulSet(ss StatefulSet, eventType string) error

func (*BackendDS) SendHealthCheck added in v0.2.0

func (b *BackendDS) SendHealthCheck(tracing bool, metrics bool, logs bool, nsFilter string, k8sVersion string) chan HealthCheckAction

func (*BackendDS) Start added in v0.7.3

func (ds *BackendDS) Start()

type BackendResponse

type BackendResponse struct {
	Msg    string `json:"msg"`
	Errors []struct {
		EventNum int         `json:"event_num"`
		Event    interface{} `json:"event"`
		Error    string      `json:"error"`
	} `json:"errors"`
}

type CloudProvider added in v0.3.1

type CloudProvider string
const (
	CloudProviderAWS          CloudProvider = "AWS"
	CloudProviderGCP          CloudProvider = "GCP"
	CloudProviderAzure        CloudProvider = "Azure"
	CloudProviderDigitalOcean CloudProvider = "DigitalOcean"
	CloudProviderUnknown      CloudProvider = ""
)

type ConnInfo added in v0.6.0

type ConnInfo [9]interface{}

0) CheckTime // connection is alive at that time 1) Source IP 2) Source Type 3) Source ID 4) Source Port 5) Destination IP 6) Destination Type 7) Destination ID 8) Destination Port

type ConnInfoPayload added in v0.6.0

type ConnInfoPayload struct {
	Metadata    Metadata    `json:"metadata"`
	Connections []*ConnInfo `json:"connections"`
}

type Container

type Container struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	PodUID    string `json:"pod"` // Pod UID
	Image     string `json:"image"`
	Ports     []struct {
		Port     int32  `json:"port"`
		Protocol string `json:"protocol"`
	} `json:"ports"`
}

type ContainerEvent

type ContainerEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Pod       string `json:"pod"`
	Image     string `json:"image"`
	Ports     []struct {
		Port     int32  `json:"port"`
		Protocol string `json:"protocol"`
	} `json:"ports"`
}

type DaemonSet

type DaemonSet struct {
	UID       string // ReplicaSet UID
	Name      string // ReplicaSet Name
	Namespace string // Namespace
}

type DataStore

type DataStore interface {
	PersistPod(pod Pod, eventType string) error
	PersistService(service Service, eventType string) error
	PersistReplicaSet(rs ReplicaSet, eventType string) error
	PersistDeployment(d Deployment, eventType string) error
	PersistEndpoints(e Endpoints, eventType string) error
	PersistContainer(c Container, eventType string) error
	PersistDaemonSet(ds DaemonSet, eventType string) error
	PersistStatefulSet(ss StatefulSet, eventType string) error

	PersistRequest(request *Request) error

	PersistKafkaEvent(request *KafkaEvent) error

	PersistAliveConnection(trace *AliveConnection) error
}

type DepEvent

type DepEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Replicas  int32  `json:"replicas"`
}

type Deployment

type Deployment struct {
	UID       string // Deployment UID
	Name      string // Deployment Name
	Namespace string // Namespace
	Replicas  int32  // Number of replicas
}

type DirectionalEvent added in v0.10.0

type DirectionalEvent interface {
	SetFromUID(string)
	SetFromIP(string)
	SetFromType(string)
	SetFromPort(uint16)

	SetToUID(string)
	SetToIP(string)
	SetToType(string)
	SetToPort(uint16)

	ReverseDirection()
}

type DsEvent

type DsEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type Endpoints

type Endpoints struct {
	UID       string // Endpoints UID
	Name      string // Endpoints Name
	Namespace string // Namespace
	Addresses []Address
}

type EpEvent

type EpEvent struct {
	UID       string    `json:"uid"`
	EventType string    `json:"event_type"`
	Name      string    `json:"name"`
	Namespace string    `json:"namespace"`
	Addresses []Address `json:"addresses"`
}

type EventPayload

type EventPayload struct {
	Metadata Metadata      `json:"metadata"`
	Events   []interface{} `json:"events"`
}

type HealthCheckAction added in v0.8.0

type HealthCheckAction string
const (
	HealthCheckActionStop HealthCheckAction = "payment_required"
	HealthCheckActionOK   HealthCheckAction = "ok"
)

type HealthCheckPayload added in v0.2.0

type HealthCheckPayload struct {
	Metadata Metadata `json:"metadata"`
	Info     struct {
		TracingEnabled  bool   `json:"tracing"`
		MetricsEnabled  bool   `json:"metrics"`
		LogsEnabled     bool   `json:"logs"`
		NamespaceFilter string `json:"namespace_filter"`
	} `json:"alaz_info"`
	Telemetry struct {
		KernelVersion string `json:"kernel_version"`
		K8sVersion    string `json:"k8s_version"`
		CloudProvider string `json:"cloud_provider"`
	} `json:"telemetry"`
}

type KafkaEvent added in v0.10.0

type KafkaEvent struct {
	StartTime int64
	Latency   uint64 // in ns
	FromIP    string
	FromType  string
	FromUID   string
	FromPort  uint16
	ToIP      string
	ToType    string
	ToUID     string
	ToPort    uint16
	Topic     string
	Partition uint32
	Key       string
	Value     string
	Type      string // PUBLISH or CONSUME
	Tls       bool
}

func (*KafkaEvent) ReverseDirection added in v0.10.0

func (req *KafkaEvent) ReverseDirection()

func (*KafkaEvent) SetFromIP added in v0.10.0

func (ke *KafkaEvent) SetFromIP(ip string)

func (*KafkaEvent) SetFromPort added in v0.10.0

func (ke *KafkaEvent) SetFromPort(port uint16)

func (*KafkaEvent) SetFromType added in v0.10.0

func (ke *KafkaEvent) SetFromType(typ string)

func (*KafkaEvent) SetFromUID added in v0.10.0

func (ke *KafkaEvent) SetFromUID(uid string)

func (*KafkaEvent) SetToIP added in v0.10.0

func (ke *KafkaEvent) SetToIP(ip string)

func (*KafkaEvent) SetToPort added in v0.10.0

func (ke *KafkaEvent) SetToPort(port uint16)

func (*KafkaEvent) SetToType added in v0.10.0

func (ke *KafkaEvent) SetToType(typ string)

func (*KafkaEvent) SetToUID added in v0.10.0

func (ke *KafkaEvent) SetToUID(uid string)

type KafkaEventInfo added in v0.10.0

type KafkaEventInfo [16]interface{}

0) StartTime 1) Latency 2) Source IP 3) Source Type 4) Source ID 5) Source Port 6) Destination IP 7) Destination Type 8) Destination ID 9) Destination Port 10) Topic 11) Partition 12) Key 13) Value 14) Type 15) Encrypted (bool)

type KafkaEventInfoPayload added in v0.10.0

type KafkaEventInfoPayload struct {
	Metadata    Metadata          `json:"metadata"`
	KafkaEvents []*KafkaEventInfo `json:"kafka_events"`
}

type LeveledLogger added in v0.2.0

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

func (LeveledLogger) Debug added in v0.2.0

func (ll LeveledLogger) Debug(msg string, keysAndValues ...interface{})

func (LeveledLogger) Error added in v0.2.0

func (ll LeveledLogger) Error(msg string, keysAndValues ...interface{})

func (LeveledLogger) Info added in v0.2.0

func (ll LeveledLogger) Info(msg string, keysAndValues ...interface{})

func (LeveledLogger) Warn added in v0.2.0

func (ll LeveledLogger) Warn(msg string, keysAndValues ...interface{})

type Metadata added in v0.2.0

type Metadata struct {
	MonitoringID   string `json:"monitoring_id"`
	IdempotencyKey string `json:"idempotency_key"`
	NodeID         string `json:"node_id"`
	AlazVersion    string `json:"alaz_version"`
}

type Pod

type Pod struct {
	UID       string // Pod UID
	Name      string // Pod Name
	Namespace string // Namespace
	Image     string // Main container image
	IP        string // Pod IP
	OwnerType string // ReplicaSet or nil
	OwnerID   string // ReplicaSet UID
	OwnerName string // ReplicaSet Name
}

type PodEvent

type PodEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	IP        string `json:"ip"`
	OwnerType string `json:"owner_type"`
	OwnerName string `json:"owner_name"`
	OwnerID   string `json:"owner_id"`
}

type ReplicaSet

type ReplicaSet struct {
	UID       string // ReplicaSet UID
	Name      string // ReplicaSet Name
	Namespace string // Namespace
	OwnerType string // Deployment or nil
	OwnerID   string // Deployment UID
	OwnerName string // Deployment Name
	Replicas  int32  // Number of replicas
}

type ReqBackendReponse added in v0.2.0

type ReqBackendReponse struct {
	Msg    string `json:"msg"`
	Errors []struct {
		EventNum int         `json:"request_num"`
		Event    interface{} `json:"request"`
		Error    string      `json:"errors"`
	} `json:"errors"`
}

type ReqInfo

type ReqInfo [16]interface{}

0) StartTime 1) Latency 2) Source IP 3) Source Type 4) Source ID 5) Source Port 6) Destination IP 7) Destination Type 8) Destination ID 9) Destination Port 10) Protocol 11) Response Status Code 12) Fail Reason // TODO: not used yet 13) Method 14) Path 15) Encrypted (bool)

type Request

type Request struct {
	StartTime  int64
	Latency    uint64 // in ns
	FromIP     string
	FromType   string
	FromUID    string
	FromPort   uint16
	ToIP       string
	ToType     string
	ToUID      string
	ToPort     uint16
	Protocol   string
	Tls        bool
	Completed  bool
	StatusCode uint32
	FailReason string
	Method     string
	Path       string
}

func (*Request) ReverseDirection added in v0.10.0

func (req *Request) ReverseDirection()

func (*Request) SetFromIP added in v0.10.0

func (r *Request) SetFromIP(ip string)

func (*Request) SetFromPort added in v0.10.0

func (r *Request) SetFromPort(port uint16)

func (*Request) SetFromType added in v0.10.0

func (r *Request) SetFromType(typ string)

func (*Request) SetFromUID added in v0.10.0

func (r *Request) SetFromUID(uid string)

func (*Request) SetToIP added in v0.10.0

func (r *Request) SetToIP(ip string)

func (*Request) SetToPort added in v0.10.0

func (r *Request) SetToPort(port uint16)

func (*Request) SetToType added in v0.10.0

func (r *Request) SetToType(typ string)

func (*Request) SetToUID added in v0.10.0

func (r *Request) SetToUID(uid string)

type RequestsPayload

type RequestsPayload struct {
	Metadata Metadata   `json:"metadata"`
	Requests []*ReqInfo `json:"requests"`
}

type RsEvent

type RsEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Replicas  int32  `json:"replicas"`
	OwnerType string `json:"owner_type"`
	OwnerName string `json:"owner_name"`
	OwnerID   string `json:"owner_id"`
}

type Service

type Service struct {
	UID        string
	Name       string
	Namespace  string
	Type       string
	ClusterIP  string
	ClusterIPs []string
	Ports      []struct {
		Name     string `json:"name"`
		Src      int32  `json:"src"`
		Dest     int32  `json:"dest"`
		Protocol string `json:"protocol"`
	}
}

type SsEvent added in v0.8.0

type SsEvent struct {
	UID       string `json:"uid"`
	EventType string `json:"event_type"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type StatefulSet added in v0.8.0

type StatefulSet struct {
	UID       string // ReplicaSet UID
	Name      string // ReplicaSet Name
	Namespace string // Namespace
}

type SvcEvent

type SvcEvent struct {
	UID        string   `json:"uid"`
	EventType  string   `json:"event_type"`
	Name       string   `json:"name"`
	Namespace  string   `json:"namespace"`
	Type       string   `json:"type"`
	ClusterIPs []string `json:"cluster_ips"`
	Ports      []struct {
		Name     string `json:"name"`
		Src      int32  `json:"src"`
		Dest     int32  `json:"dest"`
		Protocol string `json:"protocol"`
	} `json:"ports"`
}

type TraceInfo added in v0.4.0

type TraceInfo [4]interface{}

0) Timestamp 1) Tcp Seq Num 2) Tid 3) Ingress(true), Egress(false)

type TracePayload added in v0.4.0

type TracePayload struct {
	Metadata Metadata     `json:"metadata"`
	Traces   []*TraceInfo `json:"traffic"`
}

Jump to

Keyboard shortcuts

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