Documentation
¶
Index ¶
- Variables
- type Attribute
- type AttributeSchema
- type HistoricalAttribute
- type HistoricalRelation
- type HistoricalResource
- type HistoricalState
- type Relation
- type RelationChangedRecord
- type RelationConditionSchema
- type RelationName
- type RelationSchema
- type Resource
- type ResourceMatcher
- type ResourceQuery
- type ResourceQueryRange
- type ResourceQueryRangeResponse
- type ResourceQueryResponse
- type ResourceSchema
- type ResourceSelector
- type State
- type StateQuery
- type StateQueryRange
- type StateQueryRangeResponse
- type StateQueryResponse
- type StateRecord
- type StateSelector
- type StateValue
- type StringRecord
- type TypeName
Constants ¶
This section is empty.
Variables ¶
var TypeNameRE = regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9_]*$")
SchemaNameRE is a regular expression matching valid label names. Note that the IsValid method of SchemaName performs the same check but faster than a match with this regular expression.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
// The name of an attribute, must be unique for the resource level and cannot be null or empty.
Name promModel.LabelName
StringRecord `yaml:",inline" json:",inline"`
}
Attribute is a Key-value struct for describe a property of the resource, and can be used for resources selection.
type AttributeSchema ¶
type HistoricalAttribute ¶
type HistoricalAttribute struct {
Name promModel.LabelName `json:",omitempty"`
Records []*StringRecord `json:",omitempty"`
}
type HistoricalRelation ¶
type HistoricalRelation struct {
RelationName `json:",inline" yaml:",inline"`
SourceUrn, TargetUrn string
Records []*RelationChangedRecord
}
type HistoricalResource ¶
type HistoricalResource struct {
Type TypeName `json:",omitempty"` // Related with resource's type, and the type connected with a specification.
Urn string `json:",omitempty"` // The Unique resource name of this resources, must be unique with whole scope.
ObserveTypes []TypeName `json:",omitempty"` // Additional type of resource, used for observability.
Attributes []*HistoricalAttribute `json:",omitempty"` // Attributes of the resource, may be a required or optional.
State *HistoricalState `json:",omitempty"` // State of the resource, name should be unique.
}
type HistoricalState ¶
type HistoricalState struct {
Name promModel.LabelName
Records []*StateRecord
}
type Relation ¶
type Relation struct {
RelationName `json:",inline" yaml:",inline"`
SourceUrn, TargetUrn string
RelationChangedRecord `json:",inline" yaml:",inline"`
}
Relation is the data represent dependency of resources
type RelationChangedRecord ¶
type RelationConditionSchema ¶
type RelationName ¶
type RelationName struct {
Name, Source, Target TypeName
}
type RelationSchema ¶
type RelationSchema struct {
Name promModel.LabelName
Brief string
Source, Target ResourceSchema
Conditions []*RelationConditionSchema
}
type Resource ¶
type Resource struct {
Type TypeName `json:",omitempty"` // Related with resource's type, and the type connected with a specification.
Urn string `json:",omitempty"` // The Unique resource name of this resources, must be unique with whole scope.
ObserveTypes []TypeName `json:",omitempty"` // Additional type of resource, used for observability.
Attributes []*Attribute `json:",omitempty"` // Attributes of the resource, may be a required or optional.
States *State `json:",omitempty"` // State of the resource, name should be unique.
}
Resource is an immutable representation of the entity producing telemetry.
type ResourceMatcher ¶
type ResourceQuery ¶
type ResourceQuery struct {
Time promModel.Time
Selectors []*ResourceSelector `json:",omitempty" yaml:",omitempty"`
}
ResourceQuery is the instant query Params
type ResourceQueryRange ¶
type ResourceQueryRange struct {
Start promModel.Time
End promModel.Time
Selectors []*ResourceSelector `json:",omitempty" yaml:",omitempty"`
}
type ResourceQueryRangeResponse ¶
type ResourceQueryRangeResponse struct {
Resources map[TypeName][]HistoricalResource `json:",omitempty" yaml:",omitempty"`
Relations map[TypeName][]HistoricalRelation `json:",omitempty" yaml:",omitempty"`
}
type ResourceQueryResponse ¶
type ResourceSchema ¶
type ResourceSelector ¶
type ResourceSelector struct {
// SourceMatcher Start point of resource searching, required.
SourceMatcher *ResourceMatcher `json:",omitempty" yaml:",omitempty"`
// TargetMatcher Endpoint of resource searching, required.
TargetMatcher *ResourceMatcher `json:",omitempty" yaml:",omitempty"`
// ShowState return the resource with global state.
ShowState bool
// Relations return more resources that match the relation of Matcher, optional.
Relations []*RelationName `json:",omitempty" yaml:",omitempty"`
}
type State ¶
type State struct {
Name promModel.LabelName // The name of the state, must be unique in the resource level and cannot be null or empty.
StateRecord `json:",inline" yaml:",inline"`
}
State is a Key-value struct for describe a status of the resource in some aspect. The value is enum value.
type StateQuery ¶
type StateQuery struct {
Time promModel.Time
Selectors []*StateSelector
}
StateQuery is the instant query Params
type StateQueryRange ¶
type StateQueryRangeResponse ¶
type StateQueryRangeResponse struct {
Content map[string][]*HistoricalState
}
type StateQueryResponse ¶
type StateRecord ¶
type StateRecord struct {
Since promModel.Time `json:",omitempty"` // The time of state value change to.
EndUp promModel.Time `json:",omitempty"` // The time of state value change to.
Value StateValue // The value of the state, must be match StateValue.
}
type StateSelector ¶
type StateSelector struct {
// Matcher Start point of resource searching, required.
Matcher ResourceMatcher
// States selector of stateName
States labels.Matcher
}
type StateValue ¶
type StateValue int
const ( NORMAL StateValue = iota << 2 INFO WARN ERROR CRITICAL )
type StringRecord ¶
type TypeName ¶
type TypeName string
A TypeName is a key for a Resource Schema. It has a value associated therewith.
func (TypeName) IsValid ¶
IsValid is true iff the label name matches the pattern of SchemaNameRE. This method, however, does not use SchemaNameRE for the check but a much faster hardcoded implementation.
func (*TypeName) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*TypeName) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.