helper

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultInfluxDBURL influxdb address
	DefaultInfluxDBURL = "127.0.0.1:8089"
	// DefaultInfluxDBName influxdb database name
	DefaultInfluxDBName = "ultron"
	// DefaultMeasurementSucc the measurement to store successful request
	DefaultMeasurementSucc = "success"
	// DefaultMeasurementFail the measurement to store failed request
	DefaultMeasurementFail = "failures"
	// DefaultMeasurementAggregation the measurement to store report
	DefaultMeasurementAggregation = "report"
)

Variables

View Source
var (
	AutoIncreaseJSONRPCID = false
)

Functions

This section is empty.

Types

type InfluxDBHelper

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

InfluxDBHelper .

func NewInfluxDBHelper

func NewInfluxDBHelper(conf *InfluxDBHelperConfig) (*InfluxDBHelper, error)

NewInfluxDBHelper 实例化NewInfluxDBHelper对象

func (*InfluxDBHelper) HandleReport

func (i *InfluxDBHelper) HandleReport() ultron.ReportHandleFunc

HandleReport 处理聚合报告

func (*InfluxDBHelper) HandleResult

func (i *InfluxDBHelper) HandleResult() ultron.ResultHandleFunc

HandleResult 处理单次请求结果

type InfluxDBHelperConfig

type InfluxDBHelperConfig struct {
	URL                    string
	UDP                    bool
	User                   string
	Password               string
	Database               string
	MeasurementSucc        string
	MeasurementFail        string
	MeasurementAggregation string
}

InfluxDBHelperConfig InfluxDBHelper配置

func NewInfluxDBHelperConfig

func NewInfluxDBHelperConfig() *InfluxDBHelperConfig

NewInfluxDBHelperConfig 实例化InfluxDBHelpConfig默认配置

type JSONRPCError

type JSONRPCError struct {
	Code    int                 `json:"code"`
	Message string              `json:"message"`
	Data    jsoniter.RawMessage `json:"data,omitempty"`
}

func (*JSONRPCError) Error

func (err *JSONRPCError) Error() string

type JSONRPCNotification

type JSONRPCNotification struct {
	Version string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
}

type JSONRPCRequest

type JSONRPCRequest struct {
	ID      int64       `json:"id"`
	Version string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
}

func NewJSONRPCRequest

func NewJSONRPCRequest(method string, obj interface{}, args ...interface{}) *JSONRPCRequest

func (*JSONRPCRequest) ToFastHTTPRequest

func (req *JSONRPCRequest) ToFastHTTPRequest(url string, r *fasthttp.Request) error

func (*JSONRPCRequest) ToHTTPRequest

func (req *JSONRPCRequest) ToHTTPRequest(url string) (*http.Request, error)

type JSONRPCResponse

type JSONRPCResponse struct {
	ID     int                 `json:"id,omitempty"`
	Result jsoniter.RawMessage `json:"result,omitempty"`
	Error  *JSONRPCError       `json:"error,omitempty"`
}

func (*JSONRPCResponse) GetError

func (res *JSONRPCResponse) GetError() error

func (*JSONRPCResponse) HasError

func (res *JSONRPCResponse) HasError() bool

Jump to

Keyboard shortcuts

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