mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-09 21:38:19 +01:00
s3vectors: integrate bucket metrics, audit events, and request limits (#12514)
* s3vectors: attribute request and traffic metrics to authorized buckets * s3vectors: emit resource and identity audit events * s3vectors: apply existing S3 request limits and preserve JSON errors * s3vectors: select limit resources by the dispatched operation * s3vectors: count decoded chunked request bodies against byte limits
This commit is contained in:
1 parent
620a1c3f39
commit
84cd3c621b
10 files changed
+484
-10
No files matched your search
@@ -145,7 +145,16 @@ func getResourceType(object string, query_key string, method string) (string, bo
|
||||
}
|
||||
}
|
||||
|
||||
type accessLogOperationKey struct{}
|
||||
|
||||
func WithAccessLogOperation(r *http.Request, operation string) *http.Request {
|
||||
return r.WithContext(context.WithValue(r.Context(), accessLogOperationKey{}, operation))
|
||||
}
|
||||
|
||||
func getOperation(object string, r *http.Request) string {
|
||||
if operation, ok := r.Context().Value(accessLogOperationKey{}).(string); ok {
|
||||
return operation
|
||||
}
|
||||
queries := r.URL.Query()
|
||||
var operation string
|
||||
var queryFound bool
|
||||
@@ -210,7 +219,7 @@ func PostLog(r *http.Request, HTTPStatusCode int, errorCode ErrorCode) {
|
||||
}
|
||||
|
||||
func PostAccessLog(log AccessLog) {
|
||||
if Logger == nil || len(log.Key) == 0 {
|
||||
if Logger == nil {
|
||||
return
|
||||
}
|
||||
if err := Logger.Post(tag, log); err != nil {
|
||||
|
||||
Reference in new issue
Block a user