# README
Go AWS X-Ray

Go AWS X-Ray is a library to help simplify usage of AWS X-Ray for Micro
Usage
// create xray client
xray := awsxray.New(
// Specify X-Ray Daemon Address
awsxray.WithDaemon("localhost:2000"),
// Or X-Ray Client
awsxray.WithClient(xray.New(awsSession)),
)
// create segment
segment := &awsxray.Segment{
Name: ...
Id: ...
TraceId: ...
// more values
}
xray.Record(segment)
With Wrappers
Wrappers scope the library for simplified use
import "github.com/micro/go-plugins/wrapper/trace/awsxray"
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...)),
)
With Toolkit
Register the plugin before building Micro
package main
import (
"github.com/micro/micro/plugin"
"github.com/aws/aws-sdk-go/service/xray"
"github.com/micro/go-plugins/micro/trace/awsxray"
)
func init() {
plugin.Register(awsxray.NewXRayPlugin(
// Used as segment name
awsxray.WithName("go.micro.http"),
// Specify X-Ray Daemon Address
awsxray.WithDaemon("localhost:2000"),
// Or X-Ray Client
awsxray.WithClient(xray.New(awsSession)),
))
}
Example
# Functions
No description provided by the author
GetParentId returns parent id from header or blank.
GetTraceId returns trace id from header or blank.
No description provided by the author
No description provided by the author
SetParentId will set the parent id of a trace in the header.
SetTraceId will set the trace id in the header.
WithClient sets the XRay Client to use to send segments.
WithDaemon sets the address of the XRay Daemon to send segements.
# Variables
No description provided by the author
# Type aliases
No description provided by the author