client

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client sends RPC calls to a remote service.

func New

func New(opts Options) (*Client, error)

New creates a new client.

func (*Client) RoundTrip

func (c *Client) RoundTrip(ctx context.Context, method ctypes.Method, req any, respObj any) error

RoundTrip sends one RPC request and decodes response into respObj.

type IHttpClient

type IHttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

IHttpClient is a minimal HTTP client interface.

type OptOptionsSetter

type OptOptionsSetter func(o *Options)

func WithHttpClient

func WithHttpClient(opt IHttpClient) OptOptionsSetter

func WithLogger

func WithLogger(opt *slog.Logger) OptOptionsSetter

func WithName

func WithName(opt string) OptOptionsSetter

The client name that used by instrumentation.

func WithPropagator

func WithPropagator(opt Propagator) OptOptionsSetter

func WithServiceToken

func WithServiceToken(opt string) OptOptionsSetter

func WithServiceUrl

func WithServiceUrl(opt string) OptOptionsSetter

func WithTracerProvider

func WithTracerProvider(opt TracerProvider) OptOptionsSetter

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options configures the client.

func NewOptions

func NewOptions(
	options ...OptOptionsSetter,
) Options

func (*Options) Validate

func (o *Options) Validate() error

type Payload

type Payload struct {
	ID      ctypes.ID `json:"id"`
	Version string    `json:"lrpc"` //nolint:tagliatelle
	Params  any       `json:"params"`
}

Payload is the request body sent by client.

type Propagator

type Propagator = interface {
	Inject(ctx context.Context, headers http.Header)
}

Propagator injects trace headers into outgoing requests.

type Span

type Span = internalobs.Span

Span represents an active trace span.

type Tracer

type Tracer = internalobs.Tracer

Tracer starts spans.

type TracerProvider

type TracerProvider = internalobs.TracerProvider

TracerProvider creates tracers.

Jump to

Keyboard shortcuts

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