usage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// MeasurementId is the unique code of the OpenEBS property in Google Analytics.
	MeasurementId string = "G-TZGP46618W"
	// ApiSecret is the measurement protocol api_secret.
	ApiSecret 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"
)

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)

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) SetAction

func (u *Usage) SetAction(a string) *Usage

SetAction sets the action of an event

func (*Usage) SetCategory

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

SetCategory sets the category of an event

func (*Usage) SetLabel

func (u *Usage) SetLabel(l string) *Usage

SetLabel sets the label for an event

func (*Usage) SetReplicaCount

func (u *Usage) SetReplicaCount(count, method string) *Usage

SetReplicaCount Wrapper for setting replica count for volume events NOTE: This doesn't get the replica count in a volume de-provision event. TODO: Pick the current value of replica-count from the CAS-engine

func (*Usage) SetValue

func (u *Usage) SetValue(v string) *Usage

SetValue sets the value for an event's label

func (*Usage) SetVolumeCapacity

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

SetVolumeCapacity sets the storage capacity of the volume for a volume event

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