pkg

package
v0.38.93 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ComponentType = "component"

Variables

This section is empty.

Functions

func CleanupFilename added in v0.38.85

func CleanupFilename(fileName string) string

func GetClusterName added in v0.11.3

func GetClusterName(config *rest.Config) string

func GetKubeconfig

func GetKubeconfig() string

func NewK8sClient

func NewK8sClient() (*kubernetes.Clientset, error)

func NewKommonsClient added in v0.17.0

func NewKommonsClient() (*kommons.Client, error)

func ParseConfig

func ParseConfig(configfile string, datafile string) ([]v1.Canary, error)

ParseConfig : Read config file

func ParseSystems added in v0.38.85

func ParseSystems(configFile, datafile string) ([]v1.System, error)

Types

type Canary added in v0.38.85

type Canary struct {
	ID        uuid.UUID `gorm:"default:generate_ulid()"`
	Spec      types.JSON
	Labels    types.JSONStringMap
	Source    string
	Name      string
	Namespace string
	Schedule  string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt time.Time
}

func CanaryFromV1 added in v0.38.85

func CanaryFromV1(canary v1.Canary) Canary

type Check

type Check struct {
	ID          string              `json:"id" gorm:"default:generate_ulid()"`
	CanaryID    string              `json:"canary_id"`
	Spec        types.JSON          `json:"-"`
	Type        string              `json:"type"`
	Name        string              `json:"name"`
	CanaryName  string              `json:"canary_name" gorm:"-"`
	Namespace   string              `json:"namespace"  gorm:"-"`
	Labels      types.JSONStringMap `json:"labels" gorm:"type:jsonstringmap;<-:false"`
	Description string              `json:"description,omitempty"`
	Uptime      Uptime              `json:"uptime"  gorm:"-"`
	Latency     Latency             `json:"latency"  gorm:"-"`
	Statuses    []CheckStatus       `json:"checkStatuses"  gorm:"-"`
	Owner       string              `json:"owner,omitempty"`
	Severity    string              `json:"severity,omitempty"`
	Icon        string              `json:"icon,omitempty"`
	DisplayType string              `json:"displayType,omitempty"  gorm:"-"`
	LastRuntime *time.Time          `json:"lastRuntime,omitempty"`
	NextRuntime *time.Time          `json:"nextRuntime,omitempty"`
	UpdatedAt   time.Time           `json:"updatedAt,omitempty"`
	CreatedAt   time.Time           `json:"createdAt,omitempty"`
	Canary      *v1.Canary          `json:"-" gorm:"-"`
}

func FromV1 added in v0.33.1

func FromV1(canary v1.Canary, check external.Check, statuses ...CheckStatus) Check

func (Check) GetDescription

func (c Check) GetDescription() string

func (Check) GetID added in v0.38.48

func (c Check) GetID() string

func (Check) GetName added in v0.16.0

func (c Check) GetName() string

func (Check) ToString added in v0.11.0

func (c Check) ToString() string

type CheckResult

type CheckResult struct {
	Start       time.Time
	Pass        bool
	Invalid     bool
	Detail      interface{}
	Data        map[string]interface{}
	Duration    int64
	Description string
	DisplayType string
	Message     string
	Error       string
	Metrics     []Metric
	// Check is the configuration
	Check  external.Check
	Canary v1.Canary
}

func Fail added in v0.32.1

func Fail(check external.Check, canary v1.Canary) *CheckResult

func Success added in v0.32.1

func Success(check external.Check, canary v1.Canary) *CheckResult

func (*CheckResult) AddData added in v0.38.4

func (result *CheckResult) AddData(data map[string]interface{}) *CheckResult

func (*CheckResult) AddDetails added in v0.38.0

func (result *CheckResult) AddDetails(detail interface{}) *CheckResult

func (*CheckResult) AddMetric added in v0.38.4

func (result *CheckResult) AddMetric(metric Metric) *CheckResult

func (*CheckResult) ErrorMessage added in v0.32.1

func (result *CheckResult) ErrorMessage(err error) *CheckResult

func (*CheckResult) Failf added in v0.38.4

func (result *CheckResult) Failf(message string, args ...interface{}) *CheckResult

func (CheckResult) GetDescription added in v0.11.4

func (result CheckResult) GetDescription() string

func (*CheckResult) GetDuration added in v0.38.19

