metadata

package
v0.0.0-...-b2113b7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertMetric

func AssertMetric(metric *ExpectedMetric, series *monitoringpb.TimeSeries) error

func NewIntegrationMetadataValidator

func NewIntegrationMetadataValidator() *validator.Validate

func SliceContains

func SliceContains(slice []string, toFind string) bool

func UnmarshalAndValidate

func UnmarshalAndValidate(data []byte, i interface{}) error

Types

type ConfigurationFields

type ConfigurationFields struct {
	Name        string `yaml:"name" validate:"required"`
	Default     string `yaml:"default"`
	Description string `yaml:"description" validate:"required,excludesall=‘’“”"`
}

type ConfigurationOptions

type ConfigurationOptions struct {
	LogsConfiguration    []*InputConfiguration `yaml:"logs" validate:"required_without=MetricsConfiguration,dive"`
	MetricsConfiguration []*InputConfiguration `yaml:"metrics" validate:"required_without=LogsConfiguration,dive"`
}

type ExpectedLog

type ExpectedLog struct {
	LogName string       `yaml:"log_name" validate:"required"`
	Fields  []*LogFields `yaml:"fields" validate:"required,dive"`
}

type ExpectedMetric

type ExpectedMetric struct {
	// The metric type, for example workload.googleapis.com/apache.current_connections.
	Type string `yaml:"type" validate:"required"`
	// The value type, for example INT64.
	ValueType string `yaml:"value_type" validate:"required,oneof=BOOL INT64 DOUBLE STRING DISTRIBUTION"`
	// The kind, for example GAUGE.
	Kind string `yaml:"kind" validate:"required,oneof=GAUGE DELTA CUMULATIVE"`
	// The monitored resource, for example gce_instance.
	// Currently we only test with gce_instance.
	MonitoredResource string `yaml:"monitored_resource" validate:"required,oneof=gce_instance"`
	// Mapping of expected label keys to value patterns.
	// Patterns are RE2 regular expressions.
	Labels map[string]string `yaml:"labels,omitempty" validate:"omitempty,gt=0"`
	// If Optional is true, the test for this metric will be skipped.
	Optional bool `yaml:"optional,omitempty" validate:"excluded_with=Representative"`
	// Exactly one metric in each expected_metrics.yaml must
	// have Representative set to true. This metric can be used
	// to test that the integration is enabled.
	Representative bool `yaml:"representative,omitempty" validate:"excluded_with=Optional,excluded_with=Platform"`
	// Exclusive metric to a particular kind of platform.
	Platform string `yaml:"platform,omitempty" validate:"excluded_with=Representative,omitempty,oneof=linux windows"`
	// A list of platforms that this metric is not available on.
	// Examples: centos-7,debian-10. Not valid are linux,windows.
	UnavailableOn []string `yaml:"unavailable_on,omitempty" validate:"excluded_with=Representative"`
}

ExpectedMetric encodes a series of assertions about what data we expect to see in the metrics backend.

type ExpectedMetricsContainer

type ExpectedMetricsContainer struct {
	ExpectedMetrics []*ExpectedMetric `yaml:"expected_metrics" validate:"onetrue=Representative,unique=Type,dive"`
}

type GpuPlatform

type GpuPlatform struct {
	Model     string   `yaml:"model" validate:"required"`
	Platforms []string `yaml:"platforms" validate:"required"`
}

type InputConfiguration

type InputConfiguration struct {
	Type   string                 `yaml:"type" validate:"required"`
	Fields []*ConfigurationFields `yaml:"fields" validate:"required,dive"`
}

type IntegrationMetadata

type IntegrationMetadata struct {
	PublicUrl                    string                        `yaml:"public_url"`
	AppUrl                       string                        `yaml:"app_url" validate:"required,url"`
	ShortName                    string                        `yaml:"short_name" validate:"required,excludesall=‘’“”"`
	LongName                     string                        `yaml:"long_name" validate:"required,excludesall=‘’“”"`
	LogoPath                     string                        `yaml:"logo_path"`
	Description                  string                        `yaml:"description" validate:"required,excludesall=‘’“”"`
	ConfigurationOptions         *ConfigurationOptions         `yaml:"configuration_options" validate:"required"`
	ConfigureIntegration         string                        `yaml:"configure_integration"`
	ExpectedLogs                 []*ExpectedLog                `yaml:"expected_logs" validate:"dive"`
	MinimumSupportedAgentVersion *MinimumSupportedAgentVersion `yaml:"minimum_supported_agent_version"`
	SupportedAppVersion          []string                      `yaml:"supported_app_version" validate:"required,unique,min=1"`
	SupportedOperatingSystems    string                        `yaml:"supported_operating_systems" validate:"required,oneof=linux windows linux_and_windows"`
	PlatformsToSkip              []string                      `yaml:"platforms_to_skip"`
	GpuPlatforms                 []GpuPlatform                 `yaml:"gpu_platforms" validate:"dive"`
	RestartAfterInstall          bool                          `yaml:"restart_after_install"`
	Troubleshoot                 string                        `yaml:"troubleshoot" validate:"excludesall=‘’“”"`

	ExpectedMetricsContainer `yaml:",inline"`
}

type LogFields

type LogFields struct {
	Name        string `yaml:"name" validate:"required"`
	ValueRegex  string `yaml:"value_regex"`
	Type        string `yaml:"type" validate:"required"`
	Description string `yaml:"description" validate:"excludesall=‘’“”"`
	Optional    bool   `yaml:"optional,omitempty"`
	// A list of platforms that this field is not available on.
	// Examples: centos-7,debian-10.
	UnavailableOn []string `yaml:"unavailable_on,omitempty"`
}

type MinimumSupportedAgentVersion

type MinimumSupportedAgentVersion struct {
	Logging string `yaml:"logging" validate:"required_without=Metrics"`
	Metrics string `yaml:"metrics" validate:"required_without=Logging"`
}

Jump to

Keyboard shortcuts

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