Documentation ¶
Overview ¶
Package client implements a gRPC client implementation that satisfies the PiServiceClient interface requirements with optional OpenTelemetry metrics and traces.
Index ¶
- Constants
- type PiClient
- type PiClientOption
- func WithAuthority(authority string) PiClientOption
- func WithEndpoint(endpoint string) PiClientOption
- func WithHeaders(headers map[string]string) PiClientOption
- func WithLogger(logger logr.Logger) PiClientOption
- func WithMaxTimeout(maxTimeout time.Duration) PiClientOption
- func WithTransportCredentials(creds credentials.TransportCredentials) PiClientOption
- func WithUserAgent(userAgent string) PiClientOption
Constants ¶
const ( // The default maximum timeout that will be applied to requests. DefaultMaxTimeout = 10 * time.Second // The default name to use when using OpenTelemetry components. OpenTelemetryPackageIdentifier = "pkg.client" // A default round-robin configuration to use with client-side load balancer. DefaultRoundRobinConfig = `{"loadBalancingConfig": [{"round_robin":{}}]}` )
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 ¶
Initiate a gRPC request to Pi Service 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 WithAuthority ¶
func WithAuthority(authority string) PiClientOption
Set the authority string to use for gRPC connections.
func WithEndpoint ¶
func WithEndpoint(endpoint string) PiClientOption
Set the endpoint to use for gRPC connections.
func WithHeaders ¶
func WithHeaders(headers map[string]string) PiClientOption
Add the headers values to the PiService client gRPC metadata.
func WithMaxTimeout ¶
func WithMaxTimeout(maxTimeout time.Duration) PiClientOption
Set the maximum timeout for client requests to a PiService.
func WithTransportCredentials ¶
func WithTransportCredentials(creds credentials.TransportCredentials) PiClientOption
Set the transport credentials to use for PiService gRPC connection.
func WithUserAgent ¶
func WithUserAgent(userAgent string) PiClientOption
Set the user-agent string to use for gRPC connections.