package metrics

import "github.com/oslokommune/okctl/pkg/metrics"

Package metrics exposes the main metrics api

Index

Constants

const (

	// ActionScaffoldCluster represents running the command `okctl scaffold cluster`
	ActionScaffoldCluster = commandexecution.ActionScaffoldCluster
	// ActionApplyCluster represents running the command `okctl apply cluster`
	ActionApplyCluster = commandexecution.ActionApplyCluster
	// ActionDeleteCluster represents running the command `okctl delete cluster`
	ActionDeleteCluster = commandexecution.ActionDeleteCluster

	// ActionScaffoldApplication represents running the command `okctl scaffold application`
	ActionScaffoldApplication = commandexecution.ActionScaffoldApplication
	// ActionApplyApplication represents running the command `okctl apply application`
	ActionApplyApplication = commandexecution.ActionApplyApplication
	// ActionDeleteApplication represents running the command `okctl delete application`
	ActionDeleteApplication = commandexecution.ActionDeleteApplication

	// ActionForwardPostgres represents running the command `okctl forward postgres`
	ActionForwardPostgres = commandexecution.ActionForwardPostgres

	// ActionShowCredentials represents running the command `okctl show credentials`
	ActionShowCredentials = commandexecution.ActionShowCredentials
	// ActionUpgrade represents running the command `okctl upgrade`
	ActionUpgrade = commandexecution.ActionUpgrade
	// ActionVenv represents running the command `okctl venv`
	ActionVenv = commandexecution.ActionVenv
	// ActionVersion represents running the command `okctl version`
	ActionVersion = commandexecution.ActionVersion

	// ActionMaintenanceStateAcquireLock represents running the command `okctl maintenance state-acquire-lock
	ActionMaintenanceStateAcquireLock = commandexecution.ActionMaintenanceStateAcquireLock
	// ActionMaintenanceStateReleaseLock represents running the command `okctl maintenance state-release-lock
	ActionMaintenanceStateReleaseLock = commandexecution.ActionMaintenanceStateReleaseLock
	// ActionMaintenanceStateDownload represents running the command `okctl maintenance state-download
	ActionMaintenanceStateDownload = commandexecution.ActionMaintenanceStateDownload
	// ActionMaintenanceStateUpload represents running the command `okctl maintenance state-upload
	ActionMaintenanceStateUpload = commandexecution.ActionMaintenanceStateUpload
)
const (
	// LabelPhaseKey represents the key for the phase labels
	LabelPhaseKey = commandexecution.LabelPhaseKey
	// LabelPhaseStart represents the start of a command
	LabelPhaseStart = commandexecution.LabelPhaseStart
	// LabelPhaseEnd represents the end of the command
	LabelPhaseEnd = commandexecution.LabelPhaseEnd
)
const CategoryCommandExecution = commandexecution.Category

CategoryCommandExecution represents the context of running commands

Functions

func Publish

func Publish(event Event)

Publish sends a metric event to the okctl-metrics-service This function wraps the main publish function and prints out a warning if there is an error. It seems drastic to crash the program due to a metrics fault

func SetAPIURL

func SetAPIURL(newAPIURL string) error

SetAPIURL configures the API URL for the Publish POST request

func SetMetricsOut

func SetMetricsOut(writer io.Writer)

SetMetricsOut configures where to write error messages related to metrics publishing

func SetUserAgent

func SetUserAgent(newUserAgent string)

SetUserAgent configures the user agent of the Publish POST request

Types

type Action

type Action = types.Action

Action defines the action of an event

type Category

type Category = types.Category

Category defines the category of an event

type Event

type Event = metrics.Event

Event shadows okctl metrics service Event type

Source Files

api.go command_execution_types.go helpers.go types.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
10 packages
Last checked
18 hours ago

Tools for package owners.