telemetry

package
v0.0.0-...-d8099e1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recorder

func Recorder() middleware.Middleware

Recorder records telemetry "record" for every request. Note: It must be the last middleware in all the plugins

func WriteBackErrorWithTelemetry

func WriteBackErrorWithTelemetry(req *http.Request, w http.ResponseWriter, err string, code int)

Types

type SearchResponseBody

type SearchResponseBody struct {
	Took float64 `json:"took"`
}

SearchResponseBody represents the response body returned by search

type Telemetry

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

Telemetry plugin records the API usage.

func Instance

func Instance() *Telemetry

Instance returns the singleton instance of Telemetry plugin. Note: Only this function must be used (both within and outside the package) to obtain the instance Logs in order to avoid stateless instances of the plugin.

func (*Telemetry) ESMiddleware

func (t *Telemetry) ESMiddleware() []middleware.Middleware

Default empty middleware array function

func (*Telemetry) InitFunc

func (t *Telemetry) InitFunc() error

InitFunc is a part of Plugin interface that gets executed only once, and initializes the dao, i.e. elasticsearch before the plugin is operational.

func (*Telemetry) Name

func (t *Telemetry) Name() string

Name returns the name of the plugin: "telemetry"

func (*Telemetry) RSMiddleware

func (t *Telemetry) RSMiddleware() []middleware.Middleware

Default empty middleware array function

func (*Telemetry) Routes

func (t *Telemetry) Routes() []plugins.Route

Routes returns an empty slice of routes, since Logs is solely a middleware.

type TelemetryRecord

type TelemetryRecord struct {
	// timestamp in UNIX
	TimeStamp        int64  `json:"timestamp"`
	CPU              int64  `json:"cpu"`
	URL              string `json:"url"`
	Method           string `json:"m"`
	Category         string `json:"cat"`
	ServerStatusCode int64  `json:"ssc"`
	RunTime          string `json:"rt"`
	ServerMode       string `json:"mode"`
	Plan             string `json:"plan"`
	ServerVersion    string `json:"ver"`
	// Machine ID
	ServerID string `json:"sid"`
	// The following properties may present or not
	ClientIPv4     *string `json:"cip,omitempty"`
	ClientIPv6     *string `json:"cip6,omitempty"`
	FrontEndClient *string `json:"fe,omitempty"`
	// Memory allocated to service in MB(s)
	MEMORY *uint64 `json:"mem,omitempty"`
	// Response time taken by Elasticsearch for search requests in milliseconds
	SearchResponseTime *int64 `json:"srt,omitempty"`
	// Response time taken by RS API for search requests in milliseconds
	AppbaseResponseTime *int64 `json:"art,omitempty"`
	// Response size in bytes
	ServerResponseSize *int64 `json:"srs,omitempty"`
	// Disk Size in MB(s)
	AvailableDisk *uint64 `json:"disk,omitempty"`
	Acl           *string `json:"acl,omitempty"`
}

TelemetryRecord plugin records the API usage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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