Skip to content

Commit afcea2b

Browse files
authored
Merge branch 'main' into dario.castane/metastruct-allocs-per-value
2 parents 4104be9 + 5093b47 commit afcea2b

54 files changed

Lines changed: 811 additions & 260 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lambda-integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ jobs:
1818
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919

2020
- name: Configure AWS Credentials via OIDC (Build-Stable)
21-
uses: aws-actions/configure-aws-credentials@v6
21+
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
2222
with:
2323
role-to-assume: arn:aws:iam::486234852809:role/dd-trace-go-github-actions
2424
role-session-name: dd-trace-go-lambda-${{ github.run_id }}
2525
aws-region: us-east-1
2626

2727
- name: Configure AWS Credentials for Serverless Sandbox
28-
uses: aws-actions/configure-aws-credentials@v6
28+
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
2929
with:
3030
role-to-assume: arn:aws:iam::425362996713:role/gha-dd-trace-lambda-integration-test
3131
role-session-name: dd-trace-go-lambda-${{ github.run_id }}

contrib/aws/aws-sdk-go-v2/aws/aws.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (mw *traceMiddleware) startTraceMiddleware(stack *middleware.Stack) error {
9797

9898
opts := []tracer.StartSpanOption{
9999
tracer.SpanType(ext.SpanTypeHTTP),
100-
tracer.ServiceName(serviceName(mw.cfg, serviceID)),
100+
serviceNameWithSource(mw.cfg, serviceID),
101101
tracer.ResourceName(fmt.Sprintf("%s.%s", serviceID, operation)),
102102
tracer.Tag(ext.AWSRegionLegacy, region),
103103
tracer.Tag(ext.AWSRegion, region),
@@ -429,13 +429,16 @@ func spanName(awsService, awsOperation string) string {
429429
})
430430
}
431431

