ngx

package module
v0.0.0-...-dec383d Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

Go Go Report Card GitHub go.mod Go version License

ngx

ngx is a Go client library for NGINX Plus API. The project was initially based on the fork of the open source NGINX Plus client API.

The library works against versions 4 to 8 of the NGINX Plus API. The table below shows the version of NGINX Plus where the API was first introduced.

Click to see API and NGINX Plus version table
API version NGINX Plus version
4 R18
5 R19
6 R20
7 R25
8 R27

Using the Go library

Import the library using:

import "github.com/qba73/ngx"

Creating a client

Create a new Client object by calling ngx.NewClient(baseURL)

client, err := ngx.NewClient("http://localhost:8080/api")
if err != nil {
    // handle error
}

Or create a client with customized http Client:

customHTTPClient := &http.Client{}

client, err := ngx.NewClient(
    "http://localhost:8080/api",
    ngx.WithHTTPClient(customHTTPClient),
)
if err != nil {
    // handle error
}

Or create a client to work with specific version of NGINX instance:

client, err := ngx.NewClient(
    "http://localhost:8080/api",
    ngx.WithVersion(7),
)
if err != nil {
    // handle error
}

Testing

Run tests

make dox
Click to see test run results
$ gotestdox
 ✔ Check server updates is valid on valid input (0.00s)
 ✔ Check stream server updates is valid on valid input (0.00s)
 ✔ Upstream servers config is valid on valid input (0.00s)
 ✔ Upstream stream servers configuration is valid on valid input (0.00s)
 ✔ Server address is valid on valid input with host and port (0.00s)
 ✔ Server address is valid on valid input with IPV6 address and without port (0.00s)
 ✔ Server address is valid on valid input with IPV4 address and without port (0.00s)
 ✔ Server address is valid on valid input with address and without port (0.00s)
 ✔ Server address is valid on valid input with unix socket (0.00s)
 ✔ Server address is valid on valid input with IPV6 and port (0.00s)
 ✔ Server address is valid on valid input with IPV4 and port (0.00s)
 ✔ NGINX server status is valid on valid input request params (0.00s)
 ✔ Request get NGINXURL is valid on valid fields (0.00s)
 ✔ Get NGINX status errors on invalid request param (0.00s)
 ✔ Client uses valid request path on valid request params (0.00s)
 ✔ Client retrives info about running NGINX instance (0.00s)
 ✔ Client retrives NGINX status on valid parameters (0.00s)

Contributing

If you have any suggestions or experience issues with the NGINX Plus Go Client, please create an issue or send a pull request on GitHub.

Documentation

Overview

Package ngx is a Go client library for NGINX Plus API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(h *http.Client) option

WithHTTPClient is a func option that configures NGINX Client to use a custom HTTP Client.

func WithVersion

func WithVersion(v int) option

WithVersion is a func option that configures version of the NGINX API the Client talks to. It is user's responsibility to provide valid version of the NGINX Plus that the Client talks to. Valid versions are 4,5,6,7,8. The Client's default version is 8.

Types

type CacheStats

type CacheStats struct {
	Responses uint64
	Bytes     uint64
}

CacheStats are basic cache stats.

type Caches

type Caches = map[string]HTTPCache

Caches is a map of cache stats by cache zone

type Client

