usage

package
v1.4.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GAclientID is the unique code of OpenEBS project in Google Analytics
	GAclientID string = "UA-127388617-1"

	// InstallEvent event is sent on pod starts
	InstallEvent string = "install"
	// Ping event is sent periodically
	Ping string = "zfs-ping"
	// 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"

	// 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"

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

	// DefaultCASType Event application name constant for volume event
	DefaultCASType string = "zfs-localpv"

	// LocalPVReplicaCount is the constant used by usage to represent
	// replication factor in LocalPV
	LocalPVReplicaCount string = "1"
)

Variables

View Source
var OpenEBSPingPeriod = "OPENEBS_IO_ANALYTICS_PING_INTERVAL"

OpenEBSPingPeriod ping interval of volume io analytics

Functions

func PingCheck

func PingCheck()

PingCheck sends ping events to Google Analytics

Types

type Application

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

Application struct holds details about the Application

type Event

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

Event is a represents usage of OpenEBS Event contains all the query param fields when hits is of type='event' Ref: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ec

type Gclient

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

Gclient struct represents a Google Analytics hit

type Usage

type Usage struct {
	// Embedded Event struct as we are currently only sending hits of type
	// 'event'
	Event

	// https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#an
	// use-case: cstor or jiva volume, or m-apiserver application
	// Embedded field for application
	Application

	// Embedded Gclient struct
	Gclient
}

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

func (u *Usage) Build() *Usage

Build is a 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) NewEvent

func (u *Usage) NewEvent(c, a, l string, v int64) *Usage

NewEvent returns an Event struct with eventCategory, eventAction, eventLabel, eventValue fields

func (*Usage) Send

func (u *Usage) Send()

Send sends a single usage metric to Google Analytics with some compulsory fields defined in Google Analytics API bindings(jpillora/go-ogle-analytics)

func (*Usage) SetAction

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

SetAction sets the action of an event

func (*Usage) SetApplicationID

func (u *Usage) SetApplicationID(appID string) *Usage

SetApplicationID : usecase(OpenEBS/NDM)

func (*Usage) SetApplicationInstallerID

func (u *Usage) SetApplicationInstallerID(appInstallerID string) *Usage

SetApplicationInstallerID : usecase(k8s-version)

func (*Usage) SetApplicationName

func (u *Usage) SetApplicationName(appName string) *Usage

SetApplicationName : usecase(os-type/arch, volume CASType)

func (*Usage) SetApplicationVersion

func (u *Usage) SetApplicationVersion(appVersion string) *Usage

SetApplicationVersion : usecase(project-version)

func (*Usage) SetCampaignName added in v0.8.0

func (u *Usage) SetCampaignName(campaignName string) *Usage

SetCampaignName : set the name of the PVC or will be empty.

func (*Usage) SetCampaignSource

func (u *Usage) SetCampaignSource(campaignSrc string) *Usage

SetCampaignSource : source of openebs installater like: helm or operator etc. This will have to be configured via ENV variable OPENEBS_IO_INSTALLER_TYPE

func (*Usage) SetCategory

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

SetCategory sets the category of an event

func (*Usage) SetClientID

func (u *Usage) SetClientID(userID string) *Usage

SetClientID sets the anonymous user id

func (*Usage) SetDataSource

func (u *Usage) SetDataSource(dataSource string) *Usage

SetDataSource : usage(os-type, kernel)

func (*Usage) SetDocumentTitle

func (u *Usage) SetDocumentTitle(documentTitle string) *Usage

SetDocumentTitle : usecase(anonymous-id)

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

func (u *Usage) SetTrackingID(track string) *Usage

SetTrackingID Sets the GA-code for the project

func (*Usage) SetValue

func (u *Usage) SetValue(v int64) *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) SetVolumeType

func (u *Usage) SetVolumeType(volType, method string) *Usage

SetVolumeType Wrapper for setting the default storage-engine for volume-provision event

type VersionSet added in v0.9.0

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