-
Notifications
You must be signed in to change notification settings - Fork 115
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
Clarify http(s) default port handling for service.target_name #700
Conversation
3562d46
to
8670c85
Compare
I don't see any discussion in #627 (the PR introducing To a degree, the else if (context.http?.url)
if (context.http.url.port > 0)
"${context.http.url.host}:${context.http.url.port}"
else if (context.http.url.host)
context.http.url.host So I agree with your clarification. asideA possible wrinkle is the OTel Bridge spec. This pseudo-code in the OTel Bridge spec: } else if (a['http.url'] || a['http.scheme']) {
type = 'external';
subtype = 'http';
serviceTargetType = subtype;
httpHost = a['http.host'] || netPeer;
if (httpHost) {
if (netPort < 0) {
netPort = httpPortFromScheme(a['http.scheme']);
}
serviceTargetName = netPort < 0 ? httpHost : httpHost + ':' + netPort;
} else if (a['http.url']) {
serviceTargetName = parseNetName(a['http.url']);
}
} suggests that a default port (for 'http' and 'https') should be used. @SylvainJuge How much do we care to make these match?
:) |
Thanks for taking such a detailed look @trentm. I was not aware of that OTel Bridge spec, thanks for bringing it up. My gut feeling would be to aim for consistency in our specs. ad 2) Did you mean to say "... excluding the default port."? Otherwise, we would have the exact opposite effect and produce different values for |
I agree that aiming for consistency would be good.
Actually I meant to bias to including the default port, so that we would tend to have I might be missing something about how |
ad 2 again) Sorry for this confusion, for some reason, I always read Thinking about this some more, I can see the value of including the ports in
|
Definitely agree. I'd like to hear input from others to see if there are downsides/objections to changing the specs to prefer adding a default port to |
Since we need to reach a consensus first, in which direction this PR should actually go (include ports: yes/no), I moved it into draft state for now and opened a dedicated discussion ticket: #703 |
I updated the PR and its description. |
In the related discussion (#703) the feedback I had so far was "go with this approach" so I'll mark this "Ready for review" again. |
When working on elastic/apm-agent-dotnet#1836 (span service inference tests) I encountered this:
While our JSON test spec is very explicit about the presence of ports, the pseudo-code in https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans-service-target.md#implementation-details only refers to a helper function
getPortFromUrl
that does not specify how to handle default HTTP ports (80/443).Assuming that the test spec is the authoritative source, the
expected_resource
is clearly without a (default) port number,so I think we should also state this in the pseudo-code.Update (28.10.2022)
After discussing this some more on #703 and in the agent weekly, I changed the direction of this PR to making the ports mandatory.
For that, I also changed the format of the
http
input data, as the existing format had a few shortcomings:"port" : -1
) were hypothetical.Before:
Now: