uplog

package
v7.25.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTypeRequest                  LogType      = "request"
	LogTypeBlock                    LogType      = "block"
	LogTypeQuality                  LogType      = "quality"
	LogTypeTransaction              LogType      = "transaction"
	APITypeKodo                     APIType      = "kodo"
	ErrorTypeUnknownError           ErrorType    = "unknown_error"
	ErrorTypeTimeout                ErrorType    = "timeout"
	ErrorTypeUnknownHost            ErrorType    = "unknown_host"
	ErrorTypeMaliciousResponse      ErrorType    = "malicious_response"
	ErrorTypeCannotConnectToHost    ErrorType    = "cannot_connect_to_host"
	ErrorTypeSSLError               ErrorType    = "ssl_error"
	ErrorTypeTransmissionError      ErrorType    = "transmission_error"
	ErrorTypeProtocolError          ErrorType    = "protocol_error"
	ErrorTypeResponseError          ErrorType    = "response_error"
	ErrorTypeUserCanceled           ErrorType    = "user_canceled"
	ErrorTypeLocalIoError           ErrorType    = "local_io_error"
	ErrorTypeUnexpectedSyscallError ErrorType    = "unexpected_syscall_error"
	UpApiVersionV1                  UpApiVersion = 1
	UpApiVersionV2                  UpApiVersion = 2
	UpTypeForm                      UpType       = "form"
	UpTypeResumableV1               UpType       = "resumable_v1"
	UpTypeResumableV2               UpType       = "resumable_v2"
	LogResultOK                     LogResult    = "ok"
	LogResultBadRequest             LogResult    = "bad_request"
	LogResultInvalidArgs            LogResult    = "invalid_args"
	LogResultUnknownError           LogResult    = "unknown_error"
	LogResultTimeout                LogResult    = "timeout"
	LogResultUnknownHost            LogResult    = "unknown_host"
	LogResultMaliciousResponse      LogResult    = "malicious_response"
	LogResultCannotConnectToHost    LogResult    = "cannot_connect_to_host"
	LogResultSSLError               LogResult    = "ssl_error"
	LogResultTransmissionError      LogResult    = "transmission_error"
	LogResultProtocolError          LogResult    = "protocol_error"
	LogResultResponseError          LogResult    = "response_error"
	LogResultUserCanceled           LogResult    = "user_canceled"
	LogResultLocalIoError           LogResult    = "local_io_error"
	LogResultUnexpectedSyscallError LogResult    = "unexpected_syscall_error"
)
View Source
const (
	UPLOG_CHANNEL_SIZE       = 1024
	UPLOG_MEMORY_BUFFER_SIZE = 4 * 1024
	UPLOG_FILE_BUFFER_NAME   = "uplog_v4_01.buffer"
	UPLOG_FILE_LOCK_NAME     = "uplog_v4_01.lock"
)
View Source
const (
	X_LOG_CLIENT_ID = "X-Log-Client-Id"
)

Variables

This section is empty.

Functions

func DisableUplog

func DisableUplog()

func EnableUplog

func EnableUplog()

func FlushBuffer

func FlushBuffer() error

func GetUplogMaxStorageBytes

func GetUplogMaxStorageBytes() uint64

func GetUplogUrl

func GetUplogUrl() string

func GetWriteFileBufferInterval

func GetWriteFileBufferInterval() time.Duration

func IsUplogEnabled

func IsUplogEnabled() bool

func SetUplogFileBufferDirPath

func SetUplogFileBufferDirPath(path string)

func SetUplogMaxStorageBytes

func SetUplogMaxStorageBytes(max uint64)

func SetUplogUrl

func SetUplogUrl(url string)

func SetWriteFileBufferInterval

func SetWriteFileBufferInterval(d time.Duration)

func WithBlock

func WithBlock(ctx context.Context, upApiVersion UpApiVersion, fileSize, recoveredFrom uint64, targetBucket, targetKey, upToken string, handle func(context.Context) error) error

func WithQuality

func WithQuality(ctx context.Context, upType UpType, fileSize uint64, targetBucket, targetKey, upToken string, handle func(ctx context.Context, switchRegion func()) error) error

Types

type APIType

type APIType string

type ErrorType

type ErrorType string

type GetUpToken

type GetUpToken func() (string, error)

type LogResult

type LogResult string

type LogType

type LogType string

type RequestUplog

type RequestUplog struct {
	LogType               LogType   `json:"log_type,omitempty"`
	StatusCode            int       `json:"status_code,omitempty"`
	RequestID             string    `json:"req_id,omitempty"`
	Host                  string    `json:"host,omitempty"`
	Port                  uint64    `json:"port,omitempty"`
	RemoteIP              string    `json:"remote_ip,omitempty"`
	Method                string    `json:"method,omitempty"`
	Path                  string    `json:"path,omitempty"`
	APIName               string    `json:"api_name,omitempty"`
	APIType               APIType   `json:"api_type,omitempty"`
	TotalElapsedTime      uint64    `json:"total_elapsed_time,omitempty"`
	DNSElapsedTime        uint64    `json:"dns_elapsed_time,omitempty"`
	ConnectElapsedTime    uint64    `json:"connect_elapsed_time,omitempty"`
	TLSConnectElapsedTime uint64    `json:"tls_connect_elapsed_time,omitempty"`
	RequestElapsedTime    uint64    `json:"request_elapsed_time,omitempty"`
	WaitElapsedTime       uint64    `json:"wait_elapsed_time,omitempty"`
	ResponseElapsedTime   uint64    `json:"response_elapsed_time,omitempty"`
	BytesTotal            int64     `json:"bytes_total,omitempty"`
	BytesSent             int64     `json:"bytes_sent,omitempty"`
	BytesReceived         int64     `json:"bytes_received,omitempty"`
	TargetBucket          string    `json:"target_bucket,omitempty"`
	TargetKey             string    `json:"target_key,omitempty"`
	ErrorType             ErrorType `json:"error_type,omitempty"`
	ErrorDescription      string    `json:"error_description,omitempty"`
	OSName                string    `json:"os_name,omitempty"`
	OSVersion             string    `json:"os_version,omitempty"`
	OSArch                string    `json:"os_arch,omitempty"`
	SDKName               string    `json:"sdk_name,omitempty"`
	SDKVersion            string    `json:"sdk_version,omitempty"`
	HTTPClient            string    `json:"http_client,omitempty"`
	HTTPClientVersion     string    `json:"http_client_version,omitempty"`
	UpTime                int64     `json:"up_time,omitempty"`
	HTTPVersion           string    `json:"http_version,omitempty"`
	Pid                   int       `json:"pid,omitempty"`
	PerceptiveSpeed       int64     `json:"perceptive_speed,omitempty"`
	// contains filtered or unexported fields
}

func NewRequestUplog

func NewRequestUplog(apiName, targetBucket, targetKey string, getUpToken GetUpToken) (*RequestUplog, error)

func (*RequestUplog) Intercept

func (uplog *RequestUplog) Intercept(req *http.Request, handler clientv2.Handler) (resp *http.Response, err error)

func (*RequestUplog) Priority

func (uplog *RequestUplog) Priority() clientv2.InterceptorPriority

type UpApiVersion

type UpApiVersion uint8

type UpType

type UpType string

Jump to

Keyboard shortcuts

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