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: 25 Imported by: 0

Documentation

Overview

Example
package main

import (
	"context"
	"log"

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

	awscfg "github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/sqs"
)

func main() {
	awsCfg, err := awscfg.LoadDefaultConfig(context.Background())
	if err != nil {
		log.Fatalf(err.Error())
	}

	awstrace.AppendMiddleware(&awsCfg)

	sqsClient := sqs.NewFromConfig(awsCfg)
	sqsClient.ListQueues(context.Background(), &sqs.ListQueuesInput{})
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendMiddleware

func AppendMiddleware(awsCfg *aws.Config, opts ...Option)

AppendMiddleware takes the aws.Config and adds the Datadog tracing middleware into the APIOptions middleware stack. See https://aws.github.io/aws-sdk-go-v2/docs/middleware for more information.

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