tracing

package
v0.0.0-...-eb215bf Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Package name used as instrumentation ID
	PackageName = "goctopus.sdk.spot.websocket"
	// Package version
	PackageVersion = "0.0.0"
	// Span & events namespace
	TracesNamespace = "goctopus.spot.websocket"
)

Variables

This section is empty.

Functions

func HandleAndTraLogError

func HandleAndTraLogError(span trace.Span, logger *log.Logger, err error) error

A helper function to trace and log an error (if any), set the provided span status accordingly and return the input error.

The function is meant to replace code blocks like this:

if err != nil {
	logger.Println(err)
	span.RecordError(err)
	span.SetStatus(codes.Error, codes.Error.String())
	return err
}
span.SetStatus(codes.Ok, codes.Ok.String())
return nil

By this:

return HandleAndTraLogError(span, err)

func HandleAndTraceError

func HandleAndTraceError(span trace.Span, err error) error

A helper function to trace an error (if any), set the provided span status accordingly and return the input error.

The function is meant to replace code blocks like this:

if err != nil {
	span.RecordError(err)
	span.SetStatus(codes.Error, codes.Error.String())
	return err
}
span.SetStatus(codes.Ok, codes.Ok.String())
return nil

By this:

return HandleAndTraceError(span, err)

func TraceErrorAndSetStatus

func TraceErrorAndSetStatus(span trace.Span, err error)

A helper function to trace an error (if any) and set the provided span status accordingly.

The function is meant to replace code blocks like this:

if err != nil {
	span.RecordError(err)
	span.SetStatus(codes.Error, codes.Error.String())
} else {
	span.SetStatus(codes.Ok, codes.Ok.String())
}

By this:

TraceErrorAndSetStatus(span, err)

Types

This section is empty.

Jump to

Keyboard shortcuts

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