instaawsv2

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 23 Imported by: 0

README

Instana instrumentation of AWS SDK v2 for Go

GoDoc

This module contains the code for instrumenting AWS APIs which are based on the aws sdk v2 library for Go. The following services are currently instrumented:

Installation

$ go get github.com/instana/go-sensor/instrumentation/instaawsv2

Usage

To trace the AWS APIs, the user has to instrument the aws.Config object using the instaawsv2.Instrument function before starting to use the AWS service clients like s3, dynamodb etc.

Special cases

1. Instrumenting SQS consumers

An SQS client that uses instrumented aws.Config automatically creates entry spans for each incoming sqs.Message. To use this entry span context as a parent in your message handler use instaawsv2.SpanContextFromSQSMessage:

func handleMessage(ctx context.Context, msg *sqs.Message) {
	if parent, ok := instaawsv2.SpanContextFromSQSMessage(msg, tracer); ok {
		sp := tracer.StartSpan("handleMessage", opentracing.ChildOf(parent))
		defer sp.Finish()

		ctx = instana.ContextWithSpan(ctx, sp)
    }

    // ...
}
2. Instrumenting calls to AWS Lambda

When calls to AWS Lambda is instrumented using instaawsv2, the trace context is propagated inside a ClientContext.Custom field in the InvokeInput object. The reserved keys used for this are:

  1. x-instana-t
  2. x-instana-s
  3. x-instana-l

Hence, to avoid collisions, it is recommended to avoid these keys in your application code.

Limitations

  • Current instrumentation does not support asynchronous lambda invocation.
  • If the length of base64 encoded ClientContext will exceed 3582 bytes, tracing headers will be not propagated.

Documentation

Overview

Package instaawsv2 provides Instana instrumentation for the aws sdk v2 library.

Example (Lambda)
Example (S3)
Example (Sns)
Example (Sqs)

Index

Examples

Constants

View Source
const Version = "0.1.0"

Version is the instrumentation module semantic version

Variables

This section is empty.

Functions

func Instrument

func Instrument(tr instana.TracerLogger, cfg *aws.Config)

Instrument adds instana instrumentation to the aws config object

func SpanContextFromSQSMessage

func SpanContextFromSQSMessage(msg sqsTypes.Message, tracer instana.TracerLogger) (opentracing.SpanContext, error)

SpanContextFromSQSMessage returns the trace context from an SQS message

Types

type AWSDynamoDBOperations

type AWSDynamoDBOperations struct{}

type AWSInvokeLambdaOperations

type AWSInvokeLambdaOperations struct{}

type AWSOperations

type AWSOperations interface {
	// contains filtered or unexported methods
}

type AWSS3Operations

type AWSS3Operations struct{}

type AWSSNSOperations

type AWSSNSOperations struct{}

type AWSSQSOperations

type AWSSQSOperations struct{}

Jump to

Keyboard shortcuts

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