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

Conversation

kruskall
Copy link
Member

@apmmachine
Copy link
Contributor

apmmachine commented Jul 29, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-01T09:21:09.985+0000

  • Duration: 48 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 7475
Skipped 174
Total 7649

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@apmmachine
Copy link
Contributor

apmmachine commented Jul 29, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (59/59) 💚
Files 99.346% (152/153) 👍
Classes 96.275% (336/349) 👍
Methods 90.198% (957/1061) 👍
Lines 82.221% (11127/13533) 👍 0.019
Conditionals 100.0% (0/0) 💚

@@ -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.storageAccountName(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need to add another method to the azureRPC interface for this? The spec only mentions setting these fields for Azure Service Bus and Azure Queue Storage, and for those the name should be queue / topic.

Can you please have a dig into the spec, and/or check with the other agent devs, to find out what if anything we should set for other Azure services?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, right now there's no explicit guidance on what those fields should be:

See elastic/apm#661
See elastic/apm#646

From what I could gather, Type should fallback to subtype if empty.

See https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans-service-target.md#field-values

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so in the mean time let's just make sure to use the queue name for Queue storage. Currently we're using the account name, which does not match the updated spec.

We might want to use this to parse the queue name out of request URLs: https://github.com/Azure/azure-storage-queue-go/blob/636801874cdd196abace508ef19c3edca7ed0564/azqueue/parsing_urls.go#L24

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood! 👍

I went with a lighter solution but looking at this a bit more, it seems the current name and resource fields are using the account name (https://github.com/elastic/apm-agent-go/blob/main/module/apmazure/storage.go#L109 and https://github.com/elastic/apm-agent-go/blob/main/module/apmazure/queue.go#L36) but they should be using the queue name too.

I've updated the service target fields and left those for a followup PR.

@kruskall kruskall requested a review from axw July 31, 2022 23:23
module/apmazure/storage.go Outdated Show resolved Hide resolved
@@ -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.storageAccountName(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so in the mean time let's just make sure to use the queue name for Queue storage. Currently we're using the account name, which does not match the updated spec.

We might want to use this to parse the queue name out of request URLs: https://github.com/Azure/azure-storage-queue-go/blob/636801874cdd196abace508ef19c3edca7ed0564/azqueue/parsing_urls.go#L24

target name is now using the queue name instead of the account name.
Tests have been updated to use a correct url as specified in the
rest api documentation.

See https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-rest-api
strings Cut is not available on older versions of Go.
@kruskall kruskall requested a review from axw August 1, 2022 08:08
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kruskall kruskall merged commit 1ff0c49 into elastic:main Aug 1, 2022
@kruskall kruskall deleted the feat/add-service-target-azure branch August 1, 2022 10:20
v1v added a commit to v1v/apm-agent-go that referenced this pull request Sep 1, 2022
…hmark-reporting

* upstream/main: (25 commits)
  docs: update correct env flag for loglevel (elastic#1299)
  fix: readd deprecated span_frames_min_duration option as fallback for older configuration (elastic#1297)
  feat: rename span_frames_min_duration to span_stack_trace_min_duration (elastic#1285)
  test: verify Ubuntu cgroup line parsing for container ID (elastic#1293)
  tracer: Parse global labels per tracer (elastic#1290)
  feat: update sns span.name to reflect the current spec (elastic#1286)
  fix: expand k8s pod discovery regex (elastic#1288)
  test: add testcase for sqs delete_batch operation (elastic#1283)
  docs: document ELASTIC_APM_SERVER_CA_CERT_FILE (elastic#1289)
  fix: reformat code with go 1.19 to fix ci failure  (elastic#1284)
  feat: add service target fields support to elasticsearch module (elastic#1281)
  fix: use the correct destination resource and name for azure queue (elastic#1282)
  feat: add service target fields support to azure module (elastic#1280)
  feat: add service target fields support to aws module (elastic#1278)
  feat: add service target fields support to sql module (elastic#1279)
  synchronize json schema specs (elastic#1260)
  fix: make sure at least one of the service target fields is sent (elastic#1277)
  docs: add link to release-notes-2.x (elastic#1271)
  feat: add service target fields (elastic#1274)
  perf: skip tracestate regex validation for es vendor key (elastic#1275)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants