awsxray

package module
v4.0.0-...-6e18eb5 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

AWS X-Ray Wrappers

AWS X-Ray wrappers make use of either the AWS API or the X-Ray Daemon.

Usage

opts := []awsxray.Option{
	// Used as segment name
	awsxray.WithName("go.micro.srv.greeter"),
	// Specify X-Ray Daemon Address
	awsxray.WithDaemon("localhost:2000"),
	// Or X-Ray Client
	awsxray.WithClient(xray.New(awsSession)),
}

service := micro.NewService(
	micro.Name("go.micro.srv.greeter"),
	micro.WrapCall(awsxray.NewCallWrapper(opts...)),
	micro.WrapClient(awsxray.NewClientWrapper(opts...)),
	micro.WrapHandler(awsxray.NewHandlerWrapper(opts...)),
)

Example

Documentation

Overview

Package awsxray is a wrapper for AWS X-Ray distributed tracing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallWrapper

func NewCallWrapper(opts ...Option) client.CallWrapper

NewCallWrapper accepts Options and returns a Trace Call Wrapper for individual node calls made by the client

func NewClientWrapper

func NewClientWrapper(opts ...Option) client.Wrapper

NewClientWrapper accepts Options and returns a Trace Client Wrapper which tracks high level service calls

func NewHandlerWrapper

func NewHandlerWrapper(opts ...Option) server.HandlerWrapper

NewHandlerWrapper accepts Options and returns a Trace Handler Wrapper

Types

type Option

type Option func(o *Options)

func WithClient

func WithClient(x *xray.XRay) Option

WithClient sets the XRay Client to use to send segments

func WithDaemon

func WithDaemon(addr string) Option

WithDaemon sets the address of the XRay Daemon to send segements

func WithName

func WithName(name string) Option

WithName sets the name used for each segment. Use Service Name

type Options

type Options struct {
	// XRay Client when using API
	Client *xray.XRay
	// Daemon address when using UDP
	Daemon string
	// Name of segments e.g the service
	Name string
}

Jump to

Keyboard shortcuts

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