func (result *CheckResult) GetDuration() int64

func (*CheckResult) ResultDescription added in v0.32.1

func (result *CheckResult) ResultDescription(description string) *CheckResult

func (*CheckResult) ResultMessage added in v0.32.1

func (result *CheckResult) ResultMessage(message string, args ...interface{}) *CheckResult

func (*CheckResult) StartTime added in v0.32.1

func (result *CheckResult) StartTime(start time.Time) *CheckResult

func (CheckResult) String

func (result CheckResult) String() string

func (*CheckResult) TextResults added in v0.32.1

func (result *CheckResult) TextResults(textResults bool) *CheckResult

func (*CheckResult) ToSlice added in v0.38.85

func (result *CheckResult) ToSlice() Results

type CheckStatus added in v0.11.0

type CheckStatus struct {
	Status   bool        `json:"status"`
	Invalid  bool        `json:"invalid,omitempty"`
	Time     string      `json:"time"`
	Duration int         `json:"duration"`
	Message  string      `json:"message,omitempty"`
	Error    string      `json:"error,omitempty"`
	Detail   interface{} `json:"-"`
}

func FromResult added in v0.36.0

func FromResult(result CheckResult) CheckStatus

func (CheckStatus) GetTime added in v0.38.70

func (s CheckStatus) GetTime() (time.Time, error)

type Checker

type Checker interface {
	CheckArgs(args map[string]interface{}) *CheckResult
}

type Checks added in v0.11.0

type Checks []*Check

func (Checks) Find added in v0.38.70

func (c Checks) Find(key string) *Check

func (Checks) Len added in v0.11.0

func (c Checks) Len() int

func (Checks) Less added in v0.11.0

func (c Checks) Less(i, j int) bool

func (Checks) Swap added in v0.11.0

func (c Checks) Swap(i, j int)

type Component added in v0.38.85

