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 )
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
server/errors
Package errors is a replacement for the golang standard library "errors".
|
Package errors is a replacement for the golang standard library "errors". |
server/log
Package log is a replacement for the standard library log package that logs to OTEL spans contained in Context objects.
|
Package log is a replacement for the standard library log package that logs to OTEL spans contained in Context objects. |
server/storage/mem
Package mem contains an in-memory storage implementation of storage.Data.
|
Package mem contains an in-memory storage implementation of storage.Data. |
server/telemetry/metrics
Package metrics provides setup of metrics that can be used internally to measure various application states.
|
Package metrics provides setup of metrics that can be used internally to measure various application states. |
server/telemetry/tracing
Package tracing provides functions for starting and stopping our Open Telemetry tracing.
|
Package tracing provides functions for starting and stopping our Open Telemetry tracing. |
server/telemetry/tracing/sampler
Package sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called "trace" and if they exist will sample.
|
Package sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called "trace" and if they exist will sample. |