agent_tracker

package
v17.3.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "agent_tracker"
)

Variables

View Source
var File_internal_module_agent_tracker_agent_tracker_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AgentPodInfo

type AgentPodInfo struct {
	AgentId int64 `protobuf:"varint,1,opt,name=agent_id,proto3" json:"agent_id,omitempty"`
	PodId   int64 `protobuf:"varint,2,opt,name=pod_id,proto3" json:"pod_id,omitempty"`
	// contains filtered or unexported fields
}

func (*AgentPodInfo) Descriptor deprecated

func (*AgentPodInfo) Descriptor() ([]byte, []int)

Deprecated: Use AgentPodInfo.ProtoReflect.Descriptor instead.

func (*AgentPodInfo) GetAgentId

func (x *AgentPodInfo) GetAgentId() int64

func (*AgentPodInfo) GetPodId

func (x *AgentPodInfo) GetPodId() int64

func (*AgentPodInfo) ProtoMessage

func (*AgentPodInfo) ProtoMessage()

func (*AgentPodInfo) ProtoReflect

func (x *AgentPodInfo) ProtoReflect() protoreflect.Message

func (*AgentPodInfo) Reset

func (x *AgentPodInfo) Reset()

func (*AgentPodInfo) String

func (x *AgentPodInfo) String() string

type ConnectedAgentInfo

