| 2046 | } |
| 2047 | |
| 2048 | func collectContextLimitValues(value any, onValue func(int64)) { |
| 2049 | switch typed := value.(type) { |
| 2050 | case map[string]any: |
| 2051 | for key, child := range typed { |
| 2052 | if isContextLimitKey(key) { |
| 2053 | if numeric, ok := numericContextLimitValue(child); ok { |
| 2054 | onValue(numeric) |
| 2055 | } |
| 2056 | } |
| 2057 | collectContextLimitValues(child, onValue) |
| 2058 | } |
| 2059 | case []any: |
| 2060 | for _, child := range typed { |
| 2061 | collectContextLimitValues(child, onValue) |
| 2062 | } |
| 2063 | } |
| 2064 | } |
| 2065 | |
| 2066 | func isContextLimitKey(key string) bool { |
| 2067 | normalized := normalizeMetadataKey(key) |