prometheus

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: GPL-3.0, GPL-3.0, BSD-2-Clause-Views Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Host:    "localhost",
	Port:    8080,
	Refresh: 5 * time.Second,
}

DefaultConfig contains default settings for the dashboard.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host is the host interface on which to start the dashboard server. If this
	// field is empty, no dashboard will be started.
	Host string `toml:",omitempty"`

	// Port is the TCP port number on which to start the dashboard server. The
	// default zero value is/ valid and will pick a port number randomly (useful
	// for ephemeral nodes).
	Port int `toml:",omitempty"`

	// Refresh is the refresh rate of the data updates, the chartEntry will be collected this often.
	Refresh time.Duration `toml:",omitempty"`
}

Config contains the configuration parameters of the dashboard.

type Datasource

type Datasource struct {
	ID                int    `json:"id"`
	OrgID             int    `json:"orgId"`
	Name              string `json:"name"`
	Type              string `json:"type"`
	TypeLogoURL       string `json:"typeLogoUrl"`
	Access            string `json:"access"`
	URL               string `json:"url"`
	Password          string `json:"password"`
	User              string `json:"user"`
	Database          string `json:"database"`
	BasicAuth         bool   `json:"basicAuth"`
	BasicAuthUser     string `json:"basicAuthUser"`
	BasicAuthPassword string `json:"basicAuthPassword"`
	WithCredentials   bool   `json:"withCredentials"`
	IsDefault         bool   `json:"isDefault"`
	JSONData          struct {
		HTTPMethod  string        `json:"httpMethod"`
		KeepCookies []interface{} `json:"keepCookies"`
	} `json:"jsonData"`
	SecureJSONFields struct {
	} `json:"secureJsonFields"`
	Version  int  `json:"version"`
	ReadOnly bool `json:"readOnly"`
}

type DatasourceResp

type DatasourceResp struct {
	Datasource Datasource `json:"datasource"`
	ID         int        `json:"id"`
	Message    string     `json:"message"`
	Name       string     `json:"name"`
}

type Prometheus

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

Prometheus contains the dashboard internals.

func New

func New(config Config) (*Prometheus, error)

New creates a new dashboard instance with the given configuration.

func (*Prometheus) APIs

func (db *Prometheus) APIs() []rpc.API

APIs is a meaningless implementation of node.Service.

func (*Prometheus) CorsProtocols

func (db *Prometheus) CorsProtocols() []p2p.Protocol

func (*Prometheus) GenesisHash

func (db *Prometheus) GenesisHash() common.Hash

func (*Prometheus) HandlerForQuery

func (db *Prometheus) HandlerForQuery(reg prometheus.Gatherer, opts promhttp.HandlerOpts) http.Handler

func (*Prometheus) Protocols

func (db *Prometheus) Protocols() []p2p.Protocol

Protocols is a meaningless implementation of node.Service.

func (*Prometheus) QueryHandler

func (db *Prometheus) QueryHandler() http.Handler

func (*Prometheus) Start

func (db *Prometheus) Start(server *p2p.Server, corss *p2p.Server) error

Start implements node.Service, starting the data collection thread and the listening server of the dashboard.

func (*Prometheus) Stop

func (db *Prometheus) Stop() error

Stop implements node.Service, stopping the data collection thread and the connection listener of the dashboard.

type QueryResp

type QueryResp struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string        `json:"resultType"`
		Result     []interface{} `json:"result"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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