File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,11 @@ const (
6060func (reason TruncationReason ) String () string {
6161 switch reason {
6262 case ObjectTooDeep :
63- return "depth "
63+ return "container_depth "
6464 case ContainerTooLarge :
65- return "container-size "
65+ return "container_size "
6666 case StringTooLong :
67- return "string-size "
67+ return "string_length "
6868 default :
6969 return fmt .Sprintf ("TruncationReason(%v)" , int (reason ))
7070 }
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ func (e RunError) Error() string {
5252 return description
5353}
5454
55+ // ToWafErrorCode converts an error to a WAF error code, returns zero if the error is not a WAF run error.
56+ func ToWafErrorCode (in error ) int {
57+ var runError RunError
58+ if ! errors .As (in , & runError ) {
59+ return 0
60+ }
61+ return int (runError )
62+ }
63+
5564// PanicError is an error type wrapping a recovered panic value that happened
5665// during a function call. Such error must be considered unrecoverable and be
5766// used to try to gracefully abort. Keeping using this package after such an
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ const (
5858 wafDecodeTag = "decode"
5959 wafTimeoutTag = "timeouts"
6060 wafTruncationTag = "truncations"
61+ raspTimeoutTag = "timeout"
6162)
6263
6364func dot (parts ... string ) string {
@@ -77,7 +78,7 @@ func (stats Stats) Metrics() map[string]any {
7778 }
7879
7980 if stats .TimeoutRASPCount > 0 {
80- tags [dot (string (RASPScope ), wafTimeoutTag )] = stats .TimeoutRASPCount
81+ tags [dot (string (RASPScope ), raspTimeoutTag )] = stats .TimeoutRASPCount
8182 }
8283
8384 for reason , list := range stats .Truncations {
You can’t perform that action at this time.
0 commit comments