Documentation ¶
Overview ¶
Client provides an API client to the petstore service.
Index ¶
- type CallOption
- type Client
- func (c *Client) AddPets(ctx context.Context, pets []*pb.Pet, options ...CallOption) ([]string, error)
- func (c *Client) ChangeSampler(ctx context.Context, sc Sampler, options ...CallOption) error
- func (c *Client) DeletePets(ctx context.Context, ids []string, options ...CallOption) error
- func (c *Client) SearchPets(ctx context.Context, filter *pb.SearchPetsReq, options ...CallOption) (chan Pet, error)
- func (c *Client) UpdatePets(ctx context.Context, pets []*pb.Pet, options ...CallOption) error
- type Pet
- type Sampler
- type SamplerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption func(co *callOptions)
CallOptions are optional options for an RPC call.
func TraceID ¶
func TraceID(s *string) CallOption
TraceID will cause the RPC call to execute a trace on the service and return "s" to the ID. If s == nil, this will ignore the option. If "s" is not set after the call finishes, then no trace was made.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client to the petstore service.
func (*Client) AddPets ¶
func (c *Client) AddPets(ctx context.Context, pets []*pb.Pet, options ...CallOption) ([]string, error)
AddPets adds pets to the service and returns their unique identities in the same order as being added.
func (*Client) ChangeSampler ¶
ChangeSampler changes the sampling type and rate on the server. This is and admin function that in production should be restricted.
func (*Client) DeletePets ¶
DeletePets deletes pets with the IDs passed. If the ID doesn't exist, the system ignores it.
func (*Client) SearchPets ¶
func (c *Client) SearchPets(ctx context.Context, filter *pb.SearchPetsReq, options ...CallOption) (chan Pet, error)
SearchPets searches the pet store for pets matching the filter. If the filter contains no entries, then all pets will be returned.
func (*Client) UpdatePets ¶
UpdatePets updates pets that already exist in the system.
type Pet ¶
Pet is a wrapper around a *pb.Pet that can return Go versions of fields and errors if the returned stream has an error.
type Sampler ¶
type Sampler struct { // Type is the type of sampling to use. Type SamplerType // Rate is the sampling rate, only used if type is Float. Rate float64 }
type SamplerType ¶
type SamplerType int32
SamplerType is the type of OTEL sampling to do.
const ( STUnknown SamplerType = 0 Never SamplerType = 1 Always SamplerType = 2 Float SamplerType = 3 )