utils

package
v0.0.0-...-e70f483 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package utils are utilities for system-probe

Index

Constants

View Source
const (
	// CompactOutput indicates that the output should be compact (no indentation).
	CompactOutput = false
	// PrettyPrint indicates that the output should be pretty-printed (with indentation).
	PrettyPrint = true
)
View Source
const DefaultMaxConcurrentRequests = 2

DefaultMaxConcurrentRequests determines the maximum number of requests in-flight for a given handler We choose 2 because one is for regular agent checks and another one is for manual troubleshooting

View Source
const (
	// PrettyPrintQueryParam is the query parameter used to request pretty-printed JSON output
	PrettyPrintQueryParam = "pretty_print"
)

Variables

This section is empty.

Functions

func GetClientID

func GetClientID(req *http.Request) string

GetClientID gets client provided in the http request, defaulting to -1

func WithConcurrencyLimit

func WithConcurrencyLimit(limit int, original func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

WithConcurrencyLimit enforces a maximum number of concurrent requests over a certain HTTP handler function

func WriteAsJSON

func WriteAsJSON(req *http.Request, w http.ResponseWriter, data any, outputOptions FormatOptions)

WriteAsJSON marshals the give data argument into JSON and writes it to the `http.ResponseWriter`

Types

type FormatOptions

type FormatOptions bool

FormatOptions represents formatting options for WriteAsJson.

func GetPrettyPrintFromQueryParams

func GetPrettyPrintFromQueryParams(req *http.Request) FormatOptions

GetPrettyPrintFromQueryParams returns true if the pretty_print query parameter is set to "true" in the request URL

type MemoryMonitor

type MemoryMonitor = memorymonitor.MemoryController

MemoryMonitor monitors cgroups' memory usage

func NewMemoryMonitor

func NewMemoryMonitor(kind string, containerized bool, pressureLevels map[string]string, thresholds map[string]string) (*MemoryMonitor, error)

NewMemoryMonitor instantiates a new memory monitor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL