Documentation ¶
Index ¶
- Constants
- func EmbedNamedPositionArgs(stringObject string, args ...string) string
- func GenerateNewTraceparent(sampled bool) (string, error)
- func GenerateParentId() (string, error)
- func GenerateParentIdRaw() ([]byte, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateTraceId() (string, error)
- func GenerateTraceIdRaw() ([]byte, error)
- func ParseTraceparent(traceparent string) (string, string, string, string, error)
- func ParseTraceparentRaw(traceparent string) ([]byte, []byte, []byte, []byte, error)
- func ValidateParentIdValue(parentId []byte) error
- func ValidateTraceIdValue(traceId []byte) error
- type AuthProvider
- type Client
- type ClientOptions
- type TracedClient
Constants ¶
View Source
const ( INVALID_VALUE_COUNT = "invalid number of values" VERSION_INVALID_LENGTH = "invalid version length" TRACEID_INVALID_LENGTH = "invalid traceid length" PARENTID_INVALID_LENGTH = "invalid parentid length" FLAG_INVALID_LENGTH = "invalid flag length" TRACEID_IS_ZERO = "error traceid value is zero" PARENTID_IS_ZERO = "error parentid value is zero" )
Variables ¶
This section is empty.
Functions ¶
func EmbedNamedPositionArgs ¶ added in v0.3.1
func GenerateNewTraceparent ¶
func GenerateParentId ¶
Counting on go compiler to inline these plsplspls :)
func GenerateParentIdRaw ¶
func GenerateRandomBytes ¶
func GenerateTraceId ¶
func GenerateTraceIdRaw ¶
func ParseTraceparent ¶
func ParseTraceparentRaw ¶
func ValidateParentIdValue ¶
func ValidateTraceIdValue ¶
Types ¶
type AuthProvider ¶
type AuthProvider interface {
GetAuthHeader() string
}
type Client ¶
type Client interface { Get(ctx context.Context, Url string, opt *ClientOptions, dest interface{}) (int, error) Put(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Del(ctx context.Context, Url string, opt *ClientOptions, dest interface{}) (int, error) Post(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Patch(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Invoke(ctx context.Context, method string, url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) // doRequest(ctx context.Context, opt *ClientOptions, body interface{}, dest interface{}) (int, error) SetAuthHandler(provider AuthProvider) WithLogger(l *zap.Logger) Client WithTracer(t *appinsightstrace.AppInsightsCore) Client }
func ClientProvider ¶
ClientProvider returns a new instance of Client This is a constructor function params:
- none
returns:
- Client
- error
type ClientOptions ¶
type ClientOptions struct { Authorization string `json:"authorization"` ContentType string `json:"content_type"` Query string `json:"query"` Headers *map[string]string `json:"headers"` Timeout *time.Time `json:"timeout"` RequestType string `json:"request_type"` PositionalArgs []string // contains filtered or unexported fields }
ClientOptions is a struct that contains the options for the http client Parameters:
Authorization: The authorization header ContentType: The content type of the request Query: The query string Headers: The headers to be sent with the request Timeout: The timeout for the request RequestType: The type of request to be made PositionalArgs: The positional arguments to be sent with the request
type TracedClient ¶
type TracedClient interface { Get(ctx context.Context, Url string, opt *ClientOptions, dest interface{}) (int, error) Put(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Del(ctx context.Context, Url string, opt *ClientOptions, dest interface{}) (int, error) Post(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Patch(ctx context.Context, Url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) Invoke(ctx context.Context, method string, url string, opt *ClientOptions, body interface{}, dest interface{}) (int, error) // doRequest(ctx context.Context, opt *ClientOptions, body interface{}, dest interface{}) (int, error) SetAuthHandler(provider AuthProvider) WithTransport(transport http.Transport) TracedClient WithStandardTransport() TracedClient WithClientName(clientName string) TracedClient Close() }
func TracedClientProvider ¶
func TracedClientProvider( t *tracer.AppInsightsCore, l *zap.Logger, ) TracedClient
TracedClientProvider returns a new instance of the TracedClient Params:
- t: The tracer to be used check the tracer package for more details at https://github.com/BetaLixT/appInsightsTrace
- l: The zap logger to be used
Returns:
- TracedClient: The TracedClient instance
func TracedClientProviderWithName ¶
func TracedClientProviderWithName( t *tracer.AppInsightsCore, l *zap.Logger, clientName string, ) TracedClient
TracedClientProviderWithName returns a new instance of the TracedClient Params:
- t: The tracer to be used check the tracer package for more details at
- l: The zap logger to be used
- clientName: The name of the client
Returns:
- TracedClient: The TracedClient instance
Click to show internal directories.
Click to hide internal directories.