client

package
v2.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package client implements a gRPC client implementation that satisfies the PiServiceClient interface requirements with optional OpenTelemetry metrics and traces.

Index

Constants

View Source
const (
	// The default maximum timeout that will be applied to requests.
	DefaultMaxTimeout = 10 * time.Second
	// The default name to use when registering OpenTelemetry components.
	DefaultOpenTelemetryClientName = "pkg.client"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PiClient

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

Implements the PiServiceClient interface.

func NewPiClient

func NewPiClient(options ...PiClientOption) (*PiClient, error)

Create a new PiClient with optional settings.

func (*PiClient) FetchDigit

func (c *PiClient) FetchDigit(ctx context.Context, conn *grpc.ClientConn, index uint64) (uint32, error)

Initiate a gRPC connection to the endpoint and retrieve a single fractional decimal digit of pi at the zero-based index.

type PiClientOption

type PiClientOption func(*PiClient)

Defines a function signature for PiClient options.

func WithLogger

func WithLogger(logger logr.Logger) PiClientOption

Use the supplied logr.logger.

func WithMaxTimeout

func WithMaxTimeout(maxTimeout time.Duration) PiClientOption

Set the maximum timeout for client requests to a PiService.

func WithMeter

func WithMeter(meter metric.Meter) PiClientOption

Add an OpenTelemetry metric meter implementation to the PiService client.

func WithPrefix

func WithPrefix(prefix string) PiClientOption

Set the prefix to use for OpenTelemetry metrics.

func WithTracer

func WithTracer(tracer trace.Tracer) PiClientOption

Add an OpenTelemetry tracer implementation to the PiService client.

Jump to

Keyboard shortcuts

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