DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
440 stars 139 forks source link

AzureDevops SourceLink Url Incorrectly parsed #6146

Open crystalworks opened 3 hours ago

crystalworks commented 3 hours ago

Describe the bug It appears that the TryParseSourceLinkUrl method utilised by the AzureDevOpsSourceLinkUrlParser is delivering the incorrect Url

e.g.

this is picked up by sourcelink "https://dev.azure.com/organisation/project/_apis/git/repositories/example.shopping.api/items?api-version=1.0&versionType=commit&version=0e4d29442102e6cef1c271025d513c8b2187bcd6&path=/*"

and should give you

https://dev.azure.com/organisation/project/_git/example.shopping.api

but instead it gives you

https://dev.azure.com/organisation/_git/repositories

This was identified whilst configuring DORA in DataDog, the spans/traces came in with the incorrect url. the datadog-ci metadata upload appears to be working correctly.

To Reproduce Steps to reproduce the behavior:

  1. configure sourcelink with your project with APM configured from an ADO repo
  2. inspect traces in datadog and look at git.repository.id or git.repository_url

Example project with the logic isolated showcasing the issue attached example.zip

Expected behavior Expected behaviour is parser should correctly parse the url

Screenshots Image

Runtime environment (please complete the following information):

Additional context Noticed while configuring DORA CI

crystalworks commented 3 hours ago

related to this PR

https://github.com/DataDog/dd-trace-dotnet/pull/3652

https://github.com/DataDog/dd-trace-dotnet/pull/3652/commits/3e2ac47b5e52a5ef689fa447be88622ab5a0ab27#diff-9b7b769acc04de52667882cc56cb573a001586d6837f834c6f6b69c29d307c19

OmerRaviv commented 1 hour ago

@crystalworks Thank you for reporting this issue! I am investigating it and will keep you posted on our progress.