AWS X-Ray
Developer Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Tracing Calls to Downstream HTTP Web Services with the X-Ray SDK for Go

When your application makes calls to microservices or public HTTP APIs, you can use the xray.Client to instrument those calls as subsegments of your Go application, as shown in the following example, where http-client is an HTTP client.

Client creates a shallow copy of the provided http client, defaulting to http.DefaultClient, with roundtripper wrapped with xray.RoundTripper.

Example main.go – HTTP client

myClient := xray.Client(http-client)