correlations

package
v0.115.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChFull = errors.New("request channel full")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex

	Token  string
	APIURL *url.URL

	TotalClientError4xxResponses int64
	TotalRetriedUpdates          int64
	TotalInvalidDimensions       int64
	// contains filtered or unexported fields
}

Client is a client for making dimensional correlations

func (*Client) Correlate

func (cc *Client) Correlate(cor *Correlation, cb CorrelateCB)

Correlate

func (*Client) Delete

func (cc *Client) Delete(cor *Correlation, callback SuccessfulDeleteCB)

Delete removes a correlation

func (*Client) Get

func (cc *Client) Get(dimName string, dimValue string, callback SuccessfulGetCB)

Get

func (*Client) Shutdown added in v0.97.0

func (cc *Client) Shutdown()

Shutdown the client. This will block until the context's cancel function is complete.

func (*Client) Start

func (cc *Client) Start()

Start the client's processing queue

type ClientConfig

type ClientConfig struct {
	Config
	AccessToken string
	URL         *url.URL
}

ClientConfig for correlation client.

type Config

type Config struct {
	MaxRequests     uint          `mapstructure:"max_requests"`
	MaxBuffered     uint          `mapstructure:"max_buffered"`
	MaxRetries      uint          `mapstructure:"max_retries"`
	LogUpdates      bool          `mapstructure:"log_updates"`
	RetryDelay      time.Duration `mapstructure:"retry_delay"`
	CleanupInterval time.Duration `mapstructure:"cleanup_interval"`
}

Config defines configuration for correlation settings.

type CorrelateCB

type CorrelateCB func(cor *Correlation, err error)

CorrelateCB is a call back invoked with Correlate requests it is not invoked if the reqeust is deduplicated, cancelled, or the client context is cancelled

type Correlation

type Correlation struct {
	// Type is the type of correlation
	Type Type
	// DimName is the dimension name
	DimName string
	// DimValue is the dimension value
	DimValue string
	// Value is the value to makeRequest with the DimName and DimValue
	Value string
}

Correlation is a struct referencing

func (*Correlation) Logger

func (c *Correlation) Logger(l log.Logger) log.Logger

type CorrelationClient

type CorrelationClient interface {
	Correlate(*Correlation, CorrelateCB)
	Delete(*Correlation, SuccessfulDeleteCB)
	Get(dimName string, dimValue string, cb SuccessfulGetCB)
	Start()
	Shutdown()
}

CorrelationClient is an interface for correlations.Client

func NewCorrelationClient

func NewCorrelationClient(ctx context.Context, log log.Logger, client *http.Client, conf ClientConfig) (CorrelationClient, error)

NewCorrelationClient returns a new Client

type ErrMaxEntries

type ErrMaxEntries struct {
	MaxEntries int64 `json:"max,omitempty"`
}

ErrMaxEntries is an error returned when the correlation endpoint returns a 418 http status code indicating that the set of services or environments is too large to add another value

func (*ErrMaxEntries) Error

func (m *ErrMaxEntries) Error() string

type SuccessfulDeleteCB

type SuccessfulDeleteCB func(cor *Correlation)

SuccessfulDeleteCB is a call back that is only invoked on successful Deletion operations

type SuccessfulGetCB

type SuccessfulGetCB func(map[string][]string)

SuccessfulGetCB

type Type

type Type string

Type is the type of correlation

const (
	// Service is for correlating services
	Service Type = "service"
	// Environment is for correlating environments
	Environment Type = "environment"
)

Jump to

Keyboard shortcuts

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