metrics

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	IncreaseMetricAPI IIncreaseMetric
}

Client is a metrics client.

func (*Client) IncreaseCacheHitMetric

func (c *Client) IncreaseCacheHitMetric(ctx context.Context, metricName string)

IncreaseCacheHitMetric increases the cache hit metric.

func (*Client) IncreaseCacheMissMetric

func (c *Client) IncreaseCacheMissMetric(ctx context.Context, metricName string)

IncreaseCacheMissMetric increases the cache miss metric.

func (*Client) IncreaseCacheSoftHitMetric

func (c *Client) IncreaseCacheSoftHitMetric(ctx context.Context, metricName string)

IncreaseCacheSoftHitMetric increases the cache soft hit metric.

type Config

type Config struct {
	// MetricsProvider is the type of metrics to use. These are constants in the metrics package.
	MetricsProvider MetricsType
	// CustomConfiguration is a configuration for a custom metrics client. This field is required only if MetricsProvider is set to
	// CustomMetricsType.
	CustomConfiguration *CustomConfig
}

Config is a configuration struct for the metrics client.

func (*Config) Freeze

func (c *Config) Freeze() (*Client, error)

Freeze freezes the metrics configuration and generates the respective metrics client.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the metrics configuration.

type CustomConfig

type CustomConfig struct {
	Client IIncreaseMetric
}

CustomConfig is a configuration struct for a custom metrics client.

type IIncreaseMetric

type IIncreaseMetric interface {
	IncreaseCacheHitMetric(ctx context.Context, metricName string)
	IncreaseCacheMissMetric(ctx context.Context, metricName string)
	IncreaseCacheSoftHitMetric(ctx context.Context, metricName string)
}

IIncreaseMetric is an interface for a basic increase metrics client.

type MetricsType

type MetricsType int32

MetricsType is the type of metrics provider that Heimdall will use to emit cache hit, soft hit, miss metrics.

const (
	// CustomMetricsType allows the user to BYOM (Bring your own metrics) as long as the user's metrics client fullfils the interface.
	CustomMetricsType MetricsType = iota + 1
)

Jump to

Keyboard shortcuts

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