metrics

package
v1.10.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MeterName = "kyverno"
)
View Source
const (
	// keys
	RequestWebhookKey = attribute.Key("request_webhook")
)

Variables

View Source
var (
	// keyvalues
	WebhookMutating   = RequestWebhookKey.String("MutatingWebhookConfiguration")
	WebhookValidating = RequestWebhookKey.String("ValidatingWebhookConfiguration")
)

Functions

func NewOTLPGRPCConfig added in v1.8.0

func NewOTLPGRPCConfig(
	ctx context.Context,
	endpoint string,
	certs string,
	kubeClient kubernetes.Interface,
	log logr.Logger,
) (metric.MeterProvider, error)

func NewPrometheusConfig added in v1.8.0

func NewPrometheusConfig(
	ctx context.Context,
	log logr.Logger,
) (metric.MeterProvider, *http.ServeMux, error)

func ShutDownController added in v1.8.0

func ShutDownController(ctx context.Context, pusher *sdkmetric.MeterProvider)

Types

type ClientQueryOperation added in v1.8.0

type ClientQueryOperation string
const (
	ClientCreate           ClientQueryOperation = "create"
	ClientGet              ClientQueryOperation = "get"
	ClientList             ClientQueryOperation = "list"
	ClientUpdate           ClientQueryOperation = "update"
	ClientUpdateStatus     ClientQueryOperation = "update_status"
	ClientDelete           ClientQueryOperation = "delete"
	ClientDeleteCollection ClientQueryOperation = "delete_collection"
	ClientWatch            ClientQueryOperation = "watch"
	ClientPatch            ClientQueryOperation = "patch"
)

type ClientType added in v1.8.0

type ClientType string
const (
	DynamicClient      ClientType = "dynamic"
	KubeClient         ClientType = "kubeclient"
	KyvernoClient      ClientType = "kyverno"
	MetadataClient     ClientType = "metadata"
	ApiServerClient    ClientType = "apiserver"
	PolicyReportClient ClientType = "policyreport"
)

type MetricsConfig added in v1.8.0

type MetricsConfig struct {
	Log logr.Logger
	// contains filtered or unexported fields
}

func NewFakeMetricsConfig added in v1.8.0

func NewFakeMetricsConfig() *MetricsConfig

func (*MetricsConfig) Config added in v1.8.0

func (*MetricsConfig) RecordClientQueries added in v1.8.0

func (m *MetricsConfig) RecordClientQueries(ctx context.Context, clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string)

func (*MetricsConfig) RecordPolicyChanges added in v1.8.0

func (m *MetricsConfig) RecordPolicyChanges(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string)

type MetricsConfigManager added in v1.8.0

type MetricsConfigManager interface {
	Config() kconfig.MetricsConfiguration
	RecordPolicyChanges(ctx context.Context, policyValidationMode PolicyValidationMode, policyType PolicyType, policyBackgroundMode PolicyBackgroundMode, policyNamespace string, policyName string, policyChangeType string)
	RecordClientQueries(ctx context.Context, clientQueryOperation ClientQueryOperation, clientType ClientType, resourceKind string, resourceNamespace string)
}

func InitMetrics added in v1.8.0

func InitMetrics(
	ctx context.Context,
	disableMetricsExport bool,
	otel string,
	metricsAddr string,
	otelCollector string,
	metricsConfiguration config.MetricsConfiguration,
	transportCreds string,
	kubeClient kubernetes.Interface,
	logger logr.Logger,
) (MetricsConfigManager, *http.ServeMux, *sdkmetric.MeterProvider, error)

type PolicyBackgroundMode

type PolicyBackgroundMode string
const (
	BackgroundTrue  PolicyBackgroundMode = "true"
	BackgroundFalse PolicyBackgroundMode = "false"
)

func ParsePolicyBackgroundMode

func ParsePolicyBackgroundMode(policy kyvernov1.PolicyInterface) PolicyBackgroundMode

type PolicyType

type PolicyType string
const (
	Cluster    PolicyType = "cluster"
	Namespaced PolicyType = "namespaced"
)

type PolicyValidationMode

type PolicyValidationMode string
const (
	Enforce PolicyValidationMode = "enforce"
	Audit   PolicyValidationMode = "audit"
)

func ParsePolicyValidationMode

func ParsePolicyValidationMode(validationFailureAction kyvernov1.ValidationFailureAction) (PolicyValidationMode, error)

type Recorder added in v1.8.1

type Recorder interface {
	Record(ClientQueryOperation)
	RecordWithContext(context.Context, ClientQueryOperation)
}

func ClusteredClientQueryRecorder added in v1.8.1

func ClusteredClientQueryRecorder(m MetricsConfigManager, kind string, client ClientType) Recorder

func NamespacedClientQueryRecorder added in v1.8.1

func NamespacedClientQueryRecorder(m MetricsConfigManager, ns, kind string, client ClientType) Recorder

type ResourceRequestOperation

type ResourceRequestOperation string
const (
	ResourceCreated   ResourceRequestOperation = "create"
	ResourceUpdated   ResourceRequestOperation = "update"
	ResourceDeleted   ResourceRequestOperation = "delete"
	ResourceConnected ResourceRequestOperation = "connect"
)

func ParseResourceRequestOperation added in v1.7.0

func ParseResourceRequestOperation(requestOperationStr string) (ResourceRequestOperation, error)

type RuleExecutionCause

type RuleExecutionCause string
const (
	AdmissionRequest RuleExecutionCause = "admission_request"
	BackgroundScan   RuleExecutionCause = "background_scan"
)

type RuleResult

type RuleResult string
const (
	Pass  RuleResult = "pass"
	Fail  RuleResult = "fail"
	Warn  RuleResult = "warn"
	Error RuleResult = "error"
	Skip  RuleResult = "skip"
)

type RuleType

type RuleType string
const (
	Validate      RuleType = "validate"
	Mutate        RuleType = "mutate"
	Generate      RuleType = "generate"
	ImageVerify   RuleType = "imageVerify"
	EmptyRuleType RuleType = "-"
)

func ParseRuleType

func ParseRuleType(rule kyvernov1.Rule) RuleType

func ParseRuleTypeFromEngineRuleResponse added in v1.7.0

func ParseRuleTypeFromEngineRuleResponse(rule engineapi.RuleResponse) RuleType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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