prometheus

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(cfg []Config, grpcServer *grpc.Server) ([]*pluginsProto.PluginShort, error)

Types

type Config

type Config struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Address     string `yaml:"address"`
	Username    string `yaml:"username"`
	Password    string `yaml:"password"`
	Token       string `yaml:"token"`
}

type Instance

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

type Prometheus

type Prometheus struct {
	prometheusProto.UnimplementedPrometheusServer
	// contains filtered or unexported fields
}

func (*Prometheus) GetMetrics

GetMetrics returns all metrics for all given queries. For that we are creating a map of with the selected values for all variables. Then we are looping through the list of variables, replacing the variables with the selected value and run the PromQL against the configured Prometheus instance. In the last step we transform the result, so that it can be used in the React UI.

func (*Prometheus) GetTableData added in v0.3.0

GetTableData implements the GetTableData function from the Prometheus gRPC service. It takes a list of queries and returns the corresponding data in a table format. In the first step we parse the result of each query into a map[string]map[string]string, where the key of the first map is the provided label for a query. This means the label of each querie should result in the same value, so that we can join the results of the different queries. The second map holds all labels and label values. The value of the query result is also added to this map with a key named "value-N". Finally we transform the map[string]map[string]string is converted to the map[string]*prometheusProto.Row structure, which can be used in the response.

func (*Prometheus) GetVariables

GetVariables returns all variable values. The values are label values for a Prometheus time series. The labels are retrieved via a PromQL query. To get the values we are looping over all queries and pre selecting the first value or all values, when the option is set. So we can use a variable in a following query.

func (*Prometheus) MetricLookup added in v0.2.0

MetricLookup returns all label values for a configured Prometheus instance. These labels are used to show the user a list of suggestions for his entered query.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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