service

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package service represents the agent's core remoteconfig service

The `Service` type provides a communication layer for downstream clients to request configuration, as well as the ability to track clients for requesting complete update payloads from the remote config backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDatabaseFileName added in v0.52.0

func WithDatabaseFileName(fileName string) func(s *options)

WithDatabaseFileName sets the service database file name

func WithTraceAgentEnv

func WithTraceAgentEnv(env string) func(s *options)

WithTraceAgentEnv sets the service trace-agent environment variable

Types

type AgentMetadata

type AgentMetadata struct {
	Version string `json:"version"`
}

AgentMetadata is data stored in bolt DB to determine whether or not the agent has changed and the RC cache should be cleared

type ConfigFileMetaCustom

type ConfigFileMetaCustom struct {
	Predicates *pbgo.TracerPredicates `json:"tracer-predicates,omitempty"`
	Expires    int64                  `json:"expires"`
}

ConfigFileMetaCustom is the custom metadata of a config

type Option added in v0.52.0

type Option func(s *options)

Option is a service option

type RcTelemetryReporter

type RcTelemetryReporter interface {
	// IncRateLimit is invoked when a cache bypass request is prevented due to rate limiting
	IncRateLimit()
	// IncTimeout is invoked when a cache bypass request is cancelled due to timeout or a previous cache bypass request is still pending
	IncTimeout()
}

RcTelemetryReporter should be implemented by the agent to publish metrics on exceptional cache bypass request events

type Service

type Service struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Service defines the remote config management service responsible for fetching, storing and dispatching the configurations

func NewService

func NewService(cfg model.Reader, apiKey, baseRawURL, hostname string, tags []string, telemetryReporter RcTelemetryReporter, agentVersion string, opts ...Option) (*Service, error)

NewService instantiates a new remote configuration management service

func (*Service) ClientGetConfigs

ClientGetConfigs is the polling API called by tracers and agents to get the latest configurations

func (*Service) ConfigGetState

func (s *Service) ConfigGetState() (*pbgo.GetStateConfigResponse, error)

ConfigGetState returns the state of the configuration and the director repos in the local store

func (*Service) Start

func (s *Service) Start()

Start the remote configuration management service

func (*Service) Stop

func (s *Service) Stop() error

Stop stops the refresh loop and closes the on-disk DB cache

Jump to

Keyboard shortcuts

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