Skip to content

Commit 4ae9688

Browse files
committed
docs: Update README file
1 parent 5904a1a commit 4ae9688

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SDK, the Go version.
4141
- [Database instrumentation & ORM logging](#database-instrumentation---orm-logging)
4242
- [HTTP server middleware example](#http-server-middleware-example)
4343
- [gRPC server interceptors example](#grpc-server-interceptors-example)
44-
- [AWS Session instrumentation](#aws-session-instrumentation)
44+
- [AWS Clients instrumentation](#aws-clients-instrumentation)
4545
- [PubSub instrumentation and logging](#pubsub-instrumentation-and-logging)
4646
- [Kafka](#kafka)
4747
- [Cache instrumentation and logging](#cache-instrumentation-and-logging)
@@ -989,7 +989,7 @@ The `go-sdk` provides an easy way to add application performance monitoring
989989
(APM) & instrumentation to a service. It provides DataDog APM using the
990990
[`dd-trace-go`](https://github.com/DataDog/dd-trace-go) library. `dd-trace-go`
991991
provides gRPC server & client interceptors, HTTP router instrumentation, database connection & ORM instrumentation
992-
and AWS session instrumentation. All of the traces and data are opaquely sent
992+
and AWS clients instrumentation. All of the traces and data are opaquely sent
993993
to DataDog.
994994

995995
### Request ID middleware
@@ -1179,29 +1179,38 @@ func main() {
11791179
}
11801180
```
11811181

1182-
### AWS Session instrumentation
1182+
### AWS clients instrumentation
11831183

1184-
`go-sdk` instruments the AWS session by wrapping it with a DataDog trace and
1184+
`go-sdk` instruments the AWS clients by wrapping it with a DataDog trace and
11851185
tagging it with the service name. In addition, this registers AWS as a separate
11861186
service in DataDog.
11871187

11881188
Example usage of the instrumentation:
11891189

11901190
```go
1191+
import (
1192+
"context"
1193+
"log"
1194+
1195+
"github.com/aws/aws-sdk-go-v2/aws"
1196+
awscfg "github.com/aws/aws-sdk-go-v2/config"
1197+
"github.com/aws/aws-sdk-go-v2/service/s3"
1198+
1199+
instrumentation "github.com/scribd/go-sdk/pkg/instrumentation"
1200+
)
1201+
11911202
func main() {
1192-
s := session.NewSession(&aws.Config{
1193-
Endpoint: aws.String(config.GetString("s3_endpoint")),
1194-
Region: aws.String(config.GetString("default_region")),
1195-
Credentials: credentials.NewStaticCredentials(
1196-
config.GetString("access_key_id"),
1197-
config.GetString("secret_access_key"),
1198-
"",
1199-
),
1200-
})
1201-
1202-
session = instrumentation.InstrumentAWSSession(s, instrumentation.Settings{AppName: "MyServiceName"})
1203-
1204-
// Use the session...
1203+
cfg, err := awscfg.LoadDefaultConfig(context.Background, awscfg.WithRegion("us-west-2"))
1204+
if err != nil {
1205+
log.Fatalf("error: %v", err)
1206+
}
1207+
1208+
instrumentation.InstrumentAWSClient(cfg, instrumentation.Settings{
1209+
AppName: applicationName,
1210+
})
1211+
1212+
// Use the AWS configuration to create clients, such as AWS S3...
1213+
s3client := s3.NewFromConfig(cfg)
12051214
}
12061215
```
12071216

0 commit comments

Comments
 (0)