README
¶
Traced Client Wrapper
This package, tracedclient
, is a generated client wrapper for the Linode Client. The code is generated using the tool gowrap
with a specified template for OpenTelemetry instrumentation.
Code generation streamlines development, reduces boilerplate, and enhances consistency. It boosts productivity by automating repetitive tasks, saves time, and simplifies maintenance. It also minimizes errors and enforces standards.
Purpose
-
Instrumentation with OpenTelemetry: The primary purpose of this code is to provide an instrumented version of the Linode COSI driver client with OpenTelemetry spans. This is achieved by adding tracing functionality to various methods in the client.
-
Observability: OpenTelemetry is used for distributed tracing, which helps in observing and understanding how requests propagate through a system, making it easier to identify performance bottlenecks and troubleshoot issues.
Code Generation
The code in this package is generated using the gowrap
tool. To generate the code, you can use the following commands:
-
Using
go generate
:go generate ./...
This command will trigger the
go:generate
directives in the code, causing thegowrap
tool to generate the necessary files.Ensure that you have the
gowrap
tool installed before running the code generation command. -
Using Makefile:
make codegen
The Makefile target will ensure that the
gowrap
tool is installed.
Usage Example
To use the instrumented client:
baseClient := linodeclient.NewLinodeClient(token, ua, apiURL, apiVersion) // Initialize the original Linode client
tracedClient := tracedclient.NewClientWithTracing(baseClient, "instance_id")
Now, tracedClient
can be used just like the original client, with the added benefit of OpenTelemetry tracing.
Links
- gowrap: The
gowrap
tool used for code generation. - OpenTelemetry: OpenTelemetry project for observability and instrumentation.
Documentation
¶
Index ¶
- type ClientWithTracing
- func (_d ClientWithTracing) CreateObjectStorageBucket(ctx context.Context, o1 linodego.ObjectStorageBucketCreateOptions) (op1 *linodego.ObjectStorageBucket, err error)
- func (_d ClientWithTracing) CreateObjectStorageKey(ctx context.Context, o1 linodego.ObjectStorageKeyCreateOptions) (op1 *linodego.ObjectStorageKey, err error)
- func (_d ClientWithTracing) DeleteObjectStorageBucket(ctx context.Context, s1 string, s2 string) (err error)
- func (_d ClientWithTracing) DeleteObjectStorageKey(ctx context.Context, i1 int) (err error)
- func (_d ClientWithTracing) GetObjectStorageBucket(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucket, err error)
- func (_d ClientWithTracing) GetObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucketAccess, err error)
- func (_d ClientWithTracing) GetObjectStorageKey(ctx context.Context, i1 int) (op1 *linodego.ObjectStorageKey, err error)
- func (_d ClientWithTracing) ListObjectStorageKeys(ctx context.Context, lp1 *linodego.ListOptions) (oa1 []linodego.ObjectStorageKey, err error)
- func (_d ClientWithTracing) UpdateObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientWithTracing ¶
type ClientWithTracing struct { _sourceLinodeclient.Client // contains filtered or unexported fields }
ClientWithTracing implements _sourceLinodeclient.Client interface instrumented with opentracing spans
func NewClientWithTracing ¶
func NewClientWithTracing(base _sourceLinodeclient.Client, instance string, spanDecorator ...func(span trace.Span, params, results map[string]interface{})) ClientWithTracing
NewClientWithTracing returns ClientWithTracing
func (ClientWithTracing) CreateObjectStorageBucket ¶
func (_d ClientWithTracing) CreateObjectStorageBucket(ctx context.Context, o1 linodego.ObjectStorageBucketCreateOptions) (op1 *linodego.ObjectStorageBucket, err error)
CreateObjectStorageBucket implements _sourceLinodeclient.Client
func (ClientWithTracing) CreateObjectStorageKey ¶
func (_d ClientWithTracing) CreateObjectStorageKey(ctx context.Context, o1 linodego.ObjectStorageKeyCreateOptions) (op1 *linodego.ObjectStorageKey, err error)
CreateObjectStorageKey implements _sourceLinodeclient.Client
func (ClientWithTracing) DeleteObjectStorageBucket ¶
func (_d ClientWithTracing) DeleteObjectStorageBucket(ctx context.Context, s1 string, s2 string) (err error)
DeleteObjectStorageBucket implements _sourceLinodeclient.Client
func (ClientWithTracing) DeleteObjectStorageKey ¶
func (_d ClientWithTracing) DeleteObjectStorageKey(ctx context.Context, i1 int) (err error)
DeleteObjectStorageKey implements _sourceLinodeclient.Client
func (ClientWithTracing) GetObjectStorageBucket ¶
func (_d ClientWithTracing) GetObjectStorageBucket(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucket, err error)
GetObjectStorageBucket implements _sourceLinodeclient.Client
func (ClientWithTracing) GetObjectStorageBucketAccess ¶
func (_d ClientWithTracing) GetObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucketAccess, err error)
GetObjectStorageBucketAccess implements _sourceLinodeclient.Client
func (ClientWithTracing) GetObjectStorageKey ¶
func (_d ClientWithTracing) GetObjectStorageKey(ctx context.Context, i1 int) (op1 *linodego.ObjectStorageKey, err error)
GetObjectStorageKey implements _sourceLinodeclient.Client
func (ClientWithTracing) ListObjectStorageKeys ¶
func (_d ClientWithTracing) ListObjectStorageKeys(ctx context.Context, lp1 *linodego.ListOptions) (oa1 []linodego.ObjectStorageKey, err error)
ListObjectStorageKeys implements _sourceLinodeclient.Client
func (ClientWithTracing) UpdateObjectStorageBucketAccess ¶
func (_d ClientWithTracing) UpdateObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string, o1 linodego.ObjectStorageBucketUpdateAccessOptions) (err error)
UpdateObjectStorageBucketAccess implements _sourceLinodeclient.Client