Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add service target fields support to azure module #1280

Merged
merged 9 commits into from
Aug 1, 2022
4 changes: 4 additions & 0 deletions module/apmazure/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (b *blobRPC) subtype() string {
return "azureblob"
}

func (b *blobRPC) serviceName() string {
return ""
}

func (b *blobRPC) storageAccountName() string {
return b.accountName
}
Expand Down
4 changes: 4 additions & 0 deletions module/apmazure/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (f *fileRPC) subtype() string {
return "azurefile"
}

func (f *fileRPC) serviceName() string {
return ""
}

func (f *fileRPC) storageAccountName() string {
return f.accountName
}
Expand Down
4 changes: 4 additions & 0 deletions module/apmazure/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (q *queueRPC) subtype() string {
return "azurequeue"
}

func (q *queueRPC) serviceName() string {
return q.accountName
}

func (q *queueRPC) storageAccountName() string {
return q.accountName
}
Expand Down
4 changes: 4 additions & 0 deletions module/apmazure/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func TestQueueSend(t *testing.T) {
assert.Equal(t, "fakeaccnt.queue.core.windows.net", destination.Address)
assert.Equal(t, 443, destination.Port)
assert.Equal(t, "azurequeue/fakeaccnt", destination.Service.Resource)
assert.Equal(t, "azurequeue", span.Context.Service.Target.Type)
assert.Equal(t, "fakeaccnt", span.Context.Service.Target.Name)
}

func TestQueueReceive(t *testing.T) {
Expand Down Expand Up @@ -86,6 +88,8 @@ func TestQueueReceive(t *testing.T) {
assert.Equal(t, "fakeaccnt.queue.core.windows.net", destination.Address)
assert.Equal(t, 443, destination.Port)
assert.Equal(t, "azurequeue/fakeaccnt", destination.Service.Resource)
assert.Equal(t, "azurequeue", span.Context.Service.Target.Type)
assert.Equal(t, "fakeaccnt", span.Context.Service.Target.Name)
}

func TestQueueGetOperation(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions module/apmazure/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (p *apmPipeline) Do(
span.Context.SetDestinationService(apm.DestinationServiceSpanContext{
Resource: rpc.subtype() + "/" + rpc.storageAccountName(),
})
span.Context.SetServiceTarget(apm.ServiceTargetSpanContext{
Type: rpc.subtype(),
Name: rpc.serviceName(),
})

resp, err := p.next.Do(ctx, methodFactory, req)
if err != nil {
Expand All @@ -127,6 +131,7 @@ type azureRPC interface {
name() string
_type() string
subtype() string
serviceName() string
kruskall marked this conversation as resolved.
Show resolved Hide resolved
storageAccountName() string
resource() string
operation() string
Expand Down