util

package
v0.0.0-...-0f01a6b Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package util provides internal utility functions for logs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServiceNameFromTags

func ServiceNameFromTags(ctrName string, taggerEntity taggertypes.EntityID, taggerFunc func(entity taggertypes.EntityID) ([]string, error)) string

ServiceNameFromTags returns the standard tag 'service' corresponding to a container It returns an empty string if tag not found

Types

type MovingSum

type MovingSum struct {
	// contains filtered or unexported fields
}

MovingSum is a time-based moving sum that uses buckets to calculate the sum over a specified window.

func NewMovingSum

func NewMovingSum(timeWindow time.Duration, bucketSize time.Duration, clock clock.Clock) *MovingSum

NewMovingSum creates a new MovingSum with the specified time window, bucket size, and clock.

func (*MovingSum) Add

func (ms *MovingSum) Add(byteValue int64)

Add adds a byte value to the MovingSum, creating a new bucket if necessary.

func (*MovingSum) Info

func (ms *MovingSum) Info() []string

Info returns the moving sum as a formatted string slice.

func (*MovingSum) InfoKey

func (ms *MovingSum) InfoKey() string

InfoKey returns a string representing the key for the moving sum.

func (*MovingSum) MovingSum

func (ms *MovingSum) MovingSum() int64

MovingSum returns the current sum over the specified time window.

Directories

Path Synopsis
Package adlistener provides autodiscovery event listener utilities
Package adlistener provides autodiscovery event listener utilities
Package containersorpods provides logic to choose between logging containers or pods
Package containersorpods provides logic to choose between logging containers or pods
Package opener provides utilities to open log files with appropriate permissions.
Package opener provides utilities to open log files with appropriate permissions.

Jump to

Keyboard shortcuts

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