-
Notifications
You must be signed in to change notification settings - Fork 206
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
Change HttpClient Span.Name From "Method Host" To "Method URI" #463
Conversation
I can not open jenkins build detail and can not see why the cannot be build,please help check! |
@baiyunchen Thanks for the PR, I'm on it, no worries. Jenkins won't build until someone from the elastic org reviews it from security reasons - so no action needed from you. I'm thinking about this, I'll get back soon with a response to the PR. |
@@ -124,7 +124,7 @@ private void ProcessStartEvent(TRequest request, Uri requestUrl) | |||
|
|||
var currentExecutionSegment = _agent.Tracer.CurrentSpan ?? (IExecutionSegment)transaction; | |||
var span = currentExecutionSegment.StartSpan( | |||
$"{RequestGetMethod(request)} {requestUrl.Host}", | |||
$"{RequestGetMethod(request)} {requestUrl.AbsolutePath}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into this in more detail, and here is what I can say:
To get to the issue:
Because we are more concerned about which APIs are called and not which hosts when we analyze the call link.
You can figure this out by clicking on the method span - we show the whole URL which we set later in the cade here.
I know this is 1 click more than your solution, but the thinking behind this is to avoid overloading the UI - overall you definitely have the information you need.
Also, we try to standardize the span names across agents. We have this document stating that:
span name should have the format
<method> <host>
.
We also have this spreadsheet and as you can see there, all agents follow this format, except the Node.js agent - I’m trying to figure out why.
Now, specifically this line would introduce yet another format, so in this case it’d be <method> <path>
and currently no other agent generates span name based on this format. I still think whether we should change this, but in case we do, I’d suggest to at least do what the Node.js agent does and also include the host, so the span name should be something like <method> <host><path>
. I’m talking to other agent devs to figure out what we want to do here - happy to hear opinions on this.
Thanks Response. |
Is it possible to allow customization how to record span name ? |
Unfortunately currently I think we don't have anything that would give you this functionality. You can get the current span, here is how to do that: So with that you could do something like:
But in this situation this is probably not feasible. We are thinking about introducing filters - similar to what other agents offer. With that you'd have access to spans before they are send to the APM Server and you could do modifications on them. But this is not implemented and we don't really know if we'll do it in .NET yet. |
Thanks Response, I think that if it is difficult to adjust default Span.Name in the HttpClient, we can allow customize Span.Name format in HttpClient, but the default Span.Name remains unchanged to avoid the trouble of design changes. |
Hi @baiyunchen, We discussed this issue to see how this would work across all agents. To get to the point quickly: we decided to keep the current behavior. Here is why: We discussed other options like keeping the span name as it is, and maybe use a display name, or somehow compile the path into it when we show it on the UI. This is just an idea, and no work is done on it at the moment, but this would be a path that’d be probably a better approach. So, if you don’t mind we’d close this issue and not merge. I hope the proposed solutions (either manually changing the span name if possible, or just relaying on the fact that with 1 additional click you see the URL) still help you. Thanks, |
Thanks for the reply, I respect your decision. |
Currently, the .net core version http client records span.name = host, I think the span.name record is more reasonable as a URI. Because we are more concerned about which APIs are called and not which hosts when we analyze the call link.
Span.Name = "Method Host":
![image](https://user-images.githubusercontent.com/10071911/64027859-2e016900-cb74-11e9-8f97-65e218a65eac.png)
Span.Name = "Method URI":
![image](https://user-images.githubusercontent.com/10071911/64027998-6f921400-cb74-11e9-94a0-c887216c7feb.png)