insight

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AggFuncCount                      = "count"
	AggFuncAvg                        = "avg"
	AggFuncSum                        = "sum"
	AggFuncMin                        = "min"
	AggFuncMax                        = "max"
	AggFuncMedium                     = "medium"
	AggFuncValueCount                 = "value_count"
	AggFuncCardinality                = "cardinality"
	AggFuncDerivative                 = "derivative"
	AggFuncRate                       = "rate"
	AggFuncPercent99                  = "p99"
	AggFuncPercent95                  = "p95"
	AggFuncPercent90                  = "p90"
	AggFuncPercent80                  = "p80"
	AggFuncPercent50                  = "p50"
	AggFuncLatest                     = "latest"
	AggFuncLatency                    = "latency"
	AggFuncSumFuncValueInGroup        = "sum_func_value_in_group"
	AggFuncRateSumFuncValueInGroup    = "rate_sum_func_value_in_group"
	AggFuncLatencySumFuncValueInGroup = "latency_sum_func_value_in_group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketLabel

type BucketLabel struct {
	Enabled  bool   `json:"enabled"`
	Template string `json:"template,omitempty"`
}

type Dashboard

type Dashboard struct {
	ID             string      `json:"id,omitempty"      elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
	Created        time.Time   `json:"created,omitempty" elastic_mapping:"created: { type: date }"`
	Updated        time.Time   `json:"updated,omitempty" elastic_mapping:"updated: { type: date }"`
	ClusterId      string      `json:"cluster_id" elastic_mapping:"cluster_id: { type: keyword }"`
	IndexPattern   string      `json:"index_pattern" elastic_mapping:"index_pattern: { type: keyword }"`
	TimeField      string      `json:"time_field,omitempty" elastic_mapping:"time_field: { type: keyword }"`
	Filter         interface{} `json:"filter,omitempty" elastic_mapping:"filter: { type: object, enabled:false }"`
	BucketSize     string      `json:"bucket_size" elastic_mapping:"bucket_size: { type: keyword }"`
	Title          string      `json:"title"  elastic_mapping:"title: { type: keyword }"`
	Description    string      `json:"description" elastic_mapping:"description: { type: keyword }"`
	Visualizations interface{} `json:"visualizations"  elastic_mapping:"visualizations: { type: object, enabled:false }"`
	Tags           []string    `json:"tags,omitempty" elastic_mapping:"tags: { type: keyword }"`
	User           string      `json:"user" elastic_mapping:"user: { type: keyword }"`
	Query          interface{} `json:"query,omitempty" elastic_mapping:"query: { type: object, enabled:false }"`
	TimeFilter     interface{} `json:"time_filter,omitempty" elastic_mapping:"time_filter: { type: object, enabled:false }"`
}

type GroupSort

type GroupSort struct {
	Key       string `json:"key"`
	Direction string `json:"direction"`
}

type Metric

type Metric struct {
	AggTypes     []string          `json:"agg_types,omitempty"`
	IndexPattern string            `json:"index_pattern,omitempty"`
	TimeField    string            `json:"time_field,omitempty"`
	BucketSize   string            `json:"bucket_size,omitempty"`
	Filter       interface{}       `json:"filter,omitempty"`
	Groups       []MetricGroupItem `json:"groups,omitempty"` //bucket group
	Sort         []GroupSort       `json:"sort,omitempty"`
	ClusterId    string            `json:"cluster_id,omitempty"`
	Formula      string            `json:"formula,omitempty"`
	//array of formula for new version
	Formulas        []string     `json:"formulas,omitempty"`
	Items           []MetricItem `json:"items"`
	FormatType      string       `json:"format,omitempty"`
	TimeFilter      interface{}  `json:"time_filter,omitempty"`
	TimeBeforeGroup bool         `json:"time_before_group,omitempty"`
	BucketLabel     *BucketLabel `json:"bucket_label,omitempty"`
	// number of buckets to return, used for aggregation auto_date_histogram when bucket size equals 'auto'
	Buckets uint   `json:"buckets,omitempty"`
	Unit    string `json:"unit,omitempty"`
}

func (*Metric) AutoTimeBeforeGroup

func (m *Metric) AutoTimeBeforeGroup() bool

AutoTimeBeforeGroup determines if date aggregation should be applied before terms aggregation. Returns false if the metric uses any of the specified aggregation functions.

func (*Metric) GenerateExpression

func (m *Metric) GenerateExpression() (string, error)

func (*Metric) UseBucketSort added in v1.28.2

func (m *Metric) UseBucketSort() bool

UseBucketSort determines whether bucket sorting should be used for aggregation. Returns false if the metric contains specific aggregation functions that require alternative handling.

func (*Metric) ValidateSortKey

func (m *Metric) ValidateSortKey() error

type MetricData

type MetricData struct {
	Groups     []string `json:"groups,omitempty"`
	Data       map[string][]MetricDataItem
	GroupLabel string `json:"group_label,omitempty"`
}

type MetricDataItem

type MetricDataItem struct {
	Timestamp  interface{} `json:"timestamp,omitempty"`
	Value      interface{} `json:"value"`
	Groups     []string    `json:"groups,omitempty"`
	GroupLabel string      `json:"group_label,omitempty"`
}

type MetricGroupItem

type MetricGroupItem struct {
	Field string `json:"field"`
	Limit int    `json:"limit"`
}

type MetricItem

type MetricItem struct {
	Name      string `json:"name,omitempty"`
	Field     string `json:"field"`
	FieldType string `json:"field_type,omitempty"`
	Statistic string `json:"statistic,omitempty"`

	//Function specifies the calculation details for the metric,
	//including the aggregation type and any associated parameters.
	Function map[string]interface{} `json:"function,omitempty"`
}

type Position

type Position struct {
	X int `json:"x"`
	Y int `json:"y"`
	H int `json:"h"`
	W int `json:"w"`
}

type SeriesItem

type SeriesItem struct {
	Type    string                 `json:"type"`
	Options map[string]interface{} `json:"options"`
	Metric  Metric                 `json:"metric"`
}

type Visualization

type Visualization struct {
	ID           string       `json:"id,omitempty"      elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
	Created      *time.Time   `json:"created,omitempty" elastic_mapping:"created: { type: date }"`
	Updated      *time.Time   `json:"updated,omitempty" elastic_mapping:"updated: { type: date }"`
	Title        string       `json:"title,omitempty" elastic_mapping:"title: { type: keyword }"`
	IndexPattern string       `json:"index_pattern,omitempty" elastic_mapping:"index_pattern: { type: keyword }"`
	ClusterId    string       `json:"cluster_id,omitempty" elastic_mapping:"cluster_id: { type: keyword }"`
	Series       []SeriesItem `json:"series"  elastic_mapping:"series: { type: object,enabled:false }"`
	Position     *Position    `json:"position,omitempty" elastic_mapping:"position: { type: object,enabled:false }"`
	Description  string       `json:"description,omitempty" elastic_mapping:"description: { type: keyword }"`
}

type Widget

type Widget struct {
	orm.ORMObjectBase
	Title  string      `json:"title" elastic_mapping:"title: { type: text }"`
	Config interface{} `json:"config" elastic_mapping:"config: { type: object,enabled:false }"`
}

Jump to

Keyboard shortcuts

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