Skip to content

Commit eabbab6

Browse files
authored
Update README with v2 examples (#498)
1 parent 5fb4d3a commit eabbab6

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ Install the SDK using the following command (The SDK's non-testing dependencies
1919
Use `go get` to retrieve the SDK to add it to your `GOPATH` workspace:
2020

2121
```
22-
go get github.com/aws/aws-xray-sdk-go
22+
go get github.com/aws/aws-xray-sdk-go/v2
2323
```
2424

2525
To update the SDK, use `go get -u` to retrieve the latest version of the SDK.
2626

2727
```
28-
go get -u github.com/aws/aws-xray-sdk-go
28+
go get -u github.com/aws/aws-xray-sdk-go/v2
2929
```
3030

3131
If you also want to install SDK's testing dependencies. They can be installed using:
3232

3333
```
34-
go get -u -t github.com/aws/aws-xray-sdk-go/...
34+
go get -u -t github.com/aws/aws-xray-sdk-go/v2/...
3535
```
3636

3737
## Installing using Go Modules
@@ -41,7 +41,7 @@ The latest version of the SDK is the recommended version.
4141
If you are using Go 1.11 and above, you can install the SDK using Go Modules (in project's go.mod), like so:
4242

4343
```
44-
go get github.com/aws/aws-xray-sdk-go
44+
go get github.com/aws/aws-xray-sdk-go/v2
4545
```
4646

4747
To get a different specific release version of the SDK use `@<tag>` in your `go get` command. Also, to get the rc version use this command with the specific version.
@@ -75,7 +75,7 @@ See [aws-xray-sdk-go-sample](https://github.com/aws-samples/aws-xray-sdk-go-samp
7575
**Configuration**
7676

7777
```go
78-
import "github.com/aws/aws-xray-sdk-go/xray"
78+
import "github.com/aws/aws-xray-sdk-go/v2/xray"
7979

8080
func init() {
8181
xray.Configure(xray.Config{
@@ -111,14 +111,14 @@ Note that the `xray.Config{}` fields `LogLevel` and `LogFormat` are deprecated s
111111

112112
***Plugins***
113113

114-
Plugins can be loaded conditionally at runtime. For this purpose, plugins under "github.com/aws/aws-xray-sdk-go/awsplugins/" have an explicit `Init()` function. Customer must call this method to load the plugin:
114+
Plugins can be loaded conditionally at runtime. For this purpose, plugins under "github.com/aws/aws-xray-sdk-go/v2/awsplugins/" have an explicit `Init()` function. Customer must call this method to load the plugin:
115115

116116
```go
117117
import (
118118
"os"
119119

120-
"github.com/aws/aws-xray-sdk-go/awsplugins/ec2"
121-
"github.com/aws/aws-xray-sdk-go/xray"
120+
"github.com/aws/aws-xray-sdk-go/v2/awsplugins/ec2"
121+
"github.com/aws/aws-xray-sdk-go/v2/xray"
122122
)
123123

124124
func init() {
@@ -206,6 +206,9 @@ func getExample(ctx context.Context) ([]byte, error) {
206206

207207
**AWS SDK Instrumentation**
208208

209+
> [!WARNING]
210+
> Support for AWS SDK V1 Instrumentation has been removed in v2.0.0 of the AWS X-Ray SDK for Go
211+
209212
```go
210213
func main() {
211214
// Create a segment
@@ -236,8 +239,8 @@ import (
236239
"github.com/aws/aws-sdk-go-v2/aws"
237240
"github.com/aws/aws-sdk-go-v2/config"
238241
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
239-
"github.com/aws/aws-xray-sdk-go/instrumentation/awsv2"
240-
"github.com/aws/aws-xray-sdk-go/xray"
242+
"github.com/aws/aws-xray-sdk-go/v2/instrumentation/awsv2"
243+
"github.com/aws/aws-xray-sdk-go/v2/xray"
241244
)
242245

243246
func main() {
@@ -371,8 +374,8 @@ import (
371374
"log"
372375
"os"
373376

374-
"github.com/aws/aws-xray-sdk-go/xray"
375-
"github.com/aws/aws-xray-sdk-go/xraylog"
377+
"github.com/aws/aws-xray-sdk-go/v2/xray"
378+
"github.com/aws/aws-xray-sdk-go/v2/xraylog"
376379
"github.com/fasthttp/router"
377380
"github.com/valyala/fasthttp"
378381
)
@@ -426,7 +429,7 @@ import (
426429
"github.com/aws/aws-lambda-go/lambda"
427430
"github.com/aws/aws-sdk-go/aws/session"
428431
"github.com/aws/aws-sdk-go/service/sqs"
429-
"github.com/aws/aws-xray-sdk-go/xray"
432+
"github.com/aws/aws-xray-sdk-go/v2/xray"
430433
)
431434

432435
func HandleRequest(ctx context.Context, event events.SQSEvent) (string, error) {
@@ -463,8 +466,8 @@ import (
463466
"strconv"
464467
"github.com/aws/aws-lambda-go/events"
465468
"github.com/aws/aws-lambda-go/lambda"
466-
xrayLambda "github.com/aws/aws-xray-sdk-go/lambda"
467-
"github.com/aws/aws-xray-sdk-go/xray"
469+
xrayLambda "github.com/aws/aws-xray-sdk-go/v2/lambda"
470+
"github.com/aws/aws-xray-sdk-go/v2/xray"
468471
)
469472

470473
func HandleRequest(ctx context.Context, event events.SQSEvent) (string, error) {

0 commit comments

Comments
 (0)