counter

package
v0.0.0-...-c70a42a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecrementMasterUserRecordCount

func DecrementMasterUserRecordCount(logger logr.Logger, domain metrics.Domain)

DecrementMasterUserRecordCount decreases the number of MasterUserRecord in the cached counter

func DecrementSpaceCount

func DecrementSpaceCount(logger logr.Logger, clusterName string)

DecrementSpaceCount decreases the number of Spaces for the given member cluster in the cached counter

func IncrementMasterUserRecordCount

func IncrementMasterUserRecordCount(logger logr.Logger, domain metrics.Domain)

IncrementMasterUserRecordCount increments the number of MasterUserRecord in the cached counter

func IncrementSpaceCount

func IncrementSpaceCount(logger logr.Logger, clusterName string)

IncrementSpaceCount increments the number of Space's for the given member cluster in the cached counter

func Reset

func Reset()

Reset resets the cached counter - is supposed to be used only in tests

func Synchronize

func Synchronize(ctx context.Context, cl runtimeclient.Client, toolchainStatus *toolchainv1alpha1.ToolchainStatus) error

Synchronize synchronizes the content of the ToolchainStatus with the cached counter

If the counter hasn't been initialized yet, then it adds the actual cached count to the one taken from ToolchainStatus and marks the cached as initialized

If the ToolchainStatus doesn't contain any MUR counts, then it lists all existing MURs, counts them and stores in both cache and ToolchainStatus object

If the cached counter is initialized and ToolchainStatus contains already some numbers then it updates the ToolchainStatus numbers with the one taken from the cached counter

func UpdateUsersPerActivationCounters

func UpdateUsersPerActivationCounters(logger logr.Logger, activations int, domain metrics.Domain)

UpdateUsersPerActivationCounters updates the activation counters and metrics When a user signs up for the 1st time, her `activations` number is `1`, on the second time, it's `2`, etc.

Types

type Counts

type Counts struct {
	// MasterUserRecordPerDomainCounts the number of MasterUserRecords per email address domain (`internal` vs `external`)
	MasterUserRecordPerDomainCounts map[string]int
	// SpacesPerClusterCounts the number of UserAccounts by cluster name
	SpacesPerClusterCounts map[string]int
	// UsersPerActivationCounts the number of users indexed by their number of activations and their email address domain. Eg: "1,internal","1,external",etc.
	UserSignupsPerActivationAndDomainCounts map[string]int
}

Counts is type that contains number of MURs and number of UserAccounts per member cluster

func GetCounts

func GetCounts() (Counts, error)

GetCounts returns Counts struct containing number of MURs and number of UserAccounts per member cluster. If the counter is not yet initialized, then it returns error

func (Counts) MasterUserRecords

func (c Counts) MasterUserRecords() int

Jump to

Keyboard shortcuts

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