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 ¶
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.
Click to show internal directories.
Click to hide internal directories.