type Component struct {
	Name         string            `json:"name,omitempty"`
	Id           string            `json:"id,omitempty"` //nolint
	Text         string            `json:"text,omitempty"`
	TopologyType string            `json:"topologyType,omitempty"`
	Namespace    string            `json:"namespace,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	Tooltip      string            `json:"tooltip,omitempty"`
	Icon         string            `json:"icon,omitempty"`
	Owner        string            `json:"owner,omitempty"`
	Status       string            `json:"status,omitempty"`
	StatusReason string            `json:"statusReason,omitempty"`
	// The type of component, e.g. service, API, website, library, database, etc.
	Type    string     `json:"type,omitempty"`
	Summary v1.Summary `json:"summary,omitempty"`
	// The lifecycle state of the component e.g. production, staging, dev, etc.
	Lifecycle     string             `json:"lifecycle,omitempty"`
	Relationships []RelationshipSpec `json:"relationships,omitempty"`
	Properties    Properties         `json:"properties,omitempty"`
	Components    Components         `json:"components,omitempty"`
	ParentId      string             `json:"parent_id,omitempty"` //nolint
	CreatedAt     string             `json:"created_at,omitempty"`
	UpdatedAt     string             `json:"updated_at,omitempty"`
	ExternalId    string             `json:"external_id,omitempty"` //nolint
}

func NewComponent added in v0.38.85

func NewComponent(c v1.ComponentSpec) *Component

func (Component) Clone added in v0.38.85

func (component Component) Clone() Component

func (Component) GetAsEnvironment added in v0.38.85

func (component Component) GetAsEnvironment() map[string]interface{}

func (Component) GetID added in v0.38.85

func (component Component) GetID() string

func (Component) IsHealthy added in v0.38.85

func (component Component) IsHealthy() bool

func (Component) String added in v0.38.85

func (component Component) String() string

func (Component) Summarize added in v0.38.85

func (component Component) Summarize() v1.Summary

func (*Component) UnmarshalJSON added in v0.38.85

func (component *Component) UnmarshalJSON(b []byte) error

type ComponentPropertyStatus added in v0.38.85

type ComponentPropertyStatus string
var (
	ComponentPropertyStatusHealthy   ComponentPropertyStatus = "healthy"
	ComponentPropertyStatusUnhealthy ComponentPropertyStatus = "unhealthy"
	ComponentPropertyStatusWarning   ComponentPropertyStatus = "warning"
	ComponentPropertyStatusError     ComponentPropertyStatus = "error"
	ComponentPropertyStatusInfo      ComponentPropertyStatus = "info"
)

type ComponentStatus added in v0.38.85

type ComponentStatus struct {
	Status ComponentPropertyStatus `json:"status,omitempty"`
}

type Components added in v0.38.85

type Components []*Component

func (Components) Debug added in v0.38.85

func (components Components) Debug(prefix string) string

func (Components) Find added in v0.38.85

func (components Components) Find(name string) *Component

func (Components) FindByID added in v0.38.85

func (components Components) FindByID(id string) *Component

func (Components) GetIds added in v0.38.85

func (components Components) GetIds() []string

func (Components) Summarize added in v0.38.85

func (components Components) Summarize() v1.Summary

func (*Components) UnmarshalJSON added in v0.38.85

func (components *Components) UnmarshalJSON(b []byte) error

type Endpoint

type Endpoint struct {
	String string
}

func (Endpoint) GetEndpoint

func (e Endpoint) GetEndpoint() string

type GenericCheck added in v0.10.0

type GenericCheck struct {
	v1.Description `yaml:",inline" json:",inline"`
	Type           string
	Endpoint       string
}

func (GenericCheck) GetEndpoint added in v0.38.70

func (generic GenericCheck) GetEndpoint() string

func (GenericCheck) GetType added in v0.38.70

func (generic GenericCheck) GetType() string

type JSONTime added in v0.11.0

type JSONTime time.Time

func (JSONTime) MarshalJSON added in v0.11.0

func (t JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) UnmarshalJSON added in v0.11.0

func (t *JSONTime) UnmarshalJSON(b []byte) error

type Latency added in v0.37.0

type Latency struct {
	Percentile99 float64 `json:"p99,omitempty" db:"p99"`
	Percentile97 float64 `json:"p97,omitempty" db:"p97"`
	Percentile95 float64 `json:"p95,omitempty" db:"p95"`
	Rolling1H    float64 `json:"rolling1h"`
}

func (Latency) String added in v0.37.0

func (l Latency) String() string
type Link struct {
	// e.g. documentation, support, playbook
	Type string `json:"type,omitempty"`
	URL  string `json:"url,omitempty"`
	Text `json:",inline"`
}

type Metric

type Metric struct {
	Name   string
	Type   MetricType
	Labels map[string]string
	Value  float64
}

func (Metric) String

func (m Metric) String() string

type MetricType

type MetricType string

type Object added in v0.38.85

type Object struct {
	Name      string            `json:"name,omitempty"`
	Namespace string            `json:"namespace,omitempty"`
	Labels    map[string]string `json:"labels,omitempty"`
}

type Owner added in v0.38.85

type Owner string

type Properties added in v0.38.85

type Properties []*Property

func (Properties) AsJSON added in v0.38.85

func (p Properties) AsJSON() []byte

func (Properties) AsMap added in v0.38.85

func (p Properties) AsMap() map[string]interface{}

func (Properties) Find added in v0.38.85

func (p Properties) Find(name string) *Property

type Property added in v0.38.85

type Property struct {
	Label   string `json:"label,omitempty"`
	Name    string `json:"name,omitempty"`
	Tooltip string `json:"tooltip,omitempty"`
	Icon    string `json:"icon,omitempty"`
	Type    string `json:"type,omitempty"`
	Color   string `json:"color,omitempty"`

	Headline bool `json:"headline,omitempty"`

	// Either text or value is required, but not both.
	Text  string `json:"text,omitempty"`
	Value int64  `json:"value,omitempty"`

	// e.g. milliseconds, bytes, millicores, epoch etc.
	Unit string `json:"unit,omitempty"`
	Max  *int64 `json:"max,omitempty"`
	Min  int64  `json:"min,omitempty"`

	Status         string    `json:"status,omitempty"`
	LastTransition string    `json:"lastTransition,omitempty"`
	Links          []v1.Link `json:"links,omitempty"`
}

Property is a realized v1.Property without the lookup definition

func NewProperty added in v0.38.85

func NewProperty(property v1.Property) *Property

func (Property) GetValue added in v0.38.85

func (p Property) GetValue() interface{}

func (*Property) Merge added in v0.38.85

func (p *Property) Merge(other *Property)

func (*Property) String added in v0.38.85

func (p *Property) String() string

type RelationshipSpec added in v0.38.85

type RelationshipSpec struct {
	// The type of relationship, e.g. dependsOn, subcomponentOf, providesApis, consumesApis
	Type string `json:"type,omitempty"`
	Ref  string `json:"ref,omitempty"`
}

type Results added in v0.38.75

type Results []*CheckResult

func SetupError added in v0.38.25

func SetupError(canary v1.Canary, err error) Results

func (Results) ErrorMessage added in v0.38.75

func (r Results) ErrorMessage(err error) Results

func (Results) Failf added in v0.38.75

func (r Results) Failf(msg string, args ...interface{}) Results

type System added in v0.38.85

type System struct {
	Object       `yaml:",inline"`
	Id           string            `json:"id"` //nolint
	Tooltip      string            `json:"tooltip,omitempty"`
	Icon         string            `json:"icon,omitempty"`
	Text         string            `json:"text,omitempty"`
	Label        string            `json:"label,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	Owner        string            `json:"owner,omitempty"`
	Components   Components        `json:"components,omitempty"`
	Properties   Properties        `json:"properties,omitempty"`
	Summary      v1.Summary        `json:"summary,omitempty"`
	Status       string            `json:"status,omitempty"`
	Type         string            `json:"type,omitempty"`
	CreatedAt    string            `json:"created_at,omitempty"`
	UpdatedAt    string            `json:"updated_at,omitempty"`
	ExternalId   string            `json:"external_id,omitempty"` //nolint
	TopologyType string            `json:"topologyType,omitempty"`
}

