usage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DefaultMeasurementId is the default unique code of the OpenEBS property in Google Analytics.
	DefaultMeasurementId string = "G-TZGP46618W"
	// DefaultApiSecret is the default measurement protocol api_secret.
	DefaultApiSecret string = "91JGdTg9QwGn7Y-vvuM4zA"

	// InstallEvent event is sent on pod starts
	InstallEvent string = "install"
	// VolumeProvision event is sent when a volume is created
	VolumeProvision string = "volume-provision"
	// VolumeDeprovision event is sent when a volume is deleted
	VolumeDeprovision string = "volume-deprovision"
	// AppName the application name
	AppName string = "OpenEBS"

	// Replica Event replication
	Replica string = "replica:"
	// DefaultReplicaCount holds the replica count string
	DefaultReplicaCount string = "replica:1"

	// RunningStatus status is running
	RunningStatus string = "running"
	// EventLabelNode holds the string label "nodes"
	EventLabelNode string = "nodes"
	// EventLabelCapacity holds the string label "capacity"
	EventLabelCapacity string = "capacity"

	// MeasurementIdEnv sets the measurement ID for the target GA4 property.
	MeasurementIdEnv = "GA_ID"
	// ApiSecretEnv sets the measurement protocol API secret for the target GA4 property.
	ApiSecretEnv = "GA_KEY"
)

Variables

View Source
var (
	GetOpenebsVersionDetails func() string
)
View Source
var OpenEBSPingPeriod = "OPENEBS_IO_ANALYTICS_PING_INTERVAL"

OpenEBSPingPeriod ping interval of volume io analytics

Functions

func PingCheck

func PingCheck(engineName, category string, pingImmediately bool)

PingCheck sends ping events to Google Analytics

func RegisterVersionGetter

func RegisterVersionGetter(getter func() string)

RegisterVersionGetter sets the function that can be used to fetch app version details.

Types

type Usage

type Usage struct {
	// OpenebsEventBuilder to build the OpenEBSEvent
	OpenebsEventBuilder *ga4Event.OpenebsEventBuilder

	// GA4 Analytics Client
	AnalyticsClient *ga4Client.MeasurementClient
}

Usage struct represents all information about a usage metric sent to Google Analytics with respect to the application

func New

func New() *Usage

New returns an instance of Usage

func (*Usage) ApplicationBuilder

func (u *Usage) ApplicationBuilder() *Usage

ApplicationBuilder Application builder is used for adding k8s&openebs environment detail for non install events

func (*Usage) CommonBuild

func (u *Usage) CommonBuild(engineName string) *Usage

CommonBuild is a common builder method for Usage struct

func (*Usage) InstallBuilder

func (u *Usage) InstallBuilder(override bool) *Usage

InstallBuilder is a concrete builder for install events

func (*Usage) Send

func (u *Usage) Send()

Send POSTS an event over to the GA4 API

func (*Usage) SetCategory

func (u *Usage) SetCategory(c string) *Usage

SetCategory sets the category of an event

func (*Usage) SetNodeCount added in v0.2.0

func (u *Usage) SetNodeCount(n string) *Usage

SetNodeCount sets the node count for a k8s cluster.

func (*Usage) SetReplicaCount

func (u *Usage) SetReplicaCount(replicaCount string) *Usage

SetReplicaCount sets the number of replicas for a volume.

func (*Usage) SetVolumeCapacity

func (u *Usage) SetVolumeCapacity(volCapG string) *Usage

SetVolumeCapacity sets the size of a volume.

func (*Usage) SetVolumeClaimName

func (u *Usage) SetVolumeClaimName(name string) *Usage

SetVolumeClaimName i.e pvc name

func (*Usage) SetVolumeName

func (u *Usage) SetVolumeName(name string) *Usage

SetVolumeName i.e pv name

type VersionSet

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

VersionSet is a struct which stores (sort of) fixed information about a k8s environment

func NewVersion

func NewVersion() *VersionSet

NewVersion returns a new versionSet struct

Jump to

Keyboard shortcuts

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