type Client struct {
	URL        string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

NginxClient lets you access NGINX Plus API.

func NewClient

func NewClient(baseURL string, opts ...option) (*Client, error)

NewClient takes NGINX base URL and constructs a new default client. The client can be customized by passing functional options that configure client version and http.Client.

func (Client) AddHTTPServer

func (c Client) AddHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error

AddHTTPServer adds the server to the upstream.

func (Client) AddKeyValPair

func (c Client) AddKeyValPair(ctx context.Context, zone string, key string, val string) error

AddKeyValPair adds a new key/value pair to a given HTTP zone.

func (Client) AddStreamKeyValPair

func (c Client) AddStreamKeyValPair(ctx context.Context, zone string, key string, val string) error

AddStreamKeyValPair adds a new key/value pair to a given Stream zone.

func (Client) AddStreamServer

func (c Client) AddStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error

AddStreamServer adds the stream server to the upstream.

func (Client) CheckIfStreamUpstreamExists

func (c Client) CheckIfStreamUpstreamExists(ctx context.Context, upstream string) error

CheckIfStreamUpstreamExists checks if the stream upstream exists in NGINX. If the upstream doesn't exist, it returns the error.

func (Client) CheckIfUpstreamExists

func (c Client) CheckIfUpstreamExists(ctx context.Context, upstream string) error

CheckIfUpstreamExists checks if the upstream exists in NGINX. If the upstream doesn't exist, it returns the error.

func (Client) DeleteHTTPServer

func (c Client) DeleteHTTPServer(ctx context.Context, upstream string, server string) error

DeleteHTTPServer the server from the upstream.

func (Client) DeleteKeyValPairs

func (c Client) DeleteKeyValPairs(ctx context.Context, zone string) error

DeleteKeyValPairs deletes all the key-value pairs in a given HTTP zone.

func (Client) DeleteKeyValuePair

func (c Client) DeleteKeyValuePair(ctx context.Context, zone string, key string) error

DeleteKeyValuePair deletes the key/value pair for a key in a given HTTP zone.

func (Client) DeleteStreamKeyValPairs

func (c Client) DeleteStreamKeyValPairs(ctx context.Context, zone string) error

DeleteStreamKeyValPairs deletes all the key-value pairs in a given Stream zone.

func (*Client) DeleteStreamKeyValuePair

func (c *Client) DeleteStreamKeyValuePair(ctx context.Context, zone string, key string) error

DeleteStreamKeyValuePair deletes the key/value pair for a key in a given Stream zone.

func (Client) DeleteStreamServer

func (c Client) DeleteStreamServer(ctx context.Context, upstream string, server string) error

DeleteStreamServer the server from the upstream.

func (Client) GetAllKeyValPairs

func (c Client) GetAllKeyValPairs(ctx context.Context) (KeyValPairsByZone, error)

GetAllKeyValPairs fetches all key/value pairs for all HTTP zones.

func (Client) GetAllStreamKeyValPairs

func (c Client) GetAllStreamKeyValPairs(ctx context.Context) (KeyValPairsByZone, error)

GetAllStreamKeyValPairs fetches all key/value pairs for all Stream zones.

func (Client) GetCaches

func (c Client) GetCaches(ctx context.Context) (Caches, error)

GetCaches returns Cache stats

func (Client) GetConnections

func (c Client) GetConnections(ctx context.Context) (Connections, error)

GetConnections returns Connections stats.

func (Client) GetHTTPConnectionsLimit

func (c Client) GetHTTPConnectionsLimit(ctx context.Context) (HTTPLimitConnections, error)

GetHTTPConnectionsLimit returns http/limit_conns stats.

func (Client) GetHTTPLimitReqs

func (c Client) GetHTTPLimitReqs(ctx context.Context) (HTTPLimitRequests, error)

GetHTTPLimitReqs returns http/limit_reqs stats.

func (Client) GetHTTPRequests

func (c Client) GetHTTPRequests(ctx context.Context) (HTTPRequests, error)

GetHTTPRequests returns http/requests stats.

func (Client) GetHTTPServers

func (c Client) GetHTTPServers(ctx context.Context, upstream string) ([]UpstreamServer, error)

GetHTTPServers returns the servers of the upstream from NGINX.

func (Client) GetKeyValPairs

func (c Client) GetKeyValPairs(ctx context.Context, zone string) (KeyValPairs, error)

GetKeyValPairs fetches key/value pairs for a given HTTP zone.

func (Client) GetLocationZones

func (c Client) GetLocationZones(ctx context.Context) (LocationZones, error)

GetLocationZones returns http/location_zones stats.

func (Client) GetNGINXStatus

func (c Client) GetNGINXStatus(ctx context.Context, fields ...string) (NginxInfo, error)

Returns nginx version, build name, address, number of configuration reloads, IDs of master and worker processes. Limits which fields of nginx running instance will be output.

Available fields: "version", "build", "address", "generation", "load_timestamp", "timestamp", "pid", "ppid".

func (Client) GetNginxInfo

func (c Client) GetNginxInfo(ctx context.Context) (NginxInfo, error)

GetNginxInfo returns status of nginx running instance. Returned status includes nginx version, build name, address, number of configuration reloads, IDs of master and worker processes.

func (Client) GetProcesses

func (c Client) GetProcesses(ctx context.Context) (Processes, error)

GetProcesses returns Processes stats.

func (Client) GetResolvers

func (c Client) GetResolvers(ctx context.Context) (Resolvers, error)

GetResolvers returns Resolvers stats.

func (Client) GetSSL

func (c Client) GetSSL(ctx context.Context) (SSL, error)

GetSSL returns SSL stats.

func (*Client) GetServerZones

func (c *Client) GetServerZones(ctx context.Context) (ServerZones, error)

GetServerZones returns http/server_zones stats.

func (Client) GetSlabs

func (c Client) GetSlabs(ctx context.Context) (Slabs, error)

GetSlabs returns Slabs stats.

func (Client) GetStats

func (c Client) GetStats(ctx context.Context) (_ Stats, err error)

GetStats gets process, slab, connection, request, ssl, zone, stream zone, upstream and stream upstream related stats from the NGINX Plus API.

func (Client) GetStreamConnectionsLimit

func (c Client) GetStreamConnectionsLimit(ctx context.Context) (StreamLimitConnections, error)

GetStreamConnectionsLimit returns stream/limit_conns stats.

func (Client) GetStreamKeyValPairs

func (c Client) GetStreamKeyValPairs(ctx context.Context, zone string) (KeyValPairs, error)

GetStreamKeyValPairs fetches key/value pairs for a given Stream zone.

func (Client) GetStreamServerZones

func (c Client) GetStreamServerZones(ctx context.Context) (StreamServerZones, error)

GetStreamServerZones returns stream/server_zones stats.

func (Client) GetStreamServers

func (c Client) GetStreamServers(ctx context.Context, upstream string) ([]StreamUpstreamServer, error)

GetStreamServers returns the stream servers of the upstream from NGINX.

func (Client) GetStreamUpstreams

func (c Client) GetStreamUpstreams(ctx context.Context) (StreamUpstreams, error)

GetStreamUpstreams returns stream/upstreams stats.

func (Client) GetStreamZoneSync

func (c Client) GetStreamZoneSync(ctx context.Context) (StreamZoneSync, error)

GetStreamZoneSync returns stream/zone_sync stats.

func (Client) GetUpstreams

func (c Client) GetUpstreams(ctx context.Context) (Upstreams, error)

GetUpstreams returns http/upstreams stats.

func (Client) ModifyKeyValPair

func (c Client) ModifyKeyValPair(ctx context.Context, zone string, key string, val string) error

ModifyKeyValPair modifies the value of an existing key in a given HTTP zone.

func (Client) ModifyStreamKeyValPair

func (c Client) ModifyStreamKeyValPair(ctx context.Context, zone string, key string, val string) error

Modify10KeyValPair modifies the value of an existing key in a given Stream zone.

func (Client) UpdateHTTPServer

func (c Client) UpdateHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error

UpdateHTTPServer updates the server of the upstream.

func (Client) UpdateHTTPServers

func (c Client) UpdateHTTPServers(ctx context.Context, upstream string, servers []UpstreamServer) ([]UpstreamServer, []UpstreamServer, []UpstreamServer, error)

UpdateHTTPServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. Servers that are in the slice and exist in NGINX, but have different parameters, will be updated.

func (Client) UpdateStreamServer

func (c Client) UpdateStreamServer(ctx context.Context, upstream string, server StreamUpstreamServer) error

UpdateStreamServer updates the stream server of the upstream.

func (Client) UpdateStreamServers

func (c Client) UpdateStreamServers(ctx context.Context, upstream string, servers []StreamUpstreamServer) ([]StreamUpstreamServer, []StreamUpstreamServer, []StreamUpstreamServer, error)

UpdateStreamServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX. Servers that are in the slice and exist in NGINX, but have different parameters, will be updated.

type Connections

type Connections struct {
	Accepted uint64
	Dropped  uint64
	Active   uint64
	Idle     uint64
}

Connections represents connection related stats.

type ExtendedCacheStats

type ExtendedCacheStats struct {
	CacheStats
	ResponsesWritten uint64 `json:"responses_written"`
	BytesWritten     uint64 `json:"bytes_written"`
}

ExtendedCacheStats are extended cache stats.

type HTTPCache

type HTTPCache struct {
	Size        uint64
	MaxSize     uint64 `json:"max_size"`
	Cold        bool
	Hit         CacheStats
	Stale       CacheStats
	Updating    CacheStats
	Revalidated CacheStats
	Miss        CacheStats
	Expired     ExtendedCacheStats
	Bypass      ExtendedCacheStats
}

HTTPCache represents a zone's HTTP Cache

type HTTPCodes

type HTTPCodes struct {
	HTTPContinue              uint64 `json:"100,omitempty"`
	HTTPSwitchingProtocols    uint64 `json:"101,omitempty"`
	HTTPProcessing            uint64 `json:"102,omitempty"`
	HTTPOk                    uint64 `json:"200,omitempty"`
	HTTPCreated               uint64 `json:"201,omitempty"`
	HTTPAccepted              uint64 `json:"202,omitempty"`
	HTTPNoContent             uint64 `json:"204,omitempty"`
	HTTPPartialContent        uint64 `json:"206,omitempty"`
	HTTPSpecialResponse       uint64 `json:"300,omitempty"`
	HTTPMovedPermanently      uint64 `json:"301,omitempty"`
	HTTPMovedTemporarily      uint64 `json:"302,omitempty"`
	HTTPSeeOther              uint64 `json:"303,omitempty"`
	HTTPNotModified           uint64 `json:"304,omitempty"`
	HTTPTemporaryRedirect     uint64 `json:"307,omitempty"`
	HTTPBadRequest            uint64 `json:"400,omitempty"`
	HTTPUnauthorized          uint64 `json:"401,omitempty"`
	HTTPForbidden             uint64 `json:"403,omitempty"`
	HTTPNotFound              uint64 `json:"404,omitempty"`
	HTTPNotAllowed            uint64 `json:"405,omitempty"`
	HTTPRequestTimeOut        uint64 `json:"408,omitempty"`
	HTTPConflict              uint64 `json:"409,omitempty"`
	HTTPLengthRequired        uint64 `json:"411,omitempty"`
	HTTPPreconditionFailed    uint64 `json:"412,omitempty"`
	HTTPRequestEntityTooLarge uint64 `json:"413,omitempty"`
	HTTPRequestURITooLarge    uint64 `json:"414,omitempty"`
	HTTPUnsupportedMediaType  uint64 `json:"415,omitempty"`
	HTTPRangeNotSatisfiable   uint64 `json:"416,omitempty"`
	HTTPTooManyRequests       uint64 `json:"429,omitempty"`
	HTTPClose                 uint64 `json:"444,omitempty"`
	HTTPRequestHeaderTooLarge uint64 `json:"494,omitempty"`
	HTTPSCertError            uint64 `json:"495,omitempty"`
	HTTPSNoCert               uint64 `json:"496,omitempty"`
	HTTPToHTTPS               uint64 `json:"497,omitempty"`
	HTTPClientClosedRequest   uint64 `json:"499,omitempty"`
	HTTPInternalServerError   uint64 `json:"500,omitempty"`
	HTTPNotImplemented        uint64 `json:"501,omitempty"`
	HTTPBadGateway            uint64 `json:"502,omitempty"`
	HTTPServiceUnavailable    uint64 `json:"503,omitempty"`
	HTTPGatewayTimeOut        uint64 `json:"504,omitempty"`
	HTTPInsufficientStorage   uint64 `json:"507,omitempty"`
}

HTTPCodes represents HTTP response codes

type HTTPLimitConnections

type HTTPLimitConnections map[string]LimitConnection

HTTPLimitConnections represents limit connections related stats

type HTTPLimitRequest

type HTTPLimitRequest struct {
	Passed         uint64
	Delayed        uint64
	Rejected       uint64
	DelayedDryRun  uint64 `json:"delayed_dry_run"`
	RejectedDryRun uint64 `json:"rejected_dry_run"`
}

HTTPLimitRequest represents HTTP Requests Rate Limiting

type HTTPLimitRequests

type HTTPLimitRequests map[string]HTTPLimitRequest

HTTPLimitRequests represents limit requests related stats

type HTTPRequests

type HTTPRequests struct {
	Total   uint64
	Current uint64
}

HTTPRequests represents HTTP request related stats.

type HealthChecks

type HealthChecks struct {
	Checks     uint64
	Fails      uint64
	Unhealthy  uint64
	LastPassed bool `json:"last_passed"`
}

HealthChecks represents health check related stats for a peer.

type KeyValPairs

type KeyValPairs map[string]string

KeyValPairs are the key-value pairs stored in a zone.

type KeyValPairsByZone

type KeyValPairsByZone map[string]KeyValPairs

KeyValPairsByZone are the KeyValPairs for all zones, by zone name.

type LimitConnection

type LimitConnection struct {
	Passed         uint64
	Rejected       uint64
	RejectedDryRun uint64 `json:"rejected_dry_run"`
}

LimitConnection represents Connections Limiting

type LocationZone

type LocationZone struct {
	Requests  int64
	Responses Responses
	Discarded int64
	Received  int64
	Sent      int64
}

LocationZone represents location_zones related stats

type LocationZones

type LocationZones map[string]LocationZone

LocationZones represents location_zones related stats

type NginxInfo

type NginxInfo struct {
	Version         string
	Build           string
	Address         string
	Generation      int
	LoadTimestamp   time.Time
	Timestamp       time.Time
	ProcessID       int
	ParentProcessID int
}

NginxInfo contains general information about NGINX Plus.

type Pages

type Pages struct {
	Used uint64
	Free uint64
}

Pages represents the slab memory usage stats.

type Peer

type Peer struct {
	ID           int
	Server       string
	Service      string
	Name         string
	Backup       bool
	Weight       int
	State        string
	Active       uint64
	SSL          SSL
	MaxConns     int `json:"max_conns"`
	Requests     uint64
	Responses    Responses
	Sent         uint64
	Received     uint64
	Fails        uint64
	Unavail      uint64
	HealthChecks HealthChecks `json:"health_checks"`
	Downtime     uint64
	Downstart    string
	Selected     string
	HeaderTime   uint64 `json:"header_time"`
	ResponseTime uint64 `json:"response_time"`
}

Peer represents peer (upstream server) related stats.

type Processes

type Processes struct {
	Respawned int
}

Processes represents processes related stats

type Queue

type Queue struct {
	Size      int
	MaxSize   int `json:"max_size"`
	Overflows uint64
}

Queue represents queue related stats for an upstream.

type Resolver

type Resolver struct {
	Requests  ResolverRequests  `json:"requests"`
	Responses ResolverResponses `json:"responses"`
}

Resolver represents resolvers related stats

type ResolverRequests

type ResolverRequests struct {
	Name int64
	Srv  int64
	Addr int64
}

ResolverRequests represents resolver requests

type ResolverResponses

type ResolverResponses struct {
	Noerror  int64
	Formerr  int64
	Servfail int64
	Nxdomain int64
	Notimp   int64
	Refused  int64
	Timedout int64
	Unknown  int64
}

ResolverResponses represents resolver responses

type Resolvers

type Resolvers map[string]Resolver

Resolvers represents resolvers related stats

type Responses

type Responses struct {
	Codes        HTTPCodes
	Responses1xx uint64 `json:"1xx"`
	Responses2xx uint64 `json:"2xx"`
	Responses3xx uint64 `json:"3xx"`
	Responses4xx uint64 `json:"4xx"`
	Responses5xx uint64 `json:"5xx"`
	Total        uint64
}

Responses represents HTTP response related stats.

type SSL

type SSL struct {
	Handshakes       uint64
	HandshakesFailed uint64 `json:"handshakes_failed"`
	SessionReuses    uint64 `json:"session_reuses"`
}

SSL represents SSL related stats.

type ServerZone

type ServerZone struct {
	Processing uint64
	Requests   uint64
	Responses  Responses
	Discarded  uint64
	Received   uint64
	Sent       uint64
	SSL        SSL
}

ServerZone represents server zone related stats.

type ServerZones

type ServerZones map[string]ServerZone

ServerZones is map of server zone stats by zone name

type Sessions

type Sessions struct {
	Sessions2xx uint64 `json:"2xx"`
	Sessions4xx uint64 `json:"4xx"`
	Sessions5xx uint64 `json:"5xx"`
	Total       uint64
}

Sessions represents stream session related stats.

type Slab

type Slab struct {
	Pages Pages
	Slots Slots
}

Slab represents slab related stats.

type Slabs

type Slabs map[string]Slab

Slabs is map of slab stats by zone name.

type Slot

type Slot struct {
	Used  uint64
	Free  uint64
	Reqs  uint64
	Fails uint64
}

Slot represents slot related stats.

type Slots

type Slots map[string]Slot

Slots is a map of slots by slot size

type Stats

type Stats struct {
	NginxInfo              NginxInfo
	Caches                 Caches
	Processes              Processes
	Connections            Connections
	Slabs                  Slabs
	HTTPRequests           HTTPRequests
	SSL                    SSL
	ServerZones            ServerZones
	Upstreams              Upstreams
	StreamServerZones      StreamServerZones
	StreamUpstreams        StreamUpstreams
	StreamZoneSync         StreamZoneSync
	LocationZones          LocationZones
	Resolvers              Resolvers
	HTTPLimitRequests      HTTPLimitRequests
	HTTPLimitConnections   HTTPLimitConnections
	StreamLimitConnections StreamLimitConnections
}

Stats represents NGINX Plus stats fetched from the NGINX Plus API.

https://nginx.org/en/docs/http/ngx_http_api_module.html

type StreamLimitConnections

type StreamLimitConnections map[string]LimitConnection

StreamLimitConnections represents limit connections related stats

type StreamPeer

type StreamPeer struct {
	ID            int
	Server        string
	Service       string
	Name          string
	Backup        bool
	Weight        int
	State         string
	Active        uint64
	SSL           SSL
	MaxConns      int `json:"max_conns"`
	Connections   uint64
	ConnectTime   int    `json:"connect_time"`
	FirstByteTime int    `json:"first_byte_time"`
	ResponseTime  uint64 `json:"response_time"`
	Sent          uint64
	Received      uint64
	Fails         uint64
	Unavail       uint64
	HealthChecks  HealthChecks `json:"health_checks"`
	Downtime      uint64
	Downstart     string
	Selected      string
}

StreamPeer represents peer (stream upstream server) related stats.

type StreamServerZone

type StreamServerZone struct {
	Processing  uint64
	Connections uint64
	Sessions    Sessions
	Discarded   uint64
	Received    uint64
	Sent        uint64
	SSL         SSL
}

StreamServerZone represents stream server zone related stats.

type StreamServerZones

type StreamServerZones map[string]StreamServerZone

StreamServerZones is map of stream server zone stats by zone name.

type StreamUpstream

type StreamUpstream struct {
	Peers   []StreamPeer
	Zombies int
	Zone    string
}

StreamUpstream represents stream upstream related stats.

type StreamUpstreamServer

type StreamUpstreamServer struct {
	ID          int    `json:"id,omitempty"`
	Server      string `json:"server"`
	MaxConns    *int   `json:"max_conns,omitempty"`
	MaxFails    *int   `json:"max_fails,omitempty"`
	FailTimeout string `json:"fail_timeout,omitempty"`
	SlowStart   string `json:"slow_start,omitempty"`
	Backup      *bool  `json:"backup,omitempty"`
	Down        *bool  `json:"down,omitempty"`
	Weight      *int   `json:"weight,omitempty"`
	Service     string `json:"service,omitempty"`
}

StreamUpstreamServer lets you configure Stream upstreams.

type StreamUpstreams

type StreamUpstreams map[string]StreamUpstream

StreamUpstreams is a map of stream upstream stats by upstream name.

type StreamZoneSync

type StreamZoneSync struct {
	Zones  map[string]SyncZone
	Status StreamZoneSyncStatus
}

StreamZoneSync represents the sync information per each shared memory zone and the sync information per node in a cluster

type StreamZoneSyncStatus

type StreamZoneSyncStatus struct {
	BytesIn     uint64 `json:"bytes_in"`
	MsgsIn      uint64 `json:"msgs_in"`
	MsgsOut     uint64 `json:"msgs_out"`
	BytesOut    uint64 `json:"bytes_out"`
	NodesOnline uint64 `json:"nodes_online"`
}

StreamZoneSyncStatus represents the status of a shared memory zone

type SyncZone

type SyncZone struct {
	RecordsPending uint64 `json:"records_pending"`
	RecordsTotal   uint64 `json:"records_total"`
}

SyncZone represents the synchronization status of a shared memory zone

type Upstream

type Upstream struct {
	Peers      []Peer
	Keepalives int
	Zombies    int
	Zone       string
	Queue      Queue
}

Upstream represents upstream related stats.

type UpstreamServer

type UpstreamServer struct {
	ID          int    `json:"id,omitempty"`
	Server      string `json:"server"`
	MaxConns    *int   `json:"max_conns,omitempty"`
	MaxFails    *int   `json:"max_fails,omitempty"`
	FailTimeout string `json:"fail_timeout,omitempty"`
	SlowStart   string `json:"slow_start,omitempty"`
	Route       string `json:"route,omitempty"`
	Backup      *bool  `json:"backup,omitempty"`
	Down        *bool  `json:"down,omitempty"`
	Drain       bool   `json:"drain,omitempty"`
	Weight      *int   `json:"weight,omitempty"`
	Service     string `json:"service,omitempty"`
}

UpstreamServer lets you configure HTTP upstreams.

type Upstreams

type Upstreams map[string]Upstream

Upstreams is a map of upstream stats by upstream name.

Jump to

Keyboard shortcuts

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