Skip to content

Commit

Permalink
fixup! feat: Make net_(tcp|udp) read limit configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Pranshu Srivastava <[email protected]>
  • Loading branch information
rexagod committed May 13, 2024
1 parent 7409825 commit d7eefc8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions fs_statfs_notype.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package procfs

// isRealProc returns true on architectures that don't have a Type argument
// in their Statfs_t struct
func isRealProc(mountPoint string) (bool, error) {
// in their Statfs_t struct.
func isRealProc(_ string) (bool, error) {
return true, nil
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ require (
github.com/google/go-cmp v0.6.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
4 changes: 1 addition & 3 deletions net_ip_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"os"
"strconv"
"strings"

"k8s.io/utils/ptr"
)

var (
Expand All @@ -33,7 +31,7 @@ var (
// In theory, the number of available sockets is 65535 (2^16 - 1) per IP.
// With e.g. 150 Byte per line and the maximum number of 65535,
// the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP.
defaultReadLimit = ptr.To(4294967296) // Byte -> 4 GiB
defaultReadLimit = ptrTo(4294967296) // Byte -> 4 GiB
)

// This contains generic data structures for both udp and tcp sockets.
Expand Down
19 changes: 19 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package procfs

// To returns a pointer to the given value.
func ptrTo[T any](v T) *T {
return &v
}

0 comments on commit d7eefc8

Please sign in to comment.