Documentation
¶
Index ¶
- Constants
- func IsValid(labelName string) bool
- func IsoTime(t time.Time) string
- func NewSimpleMacroMapper(op string) string
- func ParseDuration(durationStr string) (string, error)
- func ParsePromDuration(s string) (string, error)
- func RetrieveToken(req *http.Request) string
- type AddValuePayload
- type AggregatePayload
- type BinaryExprPayload
- type BucketizePayload
- type Context
- type Duration
- type FetchPayload
- type FillValuePayload
- type FindPayload
- type FunctionPayload
- type GeoTimeSeries
- type HTTPWarp10Server
- func (server *HTTPWarp10Server) Delete(token string, query string) error
- func (server *HTTPWarp10Server) Find(token string, selector string) (*http.Response, error)
- func (server *HTTPWarp10Server) FindGTS(token string, selector string) (*QueryResult, error)
- func (server *HTTPWarp10Server) Query(body string, txn string) (*http.Response, error)
- func (server *HTTPWarp10Server) QueryGTS(body, txn string) (*QueryResult, error)
- func (server *HTTPWarp10Server) QueryGTSs(body, txn string) ([][]GeoTimeSeries, error)
- type Interval
- type MapperPayload
- type Node
- func (n *Node) InternalToWarpScript(query string) string
- func (n *Node) PrintNode(level int)
- func (n *Node) ToWarpScript(token string, query string, step string) string
- func (n *Node) ToWarpScriptWithTime(token string, query string, step string, start Time, end Time) string
- func (n *Node) Write(b *bytes.Buffer)
- type NumberLiteralPayload
- type QueryResult
- type ReducerPayload
- type StorePayload
- type Time
- func (t Time) Add(d time.Duration) Time
- func (t Time) After(o Time) bool
- func (t Time) Before(o Time) bool
- func (t Time) Equal(o Time) bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) String() string
- func (t Time) Sub(o Time) time.Duration
- func (t Time) Time() time.Time
- func (t Time) Unix() int64
- func (t Time) UnixNano() int64
- func (t *Time) UnmarshalJSON(b []byte) error
- type UnaryExprPayload
- type Warp10Server
- type WarpScriptPayload
Constants ¶
const ( // Earliest is the earliest Time representable. Handy for // initializing a high watermark. Earliest = model.Time(math.MinInt64) // Latest is the latest Time representable. Handy for initializing // a low watermark. Latest = model.Time(math.MaxInt64) )
Most of this code is taken from original time.go in Prometheus repo https://github.com/prometheus/common/blob/master/model/time.go
const ShouldRemoveNameLabel = "SHOULD_REMOVE_NAME_LABEL"
ShouldRemoveNameLabel WarpScript attribute key to remove name label
Variables ¶
This section is empty.
Functions ¶
func NewSimpleMacroMapper ¶
NewSimpleMacroMapper is creating a macromapper that is only modifying the value.
func ParseDuration ¶
ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.
func ParsePromDuration ¶
ParsePromDuration parses a duration as a string and returns a string.
func RetrieveToken ¶
RetrieveToken from multiple sources
Types ¶
type AddValuePayload ¶
type AddValuePayload struct { Timestamp string Latitude string Longitude string Elevation string Value string }
AddValuePayload is the payload to add a value to a GTS
type AggregatePayload ¶
type AggregatePayload struct { Op string // The used aggregation operation. Param string // Parameter used by some aggregators. Grouping []string // The labels by which to group the vector. Without bool // Whether to drop the given labels rather than keep them. KeepCommonLabels bool // Whether to keep common labels among result elements. }
AggregatePayload represents an aggregation operation on a vector.
type BinaryExprPayload ¶
type BinaryExprPayload struct { Op string IsOn bool IsIgnoring bool FilteredLabels []string IncludeLabels []string Card string ReturnBool bool }
BinaryExprPayload is hodling an Op
type BucketizePayload ¶
type BucketizePayload struct { LastBucket string BucketSpan string BucketCount string PreBucketize string Filler string Op string Step string Absent bool }
BucketizePayload is the payload for the bucketize function
type Duration ¶
Duration wraps time.Duration. It is used to parse the custom duration format from YAML. This type should not propagate beyond the scope of input/output processing.
func ParseStringDuration ¶
ParseStringDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.
func (Duration) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type FetchPayload ¶
type FetchPayload struct { ClassName string Labels map[string]string End string Start string Step string Offset string BucketRange string Absent bool Instant bool }
FetchPayload is the payload for the fetch function
type FillValuePayload ¶
FillValuePayload is the payload to fill empty value of a GTS
type FindPayload ¶
FindPayload is the payload for the find function
type FunctionPayload ¶
type FunctionPayload struct { Name string ArgTypes []model.ValueType Args []string OptionalArgs int Prefix string }
FunctionPayload represents a function of the expression language and is used by function nodes.
type GeoTimeSeries ¶
type GeoTimeSeries struct { // This is the class name of the Geo Time Serie. This may be present in only // one chunk of a given Geo Time Serie in the output. Class string `json:"c"` Labels map[string]string `json:"l"` Attrs map[string]string `json:"a"` ID string `json:"i"` Values [][]interface{} `json:"v"` }
A GeoTimeSeries as returned by Warp10 (https://warp10.io/) WarpScript returns a JSON array: Format defined at https://www.warp10.io/content/03_Documentation/03_Interacting_with_Warp_10/04_Fetching_data/02_GTS_JSON_output_format
func (*GeoTimeSeries) TimeAndValue ¶
TimeAndValue Get the time and value at a given position
type HTTPWarp10Server ¶
type HTTPWarp10Server struct { Endpoint string Protocol string // contains filtered or unexported fields }
HTTPWarp10Server Concrete implementation
func NewWarpServer ¶
func NewWarpServer(endpoint string, protocol string) *HTTPWarp10Server
NewWarpServer is returning a new Warp server
func (*HTTPWarp10Server) Delete ¶
func (server *HTTPWarp10Server) Delete(token string, query string) error
Delete is handling /api/v0/delete in Warp
func (*HTTPWarp10Server) Find ¶
Find is Simple Find, given the metric name and tags, and the start/end timestamps
func (*HTTPWarp10Server) FindGTS ¶
func (server *HTTPWarp10Server) FindGTS(token string, selector string) (*QueryResult, error)
FindGTS is find, given the metric name and tags, and the start/end timestamps
func (*HTTPWarp10Server) Query ¶
Query is performing a simple query, given the metric name and tags, and the start/end timestamps
func (*HTTPWarp10Server) QueryGTS ¶
func (server *HTTPWarp10Server) QueryGTS(body, txn string) (*QueryResult, error)
QueryGTS is a simple query, given the metric name and tags, and the start/end timestamps
func (*HTTPWarp10Server) QueryGTSs ¶
func (server *HTTPWarp10Server) QueryGTSs(body, txn string) ([][]GeoTimeSeries, error)
QueryGTSs is multiple query, given the metric name and tags, and the start/end timestamps
type Interval ¶
type Interval struct {
Start, End Time
}
Interval describes and interval between two timestamps.
type MapperPayload ¶
type MapperPayload struct { Mapper string Constant string PreWindow string PostWindow string Occurrences string Suffix string }
MapperPayload is the payload to map GTS' value in the tree
type Node ¶
Node is the struct holding the query tree. Needed for promql, it served also for Graphite protocol
func NewNode ¶
func NewNode(payload payload) *Node
NewNode is creating a new node with a specific type and Payload
func (*Node) InternalToWarpScript ¶
InternalToWarpScript translate an internal Node to WarpScript
func (*Node) ToWarpScript ¶
ToWarpScript translate a node to a WarpScript
type NumberLiteralPayload ¶
type NumberLiteralPayload struct {
Value string
}
NumberLiteralPayload is holding a number
type QueryResult ¶
type QueryResult struct { Count int `json:"count"` Fetched int `json:"fetched"` GTS []GeoTimeSeries `json:"gts"` }
QueryResult The result of a Warp10 query
type ReducerPayload ¶
ReducerPayload is the payload to reduce GTS' value in the tree
type StorePayload ¶
StorePayload is the payload to store variable in the tree
type Time ¶
type Time int64
Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.
func ParsePromTime ¶
ParsePromTime returns a core.Time from string
func TimeFromUnix ¶
TimeFromUnix returns the Time equivalent to the Unixmodel.Timet provided in seconds.
func TimeFromUnixMicro ¶
TimeFromUnixMicro returns the Time equivalent to the Unix Time t provided in nanoseconds.
func TimeFromUnixNano ¶
TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.
func (Time) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Time) Unix ¶
Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.
func (Time) UnixNano ¶
UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type Warp10Server ¶
type Warp10Server interface { QueryGTS(body string) (*QueryResult, error) Query(body string) (*http.Response, error) }
Warp10Server is the abstraction of Warp10
type WarpScriptPayload ¶
type WarpScriptPayload struct {
WarpScript string
}
WarpScriptPayload is the payload to push WarpScript directly in the tree