events

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide() fx.Option

Provide bundles everything needed for setting up all of the event objects for easier wiring into an uber fx application.

func ProvideMetrics

func ProvideMetrics() fx.Option

ProvideMetrics builds the queue-related metrics and makes them available to the container.

Types

type AuthAcquirerConfig

type AuthAcquirerConfig struct {
	JWT   acquire.RemoteBearerTokenAcquirerOptions
	Basic string
}

AuthAcquirerConfig is the auth config for the client making requests to get a device's history of events.

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	MaxRequests                uint32
	Interval                   time.Duration
	Timeout                    time.Duration
	ConsecutiveFailuresAllowed uint32
}

CircuitBreakerConfig deals with configuration for the circuit breaker.

type CodexClient

type CodexClient struct {
	Address        string
	Auth           acquire.Acquirer
	Client         httpaux.Client
	CircuitBreaker *gobreaker.CircuitBreaker
	RateLimiter    ratelimit.Limiter
	Logger         *zap.Logger
	Metrics        Measures
}

CodexClient is the client used to get events from codex.

func (*CodexClient) GetEvents

func (c *CodexClient) GetEvents(device string) []interpreter.Event

GetEvents queries codex for events related to a device.

type CodexConfig

type CodexConfig struct {
	Address        string
	Auth           AuthAcquirerConfig
	MaxRetryCount  int
	RateLimit      RateLimitConfig
	CircuitBreaker CircuitBreakerConfig
}

CodexConfig determines the auth and address for connecting to the codex cluster.

type Measures

type Measures struct {
	fx.In
	ResponseDuration            prometheus.ObserverVec `name:"client_response_duration"`
	CircuitBreakerStatus        *prometheus.GaugeVec   `name:"circuit_breaker_status"`
	CircuitBreakerRejectedCount *prometheus.CounterVec `name:"circuit_breaker_rejected_count"`
	CircuitBreakerOpenDuration  prometheus.ObserverVec `name:"circuit_breaker_open_duration"`
}

Measures contains the various codex client related metrics.

type RateLimitConfig

type RateLimitConfig struct {
	Requests int
	Tick     time.Duration
}

RateLimitConfig is the configuration for the rate limiter.

Jump to

Keyboard shortcuts

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