awsxray

package
v0.12.0 Latest Latest
Warning

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

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

README

AWS X-Ray Plugin

The AWS X-Ray plugin provides integration for the micro toolkit.

Usage

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)),
	))
}

Then just run any component like so

micro api
Scoped to API

If you like to only apply the plugin for a specific component you can register it with that specifically. For example, below you'll see the plugin registered with the API.

package main

import (
	"github.com/micro/micro/api"
	"github.com/micro/go-plugins/micro/trace/awsxray"
)

func init() {
	api.Register(awsxray.NewXRayPlugin())
}

Example

Documentation

Overview

Package awsxray is a micro plugin for whitelisting service requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewXRayPlugin

func NewXRayPlugin(opts ...Option) plugin.Plugin

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