httpclient

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package httpclient provides a shared resty HTTP client factory with optional OpenTelemetry tracing. OTel transport instrumentation activates only when OTEL_EXPORTER_OTLP_ENDPOINT is set and OTEL_SDK_DISABLED is not true, aligned with the global tracer provider in package observability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *resty.Client

New creates a resty client with the default 30s timeout and optional OTel transport instrumentation.

func NewWithTimeout

func NewWithTimeout(timeout time.Duration) *resty.Client

NewWithTimeout creates a resty client with a custom timeout and optional OTel transport instrumentation.

func StdHTTPClient

func StdHTTPClient() *http.Client

StdHTTPClient returns a standard *http.Client with optional OTel transport instrumentation. No timeout is set because this client is used for SSE/streaming requests where the context deadline controls cancellation. When enabled, otelhttp resolves the TracerProvider from the request context at call time (not construction time), so it works regardless of init order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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