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 ¶
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. |