elasticmetrics

package
v0.0.0-...-3bb02a1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinimalElasticQuery

func MinimalElasticQuery(protocol string, service string, port int) error

func ParseConfig

func ParseConfig(configPath string, config *Config) error

func UpdateMetrics

func UpdateMetrics(config *Config) error

Types

type Block

type Block struct {
	Type string  `json:"type"` // section
	Text TextMap `json:"text"`
}

type BoolMap

type BoolMap struct {
	Must   MustMap   `json:"must"`
	Filter FilterMap `json:"filter"`
}

type Config

type Config struct {
	ElasticProtocol             string  `json:"elasticProtocol"`
	ElasticService              string  `json:"elasticService"`
	ElasticPort                 int     `json:"elasticPort"`
	KibanaUrl                   string  `json:"kibanaUrl"`
	PrometheusUrl               string  `json:"prometheusUrl"`
	QueryIntervalMinutes        int     `json:"queryIntervalMinutes"`
	QueryFromMinutes            int     `json:"queryFromMinutes"`
	MaxForwardedResultsPerQuery int     `json:"maxForwardedResultsPerQuery"`
	LogMatches                  bool    `json:"logMatches"`
	Verbose                     bool    `json:"verbose"`
	Queries                     []Query `json:"queries"`
	ElasticMetricsCounter       prometheus.CounterVec
	DeduplicationHashMap        map[uint32]bool
	EmailService                string `json:"emailService"`
	EmailServicePort            int    `json:"emailServicePort"`
	LeadingDatestampRegex       string `json:"leadingDatestampRegex"`
}

type ContainerMap

type ContainerMap struct {
	Name string `json:"name"`
}

type Data

type Data struct {
	Query QueryMap `json:"query"`
}

type EmailServicePayload

type EmailServicePayload struct {
	Recipients   []string `json:"recipients"`
	Subject      string   `json:"subject"`
	MarkdownBody string   `json:"markdownBody"`
}

type FilterMap

type FilterMap struct {
	Range RangeMap `json:"range"`
}

type Hit

type Hit struct {
	Source HitSource `json:"_source"`
}

type HitSource

type HitSource struct {
	Timestamp  string        `json:"@timestamp"`
	Message    string        `json:"message"`
	Kubernetes KubernetesMap `json:"kubernetes"`
}

type HitsMap

type HitsMap struct {
	Total HitsMapTotal `json:"total"`
	Hits  []Hit        `json:"hits"`
}

type HitsMapTotal

type HitsMapTotal struct {
	Value int `json:"value"`
}

type KubernetesMap

type KubernetesMap struct {
	Container ContainerMap `json:"container"`
	Namespace string       `json:"namespace"`
	Node      NodeMap      `json:"node"`
	Pod       PodMap       `json:"pod"`
}

type MustMap

type MustMap struct {
	QueryString QueryStringMap `json:"query_string"`
}

type NodeLabelsMap

type NodeLabelsMap struct {
	Region string `json:"topology_kubernetes_io/region"`
}

type NodeMap

type NodeMap struct {
	Labels NodeLabelsMap `json:"labels"`
}

type PodMap

type PodMap struct {
	Name string `json:"name"`
}

type Query

type Query struct {
	// required properties
	Label        string `json:"label"`
	LuceneQuery  string `json:"luceneQuery"`
	DefaultField string `json:"defaultField"`
	Team         string `json:"team"`
	// optional properties
	AddLabels      bool     `json:"addLabels"`
	AlertThreshold int      `json:"alertThreshold"`
	Compact        bool     `json:"compact"`
	Ignore         bool     `json:"ignore"`
	Recipients     []string `json:"recipients"`
}

type QueryMap

type QueryMap struct {
	Bool BoolMap `json:"bool"`
}

type QueryStringMap

type QueryStringMap struct {
	Query        string `json:"query"`
	DefaultField string `json:"default_field"`
}

type RangeMap

type RangeMap struct {
	Timestamp TimestampMap `json:"@timestamp"`
}

type Result

type Result struct {
	Hits HitsMap `json:"hits"`
}

Result structs access to: .Hits.Total.Value .Hits.Hits[*].Source.Timestamp .Hits.Hits[*].Source.Message .Hits.Hits[*].Source.Kubernetes.Namespace .Hits.Hits[*].Source.Kubernetes.Container.Name .Hits.Hits[*].Source.Kubernetes.Pod.Name .Hits.Hits[*].Source.Kubernetes.Node.Labels.Region

type SlackPayload

type SlackPayload struct {
	Blocks []Block `json:"blocks"`
}

type TextMap

type TextMap struct {
	Type string `json:"type"` // mrkdown
	Text string `json:"text"`
}

type TimestampMap

type TimestampMap struct {
	GreaterThanOrEqual string `json:"gte"`
}

Jump to

Keyboard shortcuts

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