Documentation ¶
Overview ¶
Package client implements a gRPC client implementation that satisfies the PiServiceClient interface requirements with optional OpenTelemetry metrics and traces.
Index ¶
Constants ¶
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 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.