telemetry

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 20 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 CreateTelemetryJobWorker

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

Types

type ClusterInformation added in v1.5.0

type ClusterInformation struct {
	Platform  string
	Version   string
	ClusterID string
	NodeCount int
}

func CollectClusterInformation added in v1.5.0

func CollectClusterInformation(ctx context.Context, k8sClient client.Reader) (ClusterInformation, error)

CollectClusterInformation collects information about the cluster.

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
	// SnippetsFiltersDirectives contains the directive-context strings of all applied SnippetsFilters.
	// Both lists are ordered first by count, then by lexicographical order of the context string,
	// then lastly by directive string.
	SnippetsFiltersDirectives []string
	// SnippetsFiltersDirectivesCount contains the count of the directive-context strings, where each count
	// corresponds to the string from SnippetsFiltersDirectives at the same index.
	// Both lists are ordered first by count, then by lexicographical order of the context string,
	// then lastly by directive string.
	SnippetsFiltersDirectivesCount []int64
	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
	// TLSRouteCount is the number of relevant TLSRoutes.
	TLSRouteCount 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
	// GRPCRouteCount is the number of relevant GRPCRoutes.
	GRPCRouteCount int64
	// BackendTLSPolicyCount is the number of relevant BackendTLSPolicies.
	BackendTLSPolicyCount int64
	// GatewayAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies
	// attached at the Gateway level.
	GatewayAttachedClientSettingsPolicyCount int64
	// RouteAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies attached at the Route level.
	RouteAttachedClientSettingsPolicyCount int64
	// ObservabilityPolicyCount is the number of relevant ObservabilityPolicies.
	ObservabilityPolicyCount int64
	// NginxProxyCount is the number of NginxProxies.
	NginxProxyCount int64
	// SnippetsFilterCount is the number of SnippetsFilters.
	SnippetsFilterCount 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

type RouteCounts added in v1.4.0

type RouteCounts struct {
	HTTPRouteCount int64
	GRPCRouteCount int64
	TLSRouteCount  int64
}

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