profiler

package
v0.10.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFunctionCallDetails

func AddFunctionCallDetails(ctx context.Context, details FunctionCallDetails)

func IntoContext

func IntoContext(ctx context.Context, functionCallDetails *FunctionCallDetailsList) context.Context

IntoContext returns a new context with the provided FunctionCallDetails instance. If the context already contains the same FunctionCallDetails instance, it returns the original context. Otherwise, it associates the provided FunctionCallDetails instance with the context.

Parameters:

ctx - The original context.
functionCallDetails - The FunctionCallDetails instance to associate with the context.

Returns:

A new context with the FunctionCallDetails instance, or the original context if it already contains the same FunctionCallDetails instance.

func StopProfiler

func StopProfiler() error

Types

type FunctionCallDetails

type FunctionCallDetails struct {
	Package              string `json:"package" yaml:"package" docs:"The package where the function exists."`
	FileName             string `json:"fileName" yaml:"fileName" docs:"The file where the function exists."`
	Name                 string `json:"name" yaml:"name" docs:"The name of the function."`
	DurationMilliseconds int64  `json:"durationMilliseconds" yaml:"durationMilliseconds" docs:"The duration of the function execution in milliseconds."`
}

type FunctionCallDetailsList

type FunctionCallDetailsList []FunctionCallDetails

func FunctionCallDetailsFromCtx

func FunctionCallDetailsFromCtx(ctx context.Context) *FunctionCallDetailsList

FunctionCallDetailsFromCtx retrieves the FunctionCallDetails instance from the provided context. It first attempts to extract FunctionCallDetails from the context using profilerContextKey. If FunctionCallDetails is not found in the context, it falls back to the global functionCallDetails variable. Returns a pointer to FunctionCallDetails if found, otherwise returns nil.

Parameters:

ctx - The context from which to retrieve FunctionCallDetails.

Returns:

*FunctionCallDetails - A pointer to FunctionCallDetails if found, otherwise nil.

func (*FunctionCallDetailsList) ToMap

func (fcd *FunctionCallDetailsList) ToMap() []map[string]interface{}

type Proxy

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

func GetProfiler

func GetProfiler(profileType, path string, lgr *logr.Logger) (*Proxy, error)

func (*Proxy) Start

func (p *Proxy) Start(lgr *logr.Logger) error

func (*Proxy) Stop

func (p *Proxy) Stop(lgr *logr.Logger) error

Jump to

Keyboard shortcuts

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