nse

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	USER_AGENT                    = "LAMAAPI/1.0.0"
	NSE_RESP_CODE_SUCCESS         = 601
	NSE_RESP_CODE_PARTIAL_SUCCESS = 602
	NSE_RESP_CODE_INVALID_LOGIN   = 701
	NSE_RESP_CODE_INVALID_SEQ_ID  = 704
	NSE_RESP_CODE_INVALID_TOKEN   = 801
	NSE_RESP_CODE_EXPIRED_TOKEN   = 802
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppReq added in v0.1.4

type AppReq struct {
	MemberID   string          `json:"memberId"`
	ExchangeID int             `json:"exchangeId"`
	SequenceID int             `json:"sequenceId"`
	Timestamp  int64           `json:"timestamp"`
	Payload    []MetricPayload `json:"payload"`
}

type DatabaseReq

type DatabaseReq struct {
	MemberID   string          `json:"memberId"`
	ExchangeID int             `json:"exchangeId"`
	SequenceID int             `json:"sequenceId"`
	Timestamp  int64           `json:"timestamp"`
	Payload    []MetricPayload `json:"payload"`
}

type HardwareReq

type HardwareReq struct {
	MemberID   string          `json:"memberId"`
	ExchangeID int             `json:"exchangeId"`
	SequenceID int             `json:"sequenceId"`
	Timestamp  int64           `json:"timestamp"`
	Payload    []MetricPayload `json:"payload"`
}

type LoginReq

type LoginReq struct {
	MemberID string `json:"memberId"`
	LoginID  string `json:"loginId"`
	Password string `json:"password"`
}

type LoginResp

type LoginResp struct {
	Timestamp    int64  `json:"timestamp"`
	VersionNo    string `json:"versionNo"`
	MemberID     string `json:"memberId"`
	LoginID      string `json:"loginId"`
	ResponseCode int    `json:"responseCode"`
	ResponseDesc string `json:"responseDesc"`
	Token        string `json:"token"`
}

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Manager provides access to the NSE LAMA API.

func New

func New(lo *slog.Logger, opts Opts) (*Manager, error)

func (*Manager) Login

func (mgr *Manager) Login() error

Login is used to generate a session token for further requests. Token is valid for 24 hours and after that it should be renewed again.

func (*Manager) PushAppMetrics added in v0.1.4

func (mgr *Manager) PushAppMetrics(host string, data models.AppPromResp) error

PushAppMetrics sends app metrics to NSE LAMA API.

func (*Manager) PushDBMetrics

func (mgr *Manager) PushDBMetrics(host string, data models.DBPromResp) error

PushDBMetrics sends database metrics to NSE LAMA API.

func (*Manager) PushHWMetrics

func (mgr *Manager) PushHWMetrics(host string, data models.HWPromResp) error

PushHWMetrics is used to push database metrics to NSE LAMA API.

func (*Manager) PushNetworkMetrics added in v0.1.2

func (mgr *Manager) PushNetworkMetrics(host string, data models.NetworkPromResp) error

PushNetworkMetrics sends network metrics to NSE LAMA API.

type MetricData

type MetricData struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

type MetricPayload

type MetricPayload struct {
	ApplicationID int          `json:"applicationId"`
	MetricData    []MetricData `json:"metricData"`
}

type MetricValue

type MetricValue struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
	Avg float64 `json:"avg"`
	Med float64 `json:"med"`
}

type MetricsResp

type MetricsResp struct {
	Timestamp    int64  `json:"timestamp"`
	VersionNo    string `json:"versionNo"`
	ResponseCode int    `json:"responseCode"`
	ResponseDesc string `json:"responseDesc"`
	Errors       []struct {
		ApplicationID int         `json:"applicationId"`
		ErrCode       int         `json:"errCode"`
		ErrDesc       string      `json:"errDesc"`
		ErrKey        string      `json:"errKey"`
		Measure       interface{} `json:"measure"`
	} `json:"errors"`
}

type NetworkReq added in v0.1.2

type NetworkReq struct {
	MemberID   string          `json:"memberId"`
	ExchangeID int             `json:"exchangeId"`
	SequenceID int             `json:"sequenceId"`
	Timestamp  int64           `json:"timestamp"`
	Payload    []MetricPayload `json:"payload"`
}

type Opts

type Opts struct {
	URL             string
	LoginID         string
	MemberID        string
	ExchangeID      int
	Password        string
	Timeout         time.Duration
	IdleConnTimeout time.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