tracedclient

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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

  1. 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.

  2. 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 the gowrap 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.

  • gowrap: The gowrap tool used for code generation.
  • OpenTelemetry: OpenTelemetry project for observability and instrumentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientWithTracing

type ClientWithTracing struct {
	linodeclient.Client
	// contains filtered or unexported fields
}

ClientWithTracing implements linodeclient.Client interface instrumented with opentracing spans

func NewClientWithTracing

func NewClientWithTracing(base linodeclient.Client, instance string, spanDecorator ...func(span trace.Span, params, results map[string]interface{})) ClientWithTracing

NewClientWithTracing returns ClientWithTracing

func (ClientWithTracing) CreateObjectStorageBucket

CreateObjectStorageBucket implements linodeclient.Client

func (ClientWithTracing) CreateObjectStorageKey

CreateObjectStorageKey implements linodeclient.Client

func (ClientWithTracing) DeleteObjectStorageBucket

func (_d ClientWithTracing) DeleteObjectStorageBucket(ctx context.Context, s1 string, s2 string) (err error)

DeleteObjectStorageBucket implements linodeclient.Client

func (ClientWithTracing) DeleteObjectStorageKey

func (_d ClientWithTracing) DeleteObjectStorageKey(ctx context.Context, i1 int) (err error)

DeleteObjectStorageKey implements linodeclient.Client

func (ClientWithTracing) GetObjectStorageBucket

func (_d ClientWithTracing) GetObjectStorageBucket(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucket, err error)

GetObjectStorageBucket implements linodeclient.Client

func (ClientWithTracing) GetObjectStorageBucketAccess

func (_d ClientWithTracing) GetObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string) (op1 *linodego.ObjectStorageBucketAccess, err error)

GetObjectStorageBucketAccess implements linodeclient.Client

func (ClientWithTracing) GetObjectStorageKey

func (_d ClientWithTracing) GetObjectStorageKey(ctx context.Context, i1 int) (op1 *linodego.ObjectStorageKey, err error)

GetObjectStorageKey implements linodeclient.Client

func (ClientWithTracing) ListObjectStorageKeys

func (_d ClientWithTracing) ListObjectStorageKeys(ctx context.Context, lp1 *linodego.ListOptions) (oa1 []linodego.ObjectStorageKey, err error)

ListObjectStorageKeys implements linodeclient.Client

func (ClientWithTracing) UpdateObjectStorageBucketAccess

func (_d ClientWithTracing) UpdateObjectStorageBucketAccess(ctx context.Context, s1 string, s2 string, o1 linodego.ObjectStorageBucketUpdateAccessOptions) (err error)

UpdateObjectStorageBucketAccess implements linodeclient.Client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL