awsdd

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

Build Status

OpenTracing for AWS SDK in Go with Datadog schematic

This package is functional equivalent of gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws using opentracing framework. Although it is configured with Datadog tags schema there is nothing that prevents using it with different provider.

See example in example_test.go

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolEnv

func BoolEnv(key string, def bool) bool

BoolEnv returns the parsed boolean value of an environment variable, or def otherwise.

func WrapSession

func WrapSession(s *session.Session, opts ...Option) *session.Session

WrapSession wraps a session.Session, causing requests and responses to be traced.

Example
package main

import (
	"log"

	"github.com/aws/aws-sdk-go/aws/session"
	awsdd "github.com/dharnitski/opentracing-aws-dd"
)

func main() {
	session, err := session.NewSession()
	if err != nil {
		log.Fatal(err)
	}
	// session is instrumented with global tracer
	session = awsdd.WrapSession(session)
}
Output:

Types

type Option

type Option func(*config)

Option represents an option that can be passed to Dial.

Example
package main

import (
	"log"

	"github.com/aws/aws-sdk-go/aws/session"
	awsdd "github.com/dharnitski/opentracing-aws-dd"
)

func main() {
	session, err := session.NewSession()
	if err != nil {
		log.Fatal(err)
	}
	session = awsdd.WrapSession(session, awsdd.WithServiceName("myservice"))
}
Output:

func WithAnalytics

func WithAnalytics(on bool) Option

WithAnalytics enables Trace Analytics for all started spans.

func WithAnalyticsRate

func WithAnalyticsRate(rate float64) Option

WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

func WithServiceName

func WithServiceName(name string) Option

WithServiceName sets the given service name for the dialled connection. When the service name is not explicitly set it will be inferred based on the request to AWS.

Jump to

Keyboard shortcuts

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