telemetry

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package telemetry is responsible for collecting and sending product telemetry data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectClusterID

func CollectClusterID(ctx context.Context, k8sClient client.Reader) (string, error)

CollectClusterID gets the UID of the kube-system namespace.

func CreateTelemetryJobWorker

func CreateTelemetryJobWorker(
	logger logr.Logger,
	exporter Exporter,
	dataCollector DataCollector,
) func(ctx context.Context)

Types

type ConfigurationGetter

type ConfigurationGetter interface {
	GetLatestConfiguration() *dataplane.Configuration
}

ConfigurationGetter gets the latest Configuration.

type Data

type Data struct {
	// ImageSource tells whether the image was built by GitHub or locally (values are 'gha', 'local', or 'unknown')
	ImageSource string
	tel.Data    // embedding is required by the generator.
	// FlagNames contains the command-line flag names.
	FlagNames []string
	// FlagValues contains the values of the command-line flags, where each value corresponds to the flag from FlagNames
	// at the same index.
	// Each value is either 'true' or 'false' for boolean flags and 'default' or 'user-defined' for non-boolean flags.
	FlagValues        []string
	NGFResourceCounts // embedding is required by the generator.
	// NGFReplicaCount is the number of replicas of the NGF Pod.
	NGFReplicaCount int64
}

Data is telemetry data.

func (*Data) Attributes

func (d *Data) Attributes() []attribute.KeyValue

type DataCollector

type DataCollector interface {
	// Collect collects and returns telemetry Data.
	Collect(ctx context.Context) (Data, error)
}

DataCollector collects telemetry data.

type DataCollectorConfig

type DataCollectorConfig struct {
	// K8sClientReader is a Kubernetes API client Reader.
	K8sClientReader client.Reader
	// GraphGetter allows us to get the Graph.
	GraphGetter GraphGetter
	// ConfigurationGetter allows us to get the Configuration.
	ConfigurationGetter ConfigurationGetter
	// Version is the NGF version.
	Version string
	// PodNSName is the NamespacedName of the NGF Pod.
	PodNSName types.NamespacedName
	// ImageSource is the source of the NGF image.
	ImageSource string
	// Flags contains the command-line NGF flag keys and values.
	Flags config.Flags
}

DataCollectorConfig holds configuration parameters for DataCollectorImpl.

type DataCollectorImpl

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

DataCollectorImpl is am implementation of DataCollector.

func NewDataCollectorImpl

func NewDataCollectorImpl(
	cfg DataCollectorConfig,
) *DataCollectorImpl

NewDataCollectorImpl creates a new DataCollectorImpl for a telemetry Job.

func (DataCollectorImpl) Collect

func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error)

Collect collects and returns telemetry Data.

type Exporter

type Exporter interface {
	Export(ctx context.Context, data tel.Exportable) error
}

Exporter exports telemetry data to some destination.

type GraphGetter

type GraphGetter interface {
	GetLatestGraph() *graph.Graph
}

GraphGetter gets the latest Graph.

type LoggingExporter

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

LoggingExporter logs telemetry data.

func NewLoggingExporter

func NewLoggingExporter(logger logr.Logger) *LoggingExporter

NewLoggingExporter creates a new LoggingExporter.

func (*LoggingExporter) Export

func (e *LoggingExporter) Export(_ context.Context, data tel.Exportable) error

Export logs the provided telemetry data.

type NGFResourceCounts

type NGFResourceCounts struct {
	// GatewayCount is the number of relevant Gateways.
	GatewayCount int64
	// GatewayClassCount is the number of relevant GatewayClasses.
	GatewayClassCount int64
	// HTTPRouteCount is the number of relevant HTTPRoutes.
	HTTPRouteCount int64
	// SecretCount is the number of relevant Secrets.
	SecretCount int64
	// ServiceCount is the number of relevant Services.
	ServiceCount int64
	// EndpointCount include the total count of Endpoints(IP:port) across all referenced services.
	EndpointCount int64
}

NGFResourceCounts stores the counts of all relevant resources that NGF processes and generates configuration from.

func (*NGFResourceCounts) Attributes

func (d *NGFResourceCounts) Attributes() []attribute.KeyValue

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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