432-
func serviceName(cfg *config, awsService string) string {
432+
func serviceNameWithSource(cfg *config, awsService string) tracer.StartSpanOption {
433433
if cfg.serviceName != "" {
434-
return cfg.serviceName
434+
return instrumentation.ServiceNameWithSource(cfg.serviceName, cfg.serviceSource)
435435
}
436-
return instr.ServiceName(instrumentation.ComponentDefault, instrumentation.OperationContext{
437-
ext.AWSService: awsService,
438-
})
436+
return instrumentation.ServiceNameWithSource(
437+
instr.ServiceName(instrumentation.ComponentDefault, instrumentation.OperationContext{
438+
ext.AWSService: awsService,
439+
}),
440+
string(instrumentation.PackageAWSSDKGoV2),
441+
)
439442
}
440443

441444
func coalesceNameOrArnResource(name *string, arnVal *string) string {

contrib/aws/aws-sdk-go-v2/aws/doc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
// // Create a root span.
4747
// span, ctx := tracer.StartSpanFromContext(context.Background(), "parent.request",
4848
// tracer.SpanType(ext.SpanTypeWeb),
49-
// tracer.ServiceName("web"),
5049
// tracer.ResourceName("/upload"),
5150
// )
5251
// defer span.Finish()

contrib/aws/aws-sdk-go-v2/aws/option.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ package aws
77

88
import (
99
"math"
10+
11+
"github.com/DataDog/dd-trace-go/v2/instrumentation"
1012
)
1113

1214
type config struct {
1315
serviceName string
16+
serviceSource string
1417
analyticsRate float64
1518
errCheck func(err error) bool
1619
}
@@ -37,6 +40,7 @@ func defaults(cfg *config) {
3740
func WithService(name string) OptionFn {
3841
return func(cfg *config) {
3942
cfg.serviceName = name
43+
cfg.serviceSource = instrumentation.ServiceSourceWithServiceOption
4044
}
4145
}
4246

contrib/aws/aws-sdk-go/aws/aws.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (h *handlers) Send(req *request.Request) {
8484

8585
opts := []tracer.StartSpanOption{
8686
tracer.SpanType(ext.SpanTypeHTTP),
87-
tracer.ServiceName(h.serviceName(req)),
87+
h.serviceNameWithSource(req),
8888
tracer.ResourceName(resourceName(req)),
8989
tracer.Tag(ext.AWSAgent, awsAgent(req)),
9090
tracer.Tag(ext.AWSOperation, awsOperation(req)),
@@ -123,15 +123,18 @@ func (h *handlers) Complete(req *request.Request) {
123123
span.Finish()
124124
}
125125

126-
func (h *handlers) serviceName(req *request.Request) string {
126+
func (h *handlers) serviceNameWithSource(req *request.Request) tracer.StartSpanOption {
127127
if h.cfg.serviceName != "" {
128-
return h.cfg.serviceName
128+
return instrumentation.ServiceNameWithSource(h.cfg.serviceName, h.cfg.serviceSource)
129129
}
130-
return instr.ServiceName(
131-
instrumentation.ComponentDefault,
132-
instrumentation.OperationContext{
133-
ext.AWSService: awsService(req),
134-
},
130+
return instrumentation.ServiceNameWithSource(
131+
instr.ServiceName(
132+
instrumentation.ComponentDefault,
133+
instrumentation.OperationContext{
134+
ext.AWSService: awsService(req),
135+
},
136+
),
137+
string(instrumentation.PackageAWSSDKGo),
135138
)
136139
}
137140

contrib/aws/aws-sdk-go/aws/option.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ package aws
77

88
import (
99
"math"
10+
11+
"github.com/DataDog/dd-trace-go/v2/instrumentation"
1012
)
1113

1214
type config struct {
1315
serviceName string
16+
serviceSource string
1417
analyticsRate float64
1518
errCheck func(err error) bool
1619
}
@@ -29,6 +32,7 @@ func (fn OptionFn) apply(cfg *config) {
2932

3033
func defaults(cfg *config) {
3134
cfg.analyticsRate = instr.AnalyticsRate(false)
35+
cfg.serviceSource = string(instrumentation.PackageAWSSDKGo)
3236
}
3337

3438
// WithService sets the given service name for the dialled connection.
@@ -37,6 +41,7 @@ func defaults(cfg *config) {
3741
func WithService(name string) OptionFn {
3842
return func(cfg *config) {
3943
cfg.serviceName = name
44+
cfg.serviceSource = instrumentation.ServiceSourceWithServiceOption
4045
}
4146
}
4247

contrib/cloud.google.com/go/pubsubtrace/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import "github.com/DataDog/dd-trace-go/v2/instrumentation"
99

1010
type config struct {
1111
serviceName string
12+
serviceSource string
1213
publishSpanName string
1314
receiveSpanName string
1415
measured bool
@@ -22,6 +23,7 @@ type Option interface {
2223
func (tr *Tracer) defaultConfig() *config {
2324
return &config{
2425
serviceName: tr.instr.ServiceName(instrumentation.ComponentConsumer, nil),
26+
serviceSource: string(tr.component),
2527
publishSpanName: tr.instr.OperationName(instrumentation.ComponentProducer, nil),
2628
receiveSpanName: tr.instr.OperationName(instrumentation.ComponentConsumer, nil),
2729
measured: false,
@@ -39,6 +41,7 @@ func (fn OptionFn) apply(cfg *config) {
3941
func WithService(serviceName string) OptionFn {
4042
return func(cfg *config) {
4143
cfg.serviceName = serviceName
44+
cfg.serviceSource = instrumentation.ServiceSourceWithServiceOption
4245
}
4346
}
4447

contrib/cloud.google.com/go/pubsubtrace/tracing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (tr *Tracer) TracePublish(ctx context.Context, topic Topic, msg *Message, o
6666
tracer.Tag(ext.MessagingSystem, ext.MessagingSystemGCPPubsub),
6767
}
6868
if cfg.serviceName != "" {
69-
spanOpts = append(spanOpts, tracer.ServiceName(cfg.serviceName))
69+
spanOpts = append(spanOpts, instrumentation.ServiceNameWithSource(cfg.serviceName, cfg.serviceSource))
7070
}
7171
if cfg.measured {
7272
spanOpts = append(spanOpts, tracer.Measured())
@@ -116,7 +116,7 @@ func (tr *Tracer) TraceReceiveFunc(s Subscription, opts ...Option) func(ctx cont
116116
tracer.ChildOf(parentSpanCtx),
117117
}
118118
if cfg.serviceName != "" {
119-
opts = append(opts, tracer.ServiceName(cfg.serviceName))
119+
opts = append(opts, instrumentation.ServiceNameWithSource(cfg.serviceName, cfg.serviceSource))
120120
}
121121
if cfg.measured {
122122
opts = append(opts, tracer.Measured())

contrib/dimfeld/httptreemux.v5/httptreemux.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func New(opts ...RouterOption) *Router {
4343
cfg.spanOpts = append(cfg.spanOpts, tracer.Measured())
4444
cfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.SpanKind, ext.SpanKindServer))
4545
cfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.Component, componentName))
46-
cfg.spanOpts = append(cfg.spanOpts, instrumentation.ServiceNameWithSource(cfg.serviceName, cfg.serviceSource))
4746
instr.Logger().Debug("contrib/dimfeld/httptreemux.v5: Configuring Router: %#v", cfg)
4847
return &Router{httptreemux.New(), cfg}
4948
}
@@ -54,11 +53,12 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
5453
route, _ := getRoute(r.TreeMux, w, req)
5554
// pass r.TreeMux to avoid a circular reference panic on calling r.ServeHTTP
5655
httptrace.TraceAndServe(r.TreeMux, w, req, &httptrace.ServeConfig{
57-
Framework: "github.com/dimfeld/httptreemux/v5",
58-
Service: r.config.serviceName,
59-
Resource: resource,
60-
SpanOpts: r.config.spanOpts,
61-
Route: route,
56+
Framework: "github.com/dimfeld/httptreemux/v5",
57+
Service: r.config.serviceName,
58+
ServiceSource: r.config.serviceSource,
59+
Resource: resource,
60+
SpanOpts: r.config.spanOpts,
61+
Route: route,
6262
})
6363
}
6464

@@ -80,7 +80,6 @@ func NewWithContext(opts ...RouterOption) *ContextRouter {
8080
cfg.spanOpts = append(cfg.spanOpts, tracer.Measured())
8181
cfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.SpanKind, ext.SpanKindServer))
8282
cfg.spanOpts = append(cfg.spanOpts, tracer.Tag(ext.Component, componentName))
83-
cfg.spanOpts = append(cfg.spanOpts, instrumentation.ServiceNameWithSource(cfg.serviceName, cfg.serviceSource))
8483
instr.Logger().Debug("contrib/dimfeld/httptreemux.v5: Configuring ContextRouter: %#v", cfg)
8584
return &ContextRouter{httptreemux.NewContextMux(), cfg}
8685
}
@@ -91,11 +90,12 @@ func (r *ContextRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
9190
route, _ := getRoute(r.TreeMux, w, req)
9291
// pass r.TreeMux to avoid a circular reference panic on calling r.ServeHTTP
9392
httptrace.TraceAndServe(r.TreeMux, w, req, &httptrace.ServeConfig{
94-
Framework: "github.com/dimfeld/httptreemux/v5",
95-
Service: r.config.serviceName,
96-
Resource: resource,
97-
SpanOpts: r.config.spanOpts,
98-
Route: route,
93+
Framework: "github.com/dimfeld/httptreemux/v5",
94+
Service: r.config.serviceName,
95+
ServiceSource: r.config.serviceSource,
96+
Resource: resource,
97+
SpanOpts: r.config.spanOpts,
98+
Route: route,
9999
})
100100
}
101101

contrib/gorilla/mux/mux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
107107
route, _ = match.Route.GetPathTemplate()
108108
}
109109
spanopts = append(spanopts, instrhttptrace.HeaderTagsFromRequest(req, r.config.headerTags))
110-
spanopts = append(spanopts, instrumentation.ServiceNameWithSource(r.config.serviceName, r.config.serviceSource))
111110
resource := r.config.resourceNamer(r, req)
112111
httptrace.TraceAndServe(r.Router, w, req, &httptrace.ServeConfig{
113112
Framework: "github.com/gorilla/mux",
114113
Service: r.config.serviceName,
114+
ServiceSource: r.config.serviceSource,
115115
Resource: resource,
116116
FinishOpts: r.config.finishOpts,
117117
SpanOpts: spanopts,

0 commit comments

Comments
 (0)