exporter

package
v0.0.0-...-df0ed07 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

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

Exporter implements the prometheus.Collector interface. This will be used to register the metrics with Prometheus.

func NewExporter

func NewExporter(namespace string, collector *KibanaCollector) (*Exporter, error)

NewExporter will create a Exporter struct and initialize the metrics that will be scraped by Prometheus. It will use the provided Kibana details to populate a KibanaCollector struct.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect is the Exporter implementing prometheus.Collector

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe is the Exporter implementing prometheus.Collector

type KibanaCollector

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

KibanaCollector collects the Kibana information together to be used by the exporter to scrape metrics.

func NewCollector

func NewCollector(kibanaURI, kibanaUsername, kibanaPassword string, kibanaSkipTLS bool) (*KibanaCollector, error)

NewCollector builds a KibanaCollector struct

func (*KibanaCollector) TestConnection

func (c *KibanaCollector) TestConnection() bool

TestConnection checks whether the connection to Kibana is healthy

func (*KibanaCollector) WaitForConnection

func (c *KibanaCollector) WaitForConnection()

WaitForConnection is a method to block until Kibana becomes available

type KibanaMetrics

type KibanaMetrics struct {
	Name string `json:"name"`

	Version struct {
		Number string `json:"number"`
	} `json:"version"`

	Status struct {
		Overall struct {
			Level string `json:"level"`
		} `json:"overall"`

		Core struct {
			Elasticsearch struct {
				Level string `json:"level"`
			} `json:"elasticsearch"`
			SavedObjects struct {
				Level string `json:"level"`
			} `json:"savedObjects"`
		} `json:"core"`
	} `json:"status"`

	Metrics struct {
		ConcurrentConnections int `json:"concurrent_connections"`

		Process struct {
			UptimeInMillis float64 `json:"uptime_in_millis"`
			Memory         struct {
				Heap struct {
					TotalInBytes int64 `json:"total_in_bytes"`
					UsedInBytes  int64 `json:"used_in_bytes"`
				} `json:"heap"`
				ResidentSetSizeInBytes int64 `json:"resident_set_size_in_bytes"`
			} `json:"memory"`
			// https://github.com/elastic/kibana/blob/9517d067b5d7bb57d89bd62a1f786fda308da26b/packages/core/metrics/core-metrics-server-internal/src/logging/get_ops_metrics_log.ts#L33
			EventLoopDelayInMillis float64 `json:"event_loop_delay"`
		} `json:"process"`

		Os struct {
			Memory struct {
				TotalInBytes int64 `json:"total_in_bytes"`
				UsedInBytes  int64 `json:"used_in_bytes"`
			} `json:"memory"`
			Load struct {
				Load1m  float64 `json:"1m"`
				Load5m  float64 `json:"5m"`
				Load15m float64 `json:"15m"`
			} `json:"load"`
		} `json:"os"`

		ResponseTimes struct {
			AvgInMillis float64 `json:"avg_in_millis"`
			MaxInMillis float64 `json:"max_in_millis"`
		} `json:"response_times"`

		Requests struct {
			Disconnects int `json:"disconnects"`
			Total       int `json:"total"`
		} `json:"requests"`
	} `json:"metrics"`
}

KibanaMetrics is used to unmarshal the metrics response from Kibana.

Jump to

Keyboard shortcuts

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