Implement HTTP Endpoint Inference for Trace Resource Renaming (RFC-1051) #10393
Implement HTTP Endpoint Inference for Trace Resource Renaming (RFC-1051) #10393
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 10 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.066 s) : 0, 1066469
Total [baseline] (10.864 s) : 0, 10864134
Agent [candidate] (1.066 s) : 0, 1065948
Total [candidate] (10.767 s) : 0, 10766726
section appsec
Agent [baseline] (1.241 s) : 0, 1240788
Total [baseline] (10.959 s) : 0, 10958997
Agent [candidate] (1.239 s) : 0, 1238538
Total [candidate] (10.971 s) : 0, 10970624
section iast
Agent [baseline] (1.238 s) : 0, 1237978
Total [baseline] (11.163 s) : 0, 11162834
Agent [candidate] (1.233 s) : 0, 1233048
Total [candidate] (11.209 s) : 0, 11208523
section profiling
Agent [baseline] (1.199 s) : 0, 1198596
Total [baseline] (11.077 s) : 0, 11077013
Agent [candidate] (1.191 s) : 0, 1191090
Total [candidate] (10.985 s) : 0, 10984919
gantt
title petclinic - break down per module: candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.181 ms) : 0, 1181
crashtracking [candidate] (1.187 ms) : 0, 1187
BytebuddyAgent [baseline] (628.979 ms) : 0, 628979
BytebuddyAgent [candidate] (628.237 ms) : 0, 628237
AgentMeter [baseline] (28.919 ms) : 0, 28919
AgentMeter [candidate] (28.848 ms) : 0, 28848
GlobalTracer [baseline] (258.148 ms) : 0, 258148
GlobalTracer [candidate] (257.84 ms) : 0, 257840
AppSec [baseline] (33.023 ms) : 0, 33023
AppSec [candidate] (32.646 ms) : 0, 32646
Debugger [baseline] (62.6 ms) : 0, 62600
Debugger [candidate] (62.611 ms) : 0, 62611
Remote Config [baseline] (606.002 µs) : 0, 606
Remote Config [candidate] (610.896 µs) : 0, 611
Telemetry [baseline] (12.209 ms) : 0, 12209
Telemetry [candidate] (13.022 ms) : 0, 13022
Flare Poller [baseline] (5.348 ms) : 0, 5348
Flare Poller [candidate] (5.42 ms) : 0, 5420
section appsec
crashtracking [baseline] (1.185 ms) : 0, 1185
crashtracking [candidate] (1.18 ms) : 0, 1180
BytebuddyAgent [baseline] (659.021 ms) : 0, 659021
BytebuddyAgent [candidate] (657.54 ms) : 0, 657540
AgentMeter [baseline] (11.939 ms) : 0, 11939
AgentMeter [candidate] (11.87 ms) : 0, 11870
GlobalTracer [baseline] (259.115 ms) : 0, 259115
GlobalTracer [candidate] (258.637 ms) : 0, 258637
AppSec [baseline] (167.958 ms) : 0, 167958
AppSec [candidate] (167.66 ms) : 0, 167660
Debugger [baseline] (67.494 ms) : 0, 67494
Debugger [candidate] (67.406 ms) : 0, 67406
Remote Config [baseline] (679.6 µs) : 0, 680
Remote Config [candidate] (665.504 µs) : 0, 666
Telemetry [baseline] (9.159 ms) : 0, 9159
Telemetry [candidate] (9.201 ms) : 0, 9201
Flare Poller [baseline] (3.632 ms) : 0, 3632
Flare Poller [candidate] (3.706 ms) : 0, 3706
IAST [baseline] (25.141 ms) : 0, 25141
IAST [candidate] (25.307 ms) : 0, 25307
section iast
crashtracking [baseline] (1.196 ms) : 0, 1196
crashtracking [candidate] (1.182 ms) : 0, 1182
BytebuddyAgent [baseline] (800.909 ms) : 0, 800909
BytebuddyAgent [candidate] (796.375 ms) : 0, 796375
AgentMeter [baseline] (11.527 ms) : 0, 11527
AgentMeter [candidate] (11.255 ms) : 0, 11255
GlobalTracer [baseline] (248.619 ms) : 0, 248619
GlobalTracer [candidate] (248.679 ms) : 0, 248679
AppSec [baseline] (34.783 ms) : 0, 34783
AppSec [candidate] (33.079 ms) : 0, 33079
Debugger [baseline] (65.598 ms) : 0, 65598
Debugger [candidate] (67.319 ms) : 0, 67319
Remote Config [baseline] (552.709 µs) : 0, 553
Remote Config [candidate] (546.386 µs) : 0, 546
Telemetry [baseline] (8.621 ms) : 0, 8621
Telemetry [candidate] (8.701 ms) : 0, 8701
Flare Poller [baseline] (3.425 ms) : 0, 3425
Flare Poller [candidate] (3.517 ms) : 0, 3517
IAST [baseline] (27.257 ms) : 0, 27257
IAST [candidate] (27.081 ms) : 0, 27081
section profiling
ProfilingAgent [baseline] (99.92 ms) : 0, 99920
ProfilingAgent [candidate] (99.39 ms) : 0, 99390
crashtracking [baseline] (1.219 ms) : 0, 1219
crashtracking [candidate] (1.218 ms) : 0, 1218
BytebuddyAgent [baseline] (686.826 ms) : 0, 686826
BytebuddyAgent [candidate] (682.14 ms) : 0, 682140
AgentMeter [baseline] (8.823 ms) : 0, 8823
AgentMeter [candidate] (8.828 ms) : 0, 8828
GlobalTracer [baseline] (217.003 ms) : 0, 217003
GlobalTracer [candidate] (216.504 ms) : 0, 216504
AppSec [baseline] (32.804 ms) : 0, 32804
AppSec [candidate] (32.407 ms) : 0, 32407
Debugger [baseline] (68.452 ms) : 0, 68452
Debugger [candidate] (67.351 ms) : 0, 67351
Remote Config [baseline] (603.955 µs) : 0, 604
Remote Config [candidate] (613.934 µs) : 0, 614
Telemetry [baseline] (8.849 ms) : 0, 8849
Telemetry [candidate] (8.875 ms) : 0, 8875
Flare Poller [baseline] (3.792 ms) : 0, 3792
Flare Poller [candidate] (3.784 ms) : 0, 3784
Profiling [baseline] (100.499 ms) : 0, 100499
Profiling [candidate] (99.963 ms) : 0, 99963
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.07 s) : 0, 1070390
Total [baseline] (8.74 s) : 0, 8739916
Agent [candidate] (1.064 s) : 0, 1063701
Total [candidate] (8.733 s) : 0, 8732660
section iast
Agent [baseline] (1.23 s) : 0, 1230395
Total [baseline] (9.368 s) : 0, 9368388
Agent [candidate] (1.237 s) : 0, 1236515
Total [candidate] (9.352 s) : 0, 9352387
gantt
title insecure-bank - break down per module: candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.212 ms) : 0, 1212
crashtracking [candidate] (1.184 ms) : 0, 1184
BytebuddyAgent [baseline] (631.787 ms) : 0, 631787
BytebuddyAgent [candidate] (628.059 ms) : 0, 628059
AgentMeter [baseline] (28.943 ms) : 0, 28943
AgentMeter [candidate] (28.895 ms) : 0, 28895
GlobalTracer [baseline] (259.356 ms) : 0, 259356
GlobalTracer [candidate] (257.896 ms) : 0, 257896
AppSec [baseline] (33.038 ms) : 0, 33038
AppSec [candidate] (32.982 ms) : 0, 32982
Debugger [baseline] (60.523 ms) : 0, 60523
Debugger [candidate] (60.364 ms) : 0, 60364
Remote Config [baseline] (613.641 µs) : 0, 614
Remote Config [candidate] (621.112 µs) : 0, 621
Telemetry [baseline] (12.288 ms) : 0, 12288
Telemetry [candidate] (13.842 ms) : 0, 13842
Flare Poller [baseline] (6.998 ms) : 0, 6998
Flare Poller [candidate] (4.596 ms) : 0, 4596
section iast
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.201 ms) : 0, 1201
BytebuddyAgent [baseline] (795.431 ms) : 0, 795431
BytebuddyAgent [candidate] (800.043 ms) : 0, 800043
AgentMeter [baseline] (11.306 ms) : 0, 11306
AgentMeter [candidate] (11.518 ms) : 0, 11518
GlobalTracer [baseline] (247.542 ms) : 0, 247542
GlobalTracer [candidate] (248.278 ms) : 0, 248278
AppSec [baseline] (34.108 ms) : 0, 34108
AppSec [candidate] (34.741 ms) : 0, 34741
Debugger [baseline] (65.745 ms) : 0, 65745
Debugger [candidate] (65.449 ms) : 0, 65449
Remote Config [baseline] (547.055 µs) : 0, 547
Remote Config [candidate] (566.672 µs) : 0, 567
Telemetry [baseline] (8.644 ms) : 0, 8644
Telemetry [candidate] (8.674 ms) : 0, 8674
Flare Poller [baseline] (3.489 ms) : 0, 3489
Flare Poller [candidate] (3.511 ms) : 0, 3511
IAST [baseline] (27.048 ms) : 0, 27048
IAST [candidate] (26.943 ms) : 0, 26943
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 2 performance regressions! Performance is the same for 16 metrics, 16 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section baseline
no_agent (1.194 ms) : 1182, 1206
. : milestone, 1194,
iast (3.107 ms) : 3064, 3149
. : milestone, 3107,
iast_FULL (5.674 ms) : 5617, 5730
. : milestone, 5674,
iast_GLOBAL (3.559 ms) : 3495, 3623
. : milestone, 3559,
profiling (2.169 ms) : 2149, 2189
. : milestone, 2169,
tracing (1.772 ms) : 1757, 1786
. : milestone, 1772,
section candidate
no_agent (1.174 ms) : 1163, 1185
. : milestone, 1174,
iast (3.233 ms) : 3188, 3278
. : milestone, 3233,
iast_FULL (5.745 ms) : 5688, 5802
. : milestone, 5745,
iast_GLOBAL (3.507 ms) : 3450, 3564
. : milestone, 3507,
profiling (2.055 ms) : 2036, 2074
. : milestone, 2055,
tracing (1.842 ms) : 1827, 1857
. : milestone, 1842,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section baseline
no_agent (17.899 ms) : 17717, 18082
. : milestone, 17899,
appsec (18.575 ms) : 18385, 18765
. : milestone, 18575,
code_origins (17.453 ms) : 17277, 17628
. : milestone, 17453,
iast (18.753 ms) : 18563, 18943
. : milestone, 18753,
profiling (18.77 ms) : 18581, 18958
. : milestone, 18770,
tracing (17.455 ms) : 17284, 17627
. : milestone, 17455,
section candidate
no_agent (18.206 ms) : 18020, 18392
. : milestone, 18206,
appsec (18.355 ms) : 18174, 18536
. : milestone, 18355,
code_origins (17.456 ms) : 17279, 17632
. : milestone, 17456,
iast (17.569 ms) : 17397, 17742
. : milestone, 17569,
profiling (18.571 ms) : 18388, 18754
. : milestone, 18571,
tracing (17.545 ms) : 17367, 17722
. : milestone, 17545,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section baseline
no_agent (1.467 ms) : 1455, 1478
. : milestone, 1467,
appsec (2.492 ms) : 2436, 2547
. : milestone, 2492,
iast (2.247 ms) : 2178, 2316
. : milestone, 2247,
iast_GLOBAL (2.3 ms) : 2230, 2370
. : milestone, 2300,
profiling (2.1 ms) : 2043, 2157
. : milestone, 2100,
tracing (2.056 ms) : 2003, 2110
. : milestone, 2056,
section candidate
no_agent (1.469 ms) : 1457, 1480
. : milestone, 1469,
appsec (3.768 ms) : 3546, 3989
. : milestone, 3768,
iast (2.245 ms) : 2176, 2314
. : milestone, 2245,
iast_GLOBAL (2.296 ms) : 2226, 2365
. : milestone, 2296,
profiling (2.099 ms) : 2042, 2156
. : milestone, 2099,
tracing (2.052 ms) : 1999, 2106
. : milestone, 2052,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~eab007da22, baseline=1.60.0-SNAPSHOT~4d7c8834b6
dateFormat X
axisFormat %s
section baseline
no_agent (15.216 s) : 15216000, 15216000
. : milestone, 15216000,
appsec (15.043 s) : 15043000, 15043000
. : milestone, 15043000,
iast (18.419 s) : 18419000, 18419000
. : milestone, 18419000,
iast_GLOBAL (18.16 s) : 18160000, 18160000
. : milestone, 18160000,
profiling (14.703 s) : 14703000, 14703000
. : milestone, 14703000,
tracing (14.625 s) : 14625000, 14625000
. : milestone, 14625000,
section candidate
no_agent (15.547 s) : 15547000, 15547000
. : milestone, 15547000,
appsec (14.981 s) : 14981000, 14981000
. : milestone, 14981000,
iast (17.809 s) : 17809000, 17809000
. : milestone, 17809000,
iast_GLOBAL (18.072 s) : 18072000, 18072000
. : milestone, 18072000,
profiling (15.16 s) : 15160000, 15160000
. : milestone, 15160000,
tracing (14.69 s) : 14690000, 14690000
. : milestone, 14690000,
|
c8d180b to
daa5a49
Compare
| this.isTraceRoot = isTraceRoot; | ||
| this.spanKind = null == spanKind ? EMPTY : UTF8BytesString.create(spanKind); | ||
| this.peerTags = peerTags == null ? Collections.emptyList() : peerTags; | ||
| this.httpMethod = null == httpMethod ? EMPTY : UTF8BytesString.create(httpMethod); |
There was a problem hiding this comment.
if the feature is opt-in I think you should not add aggregation dimentions for httpMethod and httpEndpoint if disabled otherwise the metrics buckets will change
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c46dc2faf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
dd-trace-core/src/main/java/datadog/trace/core/endpoint/EndpointResolver.java
Show resolved
Hide resolved
c27ecbb to
b6fd7f4
Compare
| public static final byte HTTP_404 = 2; | ||
| public static final byte HTTP_FRAMEWORK_ROUTE = 3; | ||
| public static final byte RPC_COMMAND_NAME = 3; | ||
| public static final byte HTTP_SERVER_RESOURCE_RENAMING = 4; |
There was a problem hiding this comment.
should thisbe actually 3 and not 4? Since 4 is for user configured mapping and I'm wondering if this should take always precendence
| + (includeEndpointInHash ? 28_629_151 * this.httpMethod.hashCode() : 0) | ||
| + (includeEndpointInHash ? 923_521 * this.httpEndpoint.hashCode() : 0) |
There was a problem hiding this comment.
Perhaps just relying in classic nullchecks on the member would have been less error prone? i.e.
+ ? 28_629_151 * (this.httpMethod != null ? this.httpMethod.hashCode() : 0)
|
|
||
| if (endpoint != null && !endpoint.isEmpty()) { | ||
| // Combine method and endpoint into resource name | ||
| String resourceName = httpMethod + " " + endpoint; |
There was a problem hiding this comment.
resource names have a cache to avoid creating strings (and also caching UTF byte conversions). Would it be possible to have the same here?
|
|
||
| // Resolve endpoint using EndpointResolver | ||
| // Pass unsafeTags directly - it's safe to use at this point since span is finished | ||
| String endpoint = endpointResolver.resolveEndpoint(unsafeTags, httpRoute, httpUrl); |
There was a problem hiding this comment.
I'm wondering if adding a try-catch-trowable around is worth since this processor runs on the finish code path
b6fd7f4 to
196140a
Compare
|
Thanks a lot for your comments @amarziali!!! |
amarziali
left a comment
There was a problem hiding this comment.
Looks OK. Thanks for having taken into account the previous comments.
What Does This Do
This PR implements automatic HTTP endpoint inference to improve trace resource naming and reduce cardinality in APM metrics. When http.route is unavailable or unreliable, the tracer now computes a simplified endpoint from the URL path by replacing dynamic segments (IDs, UUIDs, long strings) with standardized placeholders.
Changes
{param:int}, {param:int_id}, {param:hex}, {param:hex_id}, {param:str}{METHOD} {endpoint}DD_TRACE_RESOURCE_RENAMING_ENABLED: Main feature flagDD_APPSEC_ENABLED=true)DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT: Testing flagMotivation
RFC
Additional Notes
Confirmed, it passes the ST
Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: APPSEC-58611