aws

package
v2.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package aws provides functions to trace aws/aws-sdk-go (https://github.com/aws/aws-sdk-go).

Example

To start tracing requests, wrap the AWS session.Session by invoking awstrace.WrapSession.

package main

import (
	awstrace "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/s3"
)

func main() {
	cfg := aws.NewConfig().WithRegion("us-west-2")
	sess := session.Must(session.NewSession(cfg))
	sess = awstrace.WrapSession(sess)

	s3api := s3.New(sess)
	s3api.CreateBucket(&s3.CreateBucketInput{
		Bucket: aws.String("some-bucket-name"),
	})
}
Output:

Index

Examples

Constants

View Source
const (
	// SendHandlerName is the name of the Datadog NamedHandler for the Send phase of an awsv1 request
	SendHandlerName = "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws/handlers.Send"
	// CompleteHandlerName is the name of the Datadog NamedHandler for the Complete phase of an awsv1 request
	CompleteHandlerName = "github.com/DataDog/dd-trace-go/v2/contrib/aws/aws-sdk-go/aws/handlers.Complete"
)

Variables

This section is empty.

Functions

func WrapSession

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

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

Types

type Option

type Option func(*config)

Option represents an option that can be passed to Dial.

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 WithErrorCheck

func WithErrorCheck(fn func(err error) bool) Option

WithErrorCheck specifies a function fn which determines whether the passed error should be marked as an error. The fn is called whenever an aws operation finishes with an error.

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