Documentation
¶
Overview ¶
Package telemetry collects the CLI metrics and sends the telemetry data to supercollider
Index ¶
- Constants
- Variables
- func AcquireTanzuMetricDBLock() error
- func LogError(err error, msg string, kvs ...interface{})
- func LogWarning(msg string, kvs ...interface{})
- func ReleaseTanzuMetricDBLock()
- func TraverseFlagNames(args []string) []string
- type MetricsDB
- type MetricsHandler
- type OperationMetricsPayload
- type PostRunMetrics
Constants ¶
View Source
const ( LocalTanzuCLIMetricsDBFileLock = ".cli_metrics_db.lock" // DefaultMetricsDBLockTimeout is the default time waiting on the filelock DefaultMetricsDBLockTimeout = 3 * time.Second )
View Source
const ( // SQliteDBFileName is the name of the DB file that has CLI metrics SQliteDBFileName = "cli_metrics.db" // TanzuCLITelemetryMaxRowCount Max metric instances to be accumulated before pausing the collection TanzuCLITelemetryMaxRowCount = 10000 )
Variables ¶
View Source
var ( // CreateTablesSchema defines the database schema to create sqlite database CreateTablesSchema = strings.TrimSpace(createTablesSchema) )
Functions ¶
func AcquireTanzuMetricDBLock ¶
func AcquireTanzuMetricDBLock() error
AcquireTanzuMetricDBLock tries to acquire lock to update tanzu cli metrics DB file with timeout
func LogWarning ¶
func LogWarning(msg string, kvs ...interface{})
func ReleaseTanzuMetricDBLock ¶
func ReleaseTanzuMetricDBLock()
ReleaseTanzuMetricDBLock releases the lock if the cliMetricDBLock was acquired
func TraverseFlagNames ¶
Types ¶
type MetricsDB ¶
type MetricsDB interface {
// CreateSchema creates table schemas to the provided database.
// returns error if table creation fails for any reason
CreateSchema() error
// SaveOperationMetric inserts CLI operation metrics collected into database
SaveOperationMetric(*OperationMetricsPayload) error
// GetRowCount gets metrics table current row count
GetRowCount() (int, error)
// ClearMetricData clears all the CLI operation metrics collected in the database
ClearMetricData() error
}
type MetricsHandler ¶
type MetricsHandler interface {
// SetInstalledPlugins adds the installed plugins to the handler used to retrieve
// the plugin information
SetInstalledPlugins(plugins []cli.PluginInfo)
// UpdateCmdPreRunMetrics updates the metrics collected before running the command
UpdateCmdPreRunMetrics(cmd *cobra.Command, args []string) error
// UpdateCmdPostRunMetrics updates the metrics collected after command execution is completed
UpdateCmdPostRunMetrics(metrics *PostRunMetrics) error
// SaveMetrics saves the metrics to the metrics store/DB
SaveMetrics() error
// SendMetrics sends the metrics to the destination(metrics data lake)
SendMetrics(ctx context.Context, timeoutInSecs int) error
}
func Client ¶
func Client() MetricsHandler
type OperationMetricsPayload ¶
type PostRunMetrics ¶
type PostRunMetrics struct {
ExitCode int
}
Click to show internal directories.
Click to hide internal directories.