scalyr

package
v0.0.0-...-ff86e56 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryURL           = "https://www.scalyr.com/api/query"
	NumericQueryURL    = "https://www.scalyr.com/api/numericQuery"
	TimeseriesQueryURL = "https://www.scalyr.com/api/timeseriesQuery"
	FacetQueryURL      = "https://www.scalyr.com/api/facetQuery"
	MaxBuckets         = 5000
)
View Source
const (
	PrecedenceLevel1   = 1
	PrecedenceLevel2   = 2
	FloatCutoff        = 0.0001
	DivideByZeroResult = -1
	ValueIndex         = 0
	TimestampIndex     = 1
	ReplacePrefix      = "var"
)

Variables

This section is empty.

Functions

func GetBuckets

func GetBuckets(data *BucketRequest) (int, error)

GetBuckets gets the number of buckets that would be appropriate for the passed in from and to parameters, giving each bucket approximately the number of seconds defined in intervalSeconds

Types

type BucketRequest

type BucketRequest struct {
	From            int64
	To              int64
	IntervalSeconds int
}

type NumericQueryRequest

type NumericQueryRequest struct {
	Token     string `json:"token"`
	QueryType string `json:"queryType"`
	Filter    string `json:"filter"`
	Function  string `json:"function"`
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
	Buckets   int    `json:"buckets"`
	Priority  string `json:"priority"`
}

url: https://www.scalyr.com/api/numericQuery

type NumericQueryResponse

type NumericQueryResponse struct {
	Status   string    `json:"status"`
	Values   []float64 `json:"values"`
	CpuUsage int       `json:"cpuUsage"`
}

type ParseVar

type ParseVar struct {
	Id         string
	Filter     string
	Query      *TimeseriesQuery
	Response   *TimeseriesQueryResponse
	ConstValue float64 //this is just for the constant values
}

func ParseComplexExpression

func ParseComplexExpression(expression string, start string, end string, buckets int, fullVariableExpression *string, useNumeric bool) ([]*ParseVar, error)

*

  • @param $expression
  • @param $start
  • @param $end
  • @param $buckets
  • @param string $fullVariableExpression *
  • @param $useNumeric *
  • @return array
  • @throws \Adknown\ProxyScalyr\Scalyr\Request\Exception\BadBucketsException

type Response

type Response struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type Scalyr

type Scalyr struct {
	// contains filtered or unexported fields
}

func NewPtr

func NewPtr(readLogToken string, readConfigToken string) *Scalyr

NewPtr creates a new Scalyr object and returns a pointer

func (*Scalyr) ComplexTimeSeriesQuery

func (s *Scalyr) ComplexTimeSeriesQuery(query *TimeseriesQuery) (*TimeseriesQueryResponse, []string, error)

func (*Scalyr) SetHttpClient

func (s *Scalyr) SetHttpClient(client http.Client)

SetHttpClient overrides the existing http client

func (*Scalyr) TimeSeriesQuery

func (s *Scalyr) TimeSeriesQuery(query *TimeseriesQuery) (*TimeseriesQueryResponse, error)

type TimeseriesQuery

type TimeseriesQuery struct {
	Filter    string `json:"filter"`
	Buckets   int    `json:"buckets"`
	Function  string `json:"function"`
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
	Priority  string `json:"priority"`
}

type TimeseriesQueryRequest

type TimeseriesQueryRequest struct {
	Token   string             `json:"token"`
	Queries []*TimeseriesQuery `json:"queries"`
}

url: https://www.scalyr.com/api/timeseriesQuery

type TimeseriesQueryResponse

type TimeseriesQueryResponse struct {
	Status        string                  `json:"status"`
	Results       []TimeseriesQueryResult `json:"results"`
	ExecutionTime int                     `json:"executionTime"`
	Message       string                  `json:"message,omitempty"`
}

func NewEvaluateExpression

func NewEvaluateExpression(expression string, varArray []*ParseVar) (*TimeseriesQueryResponse, error)

NewEvaluateExpression runs through all the operators/operands and calls the Scalyr query requests. It then applies the math operations on the results of the Scalyr queries.

type TimeseriesQueryResult

type TimeseriesQueryResult struct {
	Values              []float64 `json:"values"`
	ExecutionTime       int       `json:"executionTime"`
	FoundExistingSeries bool      `json:"foundExistingSeries"`
}

type Token

type Token struct {
	Variable string      //the respresentative variable for the token
	Data     interface{} //the data that the token holds
}

Jump to

Keyboard shortcuts

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