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{}