ocaws

package module
v0.0.0-...-9ac8be7 Latest Latest
Warning

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

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

README

ocaws - Go OpenCensus AWS Integration

Documentation Status Coverage Report

Provides Opencensus Tracing integrations for AWS SQS/SNS via the AWS Go SDK allowing you to easily propagate spans across SQS/SNS messages.

jaeger tracing example

Installation

go get go.krak3n.codes/ocaws

Documentation

Please see the Documentation for code examples and documentation.

Example

Please see the example directory for a full end to end example code.

Contributing

Please refer to contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Documentation

Overview

Package ocaws provides OpenCensus tracing support for distributed systems using AWS services such as SQS and SNS. You should have some basic familiarity with OpenCensus concepts, please see http://opencensus.io for more information.

go get go.krak3n.codes/ocaws

The clients provided here are designed to be drop in replacements for AWS clients with little configuration required, you can of course tailor each client to your tracing needs.

The documentation here assumes you have already setup your exporters for tracing as described in the OpenCensus documentation, for example:

trace.RegisterExporter(exporter)

SNS

To publish messages using SNS with span context create a ocsns client and publish a message as you normally would using PublishWithContext.

ctx, span := trace.StartSpan(contet.Background(), "my.span/Name")
defer span.End()

client := ocsns.New(sns.New(session))
client.PublishWithContext(ctx, &sns.PublishInput{...})

See more complete examples in the ocsns documentation: https://godoc.org/go.krak3n.codes/ocaws/ocsns#pkg-examples

SQS

To publish a message directly to an SQS queue create an ocsqs client and use the new SendMessageContext method to send a message to an SQS with span context.

ctx, span := trace.StartSpan(contet.Background(), "my.span/Name")
defer span.End()

client := ocsqs.New(sqs.New(session))
client.SendMessageContext(ctx, &sqs.SendMessageInput{...})

To receive messages from SQS and start spans use the StartSpanFromMessage method which will return you a span based on the messages span context message attributes.

client := ocsqs.New(session)

rsp, _ := client.ReceiveMessage(&sqs.ReceiveMessageInput{...})
for _, msg := range rsp.rsp.Messages {
    ctx, span := sqsClient.StartSpanFromMessage(ctx, msg)
    // Do work
    span.End()
}

See more complete examples in the ocsns documentation: https://godoc.org/go.krak3n.codes/ocaws/ocsqs#pkg-examples

Index

Constants

View Source
const (
	TraceTopicName = "Trace-Topic-Name"
	TraceQueueURL  = "Trace-Queue-Url"
)

Extra attribute keys placed onto message attributes unrelated to Span Context

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package ocsns provides a drop in replacement for your exisitng SNS client providing methods for persisiting spans to SNS topics.
Package ocsns provides a drop in replacement for your exisitng SNS client providing methods for persisiting spans to SNS topics.
Package ocsqs provides a drop in replacement for your exisitng SQS client providing methods for persisiting and creating spans from SQS message attributes.
Package ocsqs provides a drop in replacement for your exisitng SQS client providing methods for persisiting and creating spans from SQS message attributes.
b3

Jump to

Keyboard shortcuts

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