service

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

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 WithAPIKey added in v0.53.0

func WithAPIKey(apiKey string) func(s *options)

WithAPIKey sets the service API key

func WithClientCacheBypassLimit added in v0.53.0

func WithClientCacheBypassLimit(limit int, cfgPath string) func(s *options)

WithClientCacheBypassLimit validates and sets the service client cache bypass limit

func WithClientTTL added in v0.53.0

func WithClientTTL(interval time.Duration, cfgPath string) func(s *options)

WithClientTTL validates and sets the service client TTL

func WithConfigRootOverride added in v0.53.0

func WithConfigRootOverride(override string) func(s *options)

WithConfigRootOverride sets the service config root override

func WithDatabaseFileName added in v0.52.0

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

WithDatabaseFileName sets the service database file name

func WithDirectorRootOverride added in v0.53.0

func WithDirectorRootOverride(override string) func(s *options)

WithDirectorRootOverride sets the service director root override

func WithMaxBackoffInterval added in v0.53.0

func WithMaxBackoffInterval(interval time.Duration, cfgPath string) func(s *options)

WithMaxBackoffInterval validates sets the service maximum retry backoff time

func WithRcKey added in v0.53.0

func WithRcKey(rcKey string) func(s *options)

WithRcKey sets the service remote configuration key

func WithRefreshInterval added in v0.53.0

func WithRefreshInterval(interval time.Duration, cfgPath string) func(s *options)

WithRefreshInterval validates and sets the service refresh interval

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, rcType, 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