aws

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 4 Imported by: 0

README

Build Status Go Report Card Coverage Status

go-oc-aws-tracing

go-oc-aws-tracing is a package that wraps an AWS Session, causing requests and responses to be traced by OpenCensus.

Usage

Documentation

import aws_trace "github.com/lonnblad/go-oc-aws-tracing"
cfg: = aws.NewConfig().WithRegion("us-west-2")
sess: = session.Must(session.NewSession(cfg))
sess = aws_trace.WrapSession(sess)

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

Documentation

Overview

Package aws implements an AWS session wrapper, causing requests and responses to be traced.

The injected handler will create a new span with a name based on the called AWS service and operation. The span's status will be set based on the AWS response and include the following attributes:

  • aws.user_agent
  • aws.request.operation
  • aws.request.service
  • aws.request.region
  • aws.request.method
  • aws.request.url
  • aws.response.status_code

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapSession

func WrapSession(s *session.Session) *session.Session

WrapSession wraps an AWS Session, causing requests and responses to be traced.

Example

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

package main

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

	aws_trace "github.com/lonnblad/go-oc-aws-tracing"
)

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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