type ConnectedAgentInfo struct {
	AgentMeta    *entity.AgentMeta      `protobuf:"bytes,1,opt,name=agent_meta,proto3" json:"agent_meta,omitempty"`
	ConnectedAt  *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=connected_at,proto3" json:"connected_at,omitempty"`
	ConnectionId int64                  `protobuf:"varint,3,opt,name=connection_id,proto3" json:"connection_id,omitempty"`
	AgentId      int64                  `protobuf:"varint,4,opt,name=agent_id,proto3" json:"agent_id,omitempty"`
	ProjectId    int64                  `protobuf:"varint,5,opt,name=project_id,proto3" json:"project_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ConnectedAgentInfo) Descriptor deprecated

func (*ConnectedAgentInfo) Descriptor() ([]byte, []int)

Deprecated: Use ConnectedAgentInfo.ProtoReflect.Descriptor instead.

func (*ConnectedAgentInfo) GetAgentId

func (x *ConnectedAgentInfo) GetAgentId() int64

func (*ConnectedAgentInfo) GetAgentMeta

func (x *ConnectedAgentInfo) GetAgentMeta() *entity.AgentMeta

func (*ConnectedAgentInfo) GetConnectedAt

func (x *ConnectedAgentInfo) GetConnectedAt() *timestamppb.Timestamp

func (*ConnectedAgentInfo) GetConnectionId

func (x *ConnectedAgentInfo) GetConnectionId() int64

func (*ConnectedAgentInfo) GetProjectId

func (x *ConnectedAgentInfo) GetProjectId() int64

func (*ConnectedAgentInfo) ProtoMessage

func (*ConnectedAgentInfo) ProtoMessage()

func (*ConnectedAgentInfo) ProtoReflect

func (x *ConnectedAgentInfo) ProtoReflect() protoreflect.Message

func (*ConnectedAgentInfo) Reset

func (x *ConnectedAgentInfo) Reset()

func (*ConnectedAgentInfo) String

func (x *ConnectedAgentInfo) String() string

type ConnectedAgentInfoCallback

type ConnectedAgentInfoCallback func(*ConnectedAgentInfo) (done bool, err error)

type ConnectedAgentInfoCollector

type ConnectedAgentInfoCollector []*ConnectedAgentInfo

func (*ConnectedAgentInfoCollector) Collect

type DisconnectAgentInfo added in v17.1.0

type DisconnectAgentInfo struct {
	AgentMeta    *entity.AgentMeta `protobuf:"bytes,1,opt,name=agent_meta,proto3" json:"agent_meta,omitempty"`
	ConnectionId int64             `protobuf:"varint,2,opt,name=connection_id,proto3" json:"connection_id,omitempty"`
	AgentId      int64             `protobuf:"varint,3,opt,name=agent_id,proto3" json:"agent_id,omitempty"`
	ProjectId    int64             `protobuf:"varint,4,opt,name=project_id,proto3" json:"project_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DisconnectAgentInfo) Descriptor deprecated added in v17.1.0

func (*DisconnectAgentInfo) Descriptor() ([]byte, []int)

Deprecated: Use DisconnectAgentInfo.ProtoReflect.Descriptor instead.

func (*DisconnectAgentInfo) GetAgentId added in v17.1.0

func (x *DisconnectAgentInfo) GetAgentId() int64

func (*DisconnectAgentInfo) GetAgentMeta added in v17.1.0

func (x *DisconnectAgentInfo) GetAgentMeta() *entity.AgentMeta

func (*DisconnectAgentInfo) GetConnectionId added in v17.1.0

func (x *DisconnectAgentInfo) GetConnectionId() int64

func (*DisconnectAgentInfo) GetProjectId added in v17.1.0

func (x *DisconnectAgentInfo) GetProjectId() int64

func (*DisconnectAgentInfo) ProtoMessage added in v17.1.0

func (*DisconnectAgentInfo) ProtoMessage()

func (*DisconnectAgentInfo) ProtoReflect added in v17.1.0

func (x *DisconnectAgentInfo) ProtoReflect() protoreflect.Message

func (*DisconnectAgentInfo) Reset added in v17.1.0

func (x *DisconnectAgentInfo) Reset()

func (*DisconnectAgentInfo) String added in v17.1.0

func (x *DisconnectAgentInfo) String() string

type ExpiringRegisterer

type ExpiringRegisterer interface {
	// RegisterExpiring registers connection with the tracker.
	// Registration will expire if not refreshed using this method.
	RegisterExpiring(ctx context.Context, info *ConnectedAgentInfo) error
	// Unregister unregisters connection with the tracker.
	// This may be called to intentionally unregister the agent,
	// even though it may eventually expire.
	Unregister(ctx context.Context, info *DisconnectAgentInfo) error
}

type Querier

type Querier interface {
	GetConnectionsByAgentID(ctx context.Context, agentID int64, cb ConnectedAgentInfoCallback) error
	GetConnectionsByProjectID(ctx context.Context, projectID int64, cb ConnectedAgentInfoCallback) error
	GetConnectedAgentsCount(ctx context.Context) (int64, error)
	CountAgentsByAgentVersions(ctx context.Context) (map[string]int64, error)
}

type RedisTracker

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

func NewRedisTracker

func NewRedisTracker(log *slog.Logger, errRep errz.ErrReporter, v prototool.Validator, client rueidis.Client,
	agentKeyPrefix string, ttl, gcPeriod time.Duration, m otelmetric.Meter) (*RedisTracker, error)

func (*RedisTracker) CountAgentsByAgentVersions

func (t *RedisTracker) CountAgentsByAgentVersions(ctx context.Context) (map[string]int64, error)

func (*RedisTracker) GetConnectedAgentsCount

func (t *RedisTracker) GetConnectedAgentsCount(ctx context.Context) (int64, error)

func (*RedisTracker) GetConnectionsByAgentID

func (t *RedisTracker) GetConnectionsByAgentID(ctx context.Context, agentID int64, cb ConnectedAgentInfoCallback) error

func (*RedisTracker) GetConnectionsByProjectID

func (t *RedisTracker) GetConnectionsByProjectID(ctx context.Context, projectID int64, cb ConnectedAgentInfoCallback) error

func (*RedisTracker) RegisterExpiring

func (t *RedisTracker) RegisterExpiring(ctx context.Context, info *ConnectedAgentInfo) error

func (*RedisTracker) Run

func (t *RedisTracker) Run(ctx context.Context) error

func (*RedisTracker) Unregister added in v17.1.0

func (t *RedisTracker) Unregister(ctx context.Context, info *DisconnectAgentInfo) error

type Tracker

type Tracker interface {
	ExpiringRegisterer
	Querier
	Run(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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