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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Package name used as instrumentation ID
	PackageName = "goctopus_sdk_spot_rest"
	// Package version
	PackageVersion = "0.0.0"
	// Span & events namespace
	TracesNamespace = "goctopus.spot.rest"
	// Kraken Sport REST API tracing header
	ResponseTracingHeader = "X-Trace-Id"
)

Variables

This section is empty.

Functions

func TraceApiOperationAndSetStatus

func TraceApiOperationAndSetStatus(span trace.Span, apiresp *common.KrakenSpotRESTResponse, httpresp *http.Response, err error)

Description

Helper function which handles the common tracing logic for the API operations outcome. The function will set the provided span status depending the API operation outcome.

Inputs

  • span: Span to populate
  • apiresp: Parsed API response. Can be nil and shoud be nil in case of error.
  • apiresp: Received HTTP response. Can be nil and might not be nil in case of error.
  • error: Error returned by the API operation. Can be nil in case of success.

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 emant 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