Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BodyPlaceHolder = []byte("<BODY>")
BodyPlaceHolder returns a dummy body placeholder
Functions ¶
This section is empty.
Types ¶
type APIStatsSys ¶
type APIStatsSys struct {
Db objmetadb.ObjStoreMetaDBAPI
HttpStats *HTTPStats
ObjectInfo *ObjectInfo
}
func NewHttpStatsSys ¶
func NewHttpStatsSys(db objmetadb.ObjStoreMetaDBAPI) *APIStatsSys
NewHttpStatsSys - new an HttpStats system
func (*APIStatsSys) GetCurrentStats ¶
func (st *APIStatsSys) GetCurrentStats(ctx context.Context) (StatsResp, error)
func (*APIStatsSys) RecordAPIHandler ¶
func (st *APIStatsSys) RecordAPIHandler(api string, f http.HandlerFunc) http.HandlerFunc
func (*APIStatsSys) StoreApiLog ¶
func (st *APIStatsSys) StoreApiLog(ctx context.Context)
type HTTPAPIStats ¶
HTTPAPIStats holds statistics information about a given API in the requests.
type ObjectInfo ¶
type ResponseRecorder ¶
type ResponseRecorder struct {
http.ResponseWriter
StatusCode int
// Log body of 4xx or 5xx responses
LogErrBody bool
// Log body of all responses
LogAllBody bool
TimeToFirstByte time.Duration
StartTime time.Time
// contains filtered or unexported fields
}
ResponseRecorder - is a wrapper to trap the http response status code and to record the response body
func NewResponseRecorder ¶
func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder
NewResponseRecorder - returns a wrapped response writer to trap http status codes for auditing purposes.
func (*ResponseRecorder) Body ¶
func (lrw *ResponseRecorder) Body() []byte
Body - Return response body.
func (*ResponseRecorder) Flush ¶
func (lrw *ResponseRecorder) Flush()
Flush - Calls the underlying Flush.
func (*ResponseRecorder) HeaderSize ¶
func (lrw *ResponseRecorder) HeaderSize() int
HeaderSize - returns the number of bytes of response headers written
func (*ResponseRecorder) Size ¶
func (lrw *ResponseRecorder) Size() int
Size - returns the number of bytes written
func (*ResponseRecorder) WriteHeader ¶
func (lrw *ResponseRecorder) WriteHeader(code int)
WriteHeader - writes http status code
type StatsResp ¶
type StatsResp struct {
//CurrentS3Requests ApiStats `json:"current_s3_requests"`
//CurrentIamRequests ApiStats `json:"current_iam_requests"`
//TotalIamRequests ApiStats `json:"total_iam_requests"`
//TotalIamErrors ApiStats `json:"total_iam_errors"`
//TotalIam4xxErrors ApiStats `json:"total_iam_4xx_errors"`
//TotalIam5xxErrors ApiStats `json:"total_iam_5xx_errors"`
//TotalIamCanceled ApiStats `json:"total_iam_canceled"`
//TotalS3Requests ApiStats `json:"total_s3_requests"`
//TotalS3Errors ApiStats `json:"total_s3_errors"`
//TotalS34xxErrors ApiStats `json:"total_s3_4xx_errors"`
//TotalS35xxErrors ApiStats `json:"total_s3_5xx_errors"`
//TotalS3Canceled ApiStats `json:"total_s3_canceled"`
PutObjCount []ApiStats `json:"put_obj_count"`
GetObjCount []ApiStats `json:"get_obj_count"`
PutObjBytes []ApiStats `json:"put_obj_bytes"`
GetObjBytes []ApiStats `json:"get_obj_bytes"`
PutObjBytesAll uint64 `json:"put_obj_bytes_all"`
GetObjBytesAll uint64 `json:"get_obj_bytes_all"`
}
StatsResp holds statistics information about HTTP requests made by all clients