usage

package
v1.12.1-RC1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Copyright 2018 The OpenEBS Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018 The OpenEBS Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018 The OpenEBS Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018 The OpenEBS Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

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

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

	// Event labels
	RunningStatus      string = "running"
	EventLabelNode     string = "nodes"
	EventLabelCapacity string = "capacity"

	// Event action
	Replica             string = "replica:"
	DefaultReplicaCount string = "replica:3"

	// Event application name constant for volume event
	DefaultCASType string = "jiva"

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

Variables

View Source
var OpenEBSPingPeriod menv.ENVKey = "OPENEBS_IO_ANALYTICS_PING_INTERVAL"

Functions

func NewVersion

func NewVersion() *versionSet

NewVersion returns a new versionSet struct

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

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 v1.11.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

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

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

Jump to

Keyboard shortcuts

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