Versions in this module Expand all Collapse all v0 v0.1.3 Aug 12, 2026 v0.1.2 Aug 12, 2026 v0.1.1 Aug 12, 2026 Changes in this version + const CorrelationIDHeader + const DefaultAPIKeyPrefix + const ParentSpanIDHeader + const RequestIDHeader + const ServiceChainHeader + const SpanIDHeader + const TraceIDHeader + const TraceparentHeader + const UserIDHeader + func ContextWithTrace(ctx context.Context, trace *TraceContext) context.Context + type CircuitBreaker struct + func NewCircuitBreaker(maxFailures int, resetTimeout time.Duration) *CircuitBreaker + func (cb *CircuitBreaker) CanExecute() bool + func (cb *CircuitBreaker) RecordFailure() + func (cb *CircuitBreaker) RecordSuccess() + type CircuitBreakerState int + const CircuitClosed + const CircuitHalfOpen + const CircuitOpen + type Client struct + func NewClient(config Config) *Client + func NewServiceClient(baseURL, serviceName, authToken string) *Client + func (c *Client) Delete(ctx context.Context, path string) (*Response, error) + func (c *Client) Do(ctx context.Context, req Request) (*Response, error) + func (c *Client) Get(ctx context.Context, path string, queryParams map[string]string) (*Response, error) + func (c *Client) GetBaseURL() string + func (c *Client) GetCircuitBreakerState() CircuitBreakerState + func (c *Client) GetServiceName() string + func (c *Client) HealthCheck(ctx context.Context) error + func (c *Client) Post(ctx context.Context, path string, body any) (*Response, error) + func (c *Client) Put(ctx context.Context, path string, body any) (*Response, error) + func (c *Client) UpdateAuthToken(token string) + type Config struct + APIKeyPrefix string + AuthToken string + BaseURL string + CircuitBreaker *CircuitBreaker + Headers map[string]string + RetryConfig *RetryConfig + ServiceName string + TargetServiceName string + Timeout time.Duration + type HTTPClientMetrics struct + func NewHTTPClientMetrics(serviceName, targetService string) *HTTPClientMetrics + func (m *HTTPClientMetrics) RecordCircuitBreakerState(state CircuitBreakerState) + func (m *HTTPClientMetrics) RecordError(errorType string) + func (m *HTTPClientMetrics) RecordRequest(method string, statusCode int, duration time.Duration) + func (m *HTTPClientMetrics) RecordRetryAttempt(reason string) + type Request struct + Body any + Headers map[string]string + Method string + Path string + QueryParams map[string]string + type Response struct + Body []byte + Headers http.Header + StatusCode int + TraceContext *TraceContext + func (r *Response) DecodeJSON(v any) error + func (r *Response) GetError() error + func (r *Response) IsSuccess() bool + type RetryConfig struct + InitialWait time.Duration + MaxRetries int + MaxWait time.Duration + Multiplier float64 + func DefaultRetryConfig() RetryConfig + type TraceContext struct + CorrelationID string + ParentSpanID string + RequestID string + ServiceChain []string + SpanID string + TraceID string + UserID string + func NewTraceContext(ctx context.Context) *TraceContext + func TraceContextFromHeaders(headers http.Header) *TraceContext + func TraceFromContext(ctx context.Context) *TraceContext + func (tc *TraceContext) AddToServiceChain(serviceName string) + func (tc *TraceContext) ToHeaders() map[string]string + func (tc *TraceContext) Traceparent() string