metrics

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Metrics

Tool used primarily for development, to help triage bottlenecks experience during codegen

This tool was introduced when working on optimizations to codegen and has been preserved for use in future development

MeasureElapsed

A convenient way to measure how long an operation took to run:

func longRunningOperation() {
    defer metrics.MeasureElapsed("long-running-operation", time.Now())

    ...
}
IncrementFrequency

A convenient way to count the number of times an operation is run:

func frequentOperation() {
    metrics.IncrementFrequency("frequent-operation")

    ...
}
Flush

A way to flush the aggregate metrics at the end of a run:

func confusingWorkflow() {
    ...

    metrics.Flush(os.Stdout)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flush

func Flush(writer io.Writer) error

func IncrementFrequency

func IncrementFrequency(key string)

func MeasureElapsed

func MeasureElapsed(key string, startTime time.Time)

func NewAggregator

func NewAggregator()

Types

This section is empty.

Jump to

Keyboard shortcuts

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