@@ -11,20 +11,25 @@ package conn
11
11
12
12
import (
13
13
"os"
14
+ "runtime"
14
15
"strconv"
15
16
"strings"
16
17
"time"
17
18
18
- "github.com/aws/aws-xray-daemon/pkg/cfg"
19
-
20
19
"github.com/aws/aws-sdk-go/aws"
21
20
"github.com/aws/aws-sdk-go/aws/awserr"
22
21
"github.com/aws/aws-sdk-go/aws/request"
23
22
"github.com/aws/aws-sdk-go/aws/session"
24
23
"github.com/aws/aws-sdk-go/service/xray"
24
+ "github.com/aws/aws-xray-daemon/pkg/cfg"
25
25
log "github.com/cihub/seelog"
26
26
)
27
27
28
+ // Constant prefixes used to identify information in user-agent
29
+ const agentPrefix = "xray-agent/xray-daemon/"
30
+ const execEnvPrefix = " exec-env/"
31
+ const osPrefix = " OS/"
32
+
28
33
// XRay defines X-Ray api call structure.
29
34
type XRay interface {
30
35
PutTraceSegments (input * xray.PutTraceSegmentsInput ) (* xray.PutTraceSegmentsOutput , error )
@@ -51,9 +56,16 @@ func NewXRay(awsConfig *aws.Config, s *session.Session) XRay {
51
56
x := xray .New (s , awsConfig )
52
57
log .Debugf ("Using Endpoint: %s" , x .Endpoint )
53
58
59
+ execEnv := os .Getenv ("AWS_EXECUTION_ENV" )
60
+ if execEnv == "" {
61
+ execEnv = "UNKNOWN"
62
+ }
63
+
64
+ osInformation := runtime .GOOS + "-" + runtime .GOARCH
65
+
54
66
x .Handlers .Build .PushBackNamed (request.NamedHandler {
55
67
Name : "tracing.XRayVersionUserAgentHandler" ,
56
- Fn : request .MakeAddToUserAgentHandler ( "xray" , cfg .Version , os . Getenv ( "AWS_EXECUTION_ENV" ) ),
68
+ Fn : request .MakeAddToUserAgentFreeFormHandler ( agentPrefix + cfg .Version + execEnvPrefix + execEnv + osPrefix + osInformation ),
57
69
})
58
70
59
71
x .Handlers .Sign .PushFrontNamed (request.NamedHandler {
0 commit comments