@@ -38,22 +38,28 @@ public abstract class HttpAdapter<Req, Resp> {
38
38
@ Nullable public abstract String requestHeader (Req request , String name );
39
39
40
40
/**
41
- * An expression representing an application endpoint, used to group similar requests together.
41
+ * An expression such as "/items/:itemId" representing an application endpoint, conventionally
42
+ * associated with the tag key "http.route".
42
43
*
43
- * <p>For example, the template "/products/{key}", would match "/products/1" and "/products/2".
44
- * There is no format required for the encoding, as it is sometimes application defined. The
45
- * important part is that the value namespace is low cardinality.
44
+ * <p>The http route groups similar requests together, so results in limited cardinality, often
45
+ * better choice for a span name vs the http method. However, the route can be absent on redirect
46
+ * or file-not-found. Also, not all frameworks include support for http route expressions,
47
+ * and some don't expose templates programmatically for readback.
46
48
*
47
- * <p>Conventionally associated with the key "http.template"
49
+ * <p>For example, the route "/users/{userId}", matches "/users/25f4c31d" and "/users/e3c553be".
50
+ * If a span name function used the http path instead, it could DOS-style attack vector on your
51
+ * span name index, as it would grow unbounded vs "/users/{userId}". Even if different frameworks
52
+ * use different formats, like "/users/[0-9a-f]+" or "/users/:userId", the cardinality is still
53
+ * fixed with regards to request count.
48
54
*
49
- * <p>Eventhough the template is associated with the request, not the response, this is present
55
+ * <p>Eventhough the route is associated with the request, not the response, this is present
50
56
* on the response object. The reasons is that many server implementations process the request
51
57
* before they can identify the route route.
52
58
*/
53
59
// BRAVE5: It isn't possible for a user to easily consume HttpServerAdapter, which is why this
54
60
// method, while generally about the server, is pushed up to the HttpAdapter. The signatures for
55
61
// sampling and parsing could be changed to make it more convenient.
56
- @ Nullable public String template (Resp response ) {
62
+ @ Nullable public String route (Resp response ) {
57
63
return null ;
58
64
}
59
65
0 commit comments