func (System) GetAsEnvironment added in v0.38.85

func (s System) GetAsEnvironment() map[string]interface{}

type SystemResult added in v0.38.85

type SystemResult struct{}

type Text added in v0.38.85

type Text struct {
	Tooltip string `json:"tooltip,omitempty"`
	Icon    string `json:"icon,omitempty"`
	Text    string `json:"text,omitempty"`
	Label   string `json:"label,omitempty"`
}

type Timeseries added in v0.38.70

type Timeseries struct {
	Key      string `json:"key,omitempty"`
	Time     string `json:"time,omitempty"`
	Status   bool   `json:"status,omitempty"`
	Message  string `json:"message,omitempty"`
	Error    string `json:"error,omitempty"`
	Duration int    `json:"duration"`
	// Count is the number of times the check has been run in the specified time window
	Count int `json:"count,omitempty"`
}

type TransformedCheckResult added in v0.38.70

type TransformedCheckResult struct {
	Start       time.Time              `json:"start,omitempty"`
	Pass        bool                   `json:"pass,omitempty"`
	Invalid     bool                   `json:"invalid,omitempty"`
	Detail      interface{}            `json:"detail,omitempty"`
	Data        map[string]interface{} `json:"data,omitempty"`
	Duration    int64                  `json:"duration,omitempty"`
	Description string                 `json:"description,omitempty"`
	DisplayType string                 `json:"displayType,omitempty"`
	Message     string                 `json:"message,omitempty"`
	Error       string                 `json:"error,omitempty"`
	Name        string                 `json:"name,omitempty"`
	Labels      map[string]string      `json:"labels,omitempty"`
	Namespace   string                 `json:"namespace,omitempty"`
	Icon        string                 `json:"icon,omitempty"`
	Type        string                 `json:"type,omitempty"`
	Endpoint    string                 `json:"endpoint,omitempty"`
}

func (TransformedCheckResult) GetDescription added in v0.38.70

func (t TransformedCheckResult) GetDescription() string

func (TransformedCheckResult) ToCheckResult added in v0.38.70

func (t TransformedCheckResult) ToCheckResult() CheckResult

type URL

type URL struct {
	IP       string
	Port     int
	Host     string
	Scheme   string
	Path     string
	Username string
	Password string
	Method   string
	Headers  map[string]string
	Body     string
}

URL information

type Uptime added in v0.37.0

type Uptime struct {
	Passed int     `json:"passed"`
	Failed int     `json:"failed"`
	P100   float64 `json:"p100,omitempty"`
}

func (Uptime) String added in v0.37.0

func (u Uptime) String() string

Directories

Path Synopsis
clients
aws
gcp
db
types
nolint
nolint

Jump to

Keyboard shortcuts

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