metrics

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 41 Imported by: 2

Documentation

Overview

Package metrics records stats of agones controllers

Index

Constants

View Source
const (

	// GameServersStateCount is the size of LRU cache and should contain all gameservers state changes
	// Upper bound could be estimated as 10_000 of gameservers in total each moment, 10 state changes per each gameserver
	// and about 10 minutes for a game session, and 6 gameservers per hour.
	// For one hour 600k capacity would be enough, even if no records would be deleted.
	// And calcDuration algorithm is removing those records, which already has been changed (old statuses).
	// Key is Namespace, fleetName, GameServerName, State and float64 as value.
	// Roughly 256 + 63 + 63 + 16 + 4 = 400 bytes per every record.
	// In total we would have 229 MiB of space required to store GameServer State durations.
	GameServersStateCount = 600_000
)

Variables

View Source
var (
	// MetricResyncPeriod is the interval to re-synchronize metrics based on indexed cache.
	MetricResyncPeriod = time.Second * 15
)

Functions

func MustTagKey added in v1.0.0

func MustTagKey(key string) tag.Key

MustTagKey creates a new `tag.Key` from a string, panic if the key is not a valid.

func RegisterPrometheusExporter

func RegisterPrometheusExporter(registry *prom.Registry) (http.Handler, error)

RegisterPrometheusExporter register a prometheus exporter to OpenCensus with a given prometheus metric registry. It will automatically add go runtime and process metrics using default prometheus collectors. The function return an http.handler that you can use to expose the prometheus endpoint.

func RegisterStackdriverExporter added in v0.8.0

func RegisterStackdriverExporter(projectID string, defaultLabels string) (*stackdriver.Exporter, error)

RegisterStackdriverExporter register a Stackdriver exporter to OpenCensus. It will add Agones metrics into Stackdriver on Google Cloud.

func SetReportingPeriod added in v0.8.0

func SetReportingPeriod(forPrometheus, forStackdriver bool)

SetReportingPeriod set appropriate reporting period which depends on exporters we are going to use

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is a metrics controller collecting Agones state metrics

func NewController

func NewController(
	kubeClient kubernetes.Interface,
	agonesClient versioned.Interface,
	kubeInformerFactory informers.SharedInformerFactory,
	agonesInformerFactory externalversions.SharedInformerFactory) *Controller

NewController returns a new metrics controller

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, _ int) error

Run the Metrics controller. Will block until stop is closed. Collect metrics via cache changes and parse the cache periodically to record resource counts.

type GameServerCount

type GameServerCount map[agonesv1.GameServerState]map[fleetKey]int64

GameServerCount is the count of gameserver per current state and per fleet name

Jump to

Keyboard shortcuts

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