@@ -41,7 +41,7 @@ SDK, the Go version.
41
41
- [ Database instrumentation & ORM logging] ( #database-instrumentation---orm-logging )
42
42
- [ HTTP server middleware example] ( #http-server-middleware-example )
43
43
- [ gRPC server interceptors example] ( #grpc-server-interceptors-example )
44
- - [ AWS Session instrumentation] ( #aws-session -instrumentation )
44
+ - [ AWS Clients instrumentation] ( #aws-clients -instrumentation )
45
45
- [ PubSub instrumentation and logging] ( #pubsub-instrumentation-and-logging )
46
46
- [ Kafka] ( #kafka )
47
47
- [ Cache instrumentation and logging] ( #cache-instrumentation-and-logging )
@@ -989,7 +989,7 @@ The `go-sdk` provides an easy way to add application performance monitoring
989
989
(APM) & instrumentation to a service. It provides DataDog APM using the
990
990
[`dd-trace-go`](https://github.com/DataDog/dd-trace-go) library. `dd-trace-go`
991
991
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
993
993
to DataDog.
994
994
995
995
# ## Request ID middleware
@@ -1179,29 +1179,38 @@ func main() {
1179
1179
}
1180
1180
` ` `
1181
1181
1182
- # ## AWS Session instrumentation
1182
+ # ## AWS clients instrumentation
1183
1183
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
1185
1185
tagging it with the service name. In addition, this registers AWS as a separate
1186
1186
service in DataDog.
1187
1187
1188
1188
Example usage of the instrumentation :
1189
1189
1190
1190
` ` ` 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
+
1191
1202
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)
1205
1214
}
1206
1215
` ` `
1207
1216
0 commit comments