-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add azure-functions instrumentation #8432
Add azure-functions instrumentation #8432
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 5 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.039 s) : 0, 1039183
Total [baseline] (10.463 s) : 0, 10463131
Agent [candidate] (1.041 s) : 0, 1040667
Total [candidate] (10.342 s) : 0, 10341932
section appsec
Agent [baseline] (1.181 s) : 0, 1181474
Total [baseline] (10.752 s) : 0, 10751959
Agent [candidate] (1.182 s) : 0, 1181775
Total [candidate] (10.716 s) : 0, 10715711
section iast
Agent [baseline] (1.177 s) : 0, 1176574
Total [baseline] (10.997 s) : 0, 10997068
Agent [candidate] (1.179 s) : 0, 1179298
Total [candidate] (11.027 s) : 0, 11026763
section profiling
Agent [baseline] (1.263 s) : 0, 1262594
Total [baseline] (10.838 s) : 0, 10838179
Agent [candidate] (1.259 s) : 0, 1259377
Total [candidate] (10.823 s) : 0, 10822857
gantt
title petclinic - break down per module: candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (717.486 ms) : 0, 717486
BytebuddyAgent [candidate] (717.05 ms) : 0, 717050
GlobalTracer [baseline] (239.118 ms) : 0, 239118
GlobalTracer [candidate] (239.18 ms) : 0, 239180
AppSec [baseline] (55.55 ms) : 0, 55550
AppSec [candidate] (55.421 ms) : 0, 55421
Remote Config [baseline] (715.632 µs) : 0, 716
Remote Config [candidate] (705.361 µs) : 0, 705
Telemetry [baseline] (11.359 ms) : 0, 11359
Telemetry [candidate] (13.023 ms) : 0, 13023
section appsec
BytebuddyAgent [baseline] (733.953 ms) : 0, 733953
BytebuddyAgent [candidate] (735.064 ms) : 0, 735064
GlobalTracer [baseline] (235.746 ms) : 0, 235746
GlobalTracer [candidate] (236.208 ms) : 0, 236208
AppSec [baseline] (177.245 ms) : 0, 177245
AppSec [candidate] (175.597 ms) : 0, 175597
Remote Config [baseline] (654.191 µs) : 0, 654
Remote Config [candidate] (662.772 µs) : 0, 663
Telemetry [baseline] (8.232 ms) : 0, 8232
Telemetry [candidate] (8.303 ms) : 0, 8303
IAST [baseline] (21.392 ms) : 0, 21392
IAST [candidate] (21.284 ms) : 0, 21284
section iast
BytebuddyAgent [baseline] (841.31 ms) : 0, 841310
BytebuddyAgent [candidate] (842.378 ms) : 0, 842378
GlobalTracer [baseline] (230.572 ms) : 0, 230572
GlobalTracer [candidate] (231.767 ms) : 0, 231767
AppSec [baseline] (57.293 ms) : 0, 57293
AppSec [candidate] (57.419 ms) : 0, 57419
Remote Config [baseline] (614.145 µs) : 0, 614
Remote Config [candidate] (616.409 µs) : 0, 616
Telemetry [baseline] (8.729 ms) : 0, 8729
Telemetry [candidate] (8.783 ms) : 0, 8783
IAST [baseline] (22.972 ms) : 0, 22972
IAST [candidate] (22.96 ms) : 0, 22960
section profiling
BytebuddyAgent [baseline] (710.961 ms) : 0, 710961
BytebuddyAgent [candidate] (707.897 ms) : 0, 707897
GlobalTracer [baseline] (349.443 ms) : 0, 349443
GlobalTracer [candidate] (348.866 ms) : 0, 348866
AppSec [baseline] (55.502 ms) : 0, 55502
AppSec [candidate] (54.477 ms) : 0, 54477
Remote Config [baseline] (668.14 µs) : 0, 668
Remote Config [candidate] (690.567 µs) : 0, 691
Telemetry [baseline] (8.937 ms) : 0, 8937
Telemetry [candidate] (8.93 ms) : 0, 8930
ProfilingAgent [baseline] (96.464 ms) : 0, 96464
ProfilingAgent [candidate] (96.132 ms) : 0, 96132
Profiling [baseline] (96.488 ms) : 0, 96488
Profiling [candidate] (96.155 ms) : 0, 96155
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.036 s) : 0, 1035957
Total [baseline] (8.685 s) : 0, 8684870
Agent [candidate] (1.045 s) : 0, 1045488
Total [candidate] (8.717 s) : 0, 8716674
section iast
Agent [baseline] (1.169 s) : 0, 1168673
Total [baseline] (9.239 s) : 0, 9239304
Agent [candidate] (1.179 s) : 0, 1178904
Total [candidate] (9.26 s) : 0, 9259986
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.178 s) : 0, 1177644
Total [baseline] (9.195 s) : 0, 9194891
Agent [candidate] (1.172 s) : 0, 1171527
Total [candidate] (9.205 s) : 0, 9204824
section iast_TELEMETRY_OFF
Agent [baseline] (1.179 s) : 0, 1179337
Total [baseline] (9.23 s) : 0, 9229760
Agent [candidate] (1.171 s) : 0, 1170540
Total [candidate] (9.232 s) : 0, 9232338
gantt
title insecure-bank - break down per module: candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (716.144 ms) : 0, 716144
BytebuddyAgent [candidate] (721.564 ms) : 0, 721564
GlobalTracer [baseline] (238.639 ms) : 0, 238639
GlobalTracer [candidate] (239.805 ms) : 0, 239805
AppSec [baseline] (55.521 ms) : 0, 55521
AppSec [candidate] (55.272 ms) : 0, 55272
Remote Config [baseline] (700.984 µs) : 0, 701
Remote Config [candidate] (697.125 µs) : 0, 697
Telemetry [baseline] (9.974 ms) : 0, 9974
Telemetry [candidate] (12.851 ms) : 0, 12851
section iast
BytebuddyAgent [baseline] (835.317 ms) : 0, 835317
BytebuddyAgent [candidate] (843.3 ms) : 0, 843300
GlobalTracer [baseline] (229.565 ms) : 0, 229565
GlobalTracer [candidate] (231.016 ms) : 0, 231016
AppSec [baseline] (56.679 ms) : 0, 56679
AppSec [candidate] (57.091 ms) : 0, 57091
Remote Config [baseline] (610.469 µs) : 0, 610
Remote Config [candidate] (620.448 µs) : 0, 620
Telemetry [baseline] (8.668 ms) : 0, 8668
Telemetry [candidate] (8.626 ms) : 0, 8626
IAST [baseline] (22.849 ms) : 0, 22849
IAST [candidate] (22.721 ms) : 0, 22721
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (841.283 ms) : 0, 841283
BytebuddyAgent [candidate] (836.68 ms) : 0, 836680
GlobalTracer [baseline] (230.693 ms) : 0, 230693
GlobalTracer [candidate] (230.004 ms) : 0, 230004
AppSec [baseline] (57.973 ms) : 0, 57973
AppSec [candidate] (57.405 ms) : 0, 57405
Remote Config [baseline] (619.299 µs) : 0, 619
Remote Config [candidate] (607.101 µs) : 0, 607
Telemetry [baseline] (8.906 ms) : 0, 8906
Telemetry [candidate] (8.683 ms) : 0, 8683
IAST [baseline] (23.119 ms) : 0, 23119
IAST [candidate] (22.88 ms) : 0, 22880
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (843.095 ms) : 0, 843095
BytebuddyAgent [candidate] (835.29 ms) : 0, 835290
GlobalTracer [baseline] (231.97 ms) : 0, 231970
GlobalTracer [candidate] (230.945 ms) : 0, 230945
AppSec [baseline] (53.377 ms) : 0, 53377
AppSec [candidate] (56.572 ms) : 0, 56572
Remote Config [baseline] (624.509 µs) : 0, 625
Remote Config [candidate] (622.667 µs) : 0, 623
Telemetry [baseline] (8.676 ms) : 0, 8676
Telemetry [candidate] (8.63 ms) : 0, 8630
IAST [baseline] (26.527 ms) : 0, 26527
IAST [candidate] (23.205 ms) : 0, 23205
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 13 metrics, 17 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section baseline
no_agent (386.721 µs) : 366, 407
. : milestone, 387,
iast (518.372 µs) : 496, 541
. : milestone, 518,
iast_FULL (734.914 µs) : 713, 757
. : milestone, 735,
iast_GLOBAL (558.922 µs) : 537, 581
. : milestone, 559,
iast_HARDCODED_SECRET_DISABLED (516.824 µs) : 495, 539
. : milestone, 517,
iast_INACTIVE (464.428 µs) : 443, 486
. : milestone, 464,
iast_TELEMETRY_OFF (500.717 µs) : 479, 523
. : milestone, 501,
tracing (463.853 µs) : 442, 486
. : milestone, 464,
section candidate
no_agent (386.802 µs) : 367, 406
. : milestone, 387,
iast (513.684 µs) : 491, 537
. : milestone, 514,
iast_FULL (738.247 µs) : 716, 760
. : milestone, 738,
iast_GLOBAL (570.869 µs) : 548, 593
. : milestone, 571,
iast_HARDCODED_SECRET_DISABLED (519.615 µs) : 498, 541
. : milestone, 520,
iast_INACTIVE (462.716 µs) : 442, 484
. : milestone, 463,
iast_TELEMETRY_OFF (502.153 µs) : 479, 525
. : milestone, 502,
tracing (463.23 µs) : 442, 485
. : milestone, 463,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section baseline
no_agent (1.366 ms) : 1346, 1386
. : milestone, 1366,
appsec (1.764 ms) : 1740, 1788
. : milestone, 1764,
appsec_no_iast (1.77 ms) : 1746, 1794
. : milestone, 1770,
code_origins (1.688 ms) : 1655, 1721
. : milestone, 1688,
iast (1.524 ms) : 1499, 1548
. : milestone, 1524,
profiling (1.542 ms) : 1516, 1567
. : milestone, 1542,
tracing (1.513 ms) : 1489, 1537
. : milestone, 1513,
section candidate
no_agent (1.367 ms) : 1347, 1387
. : milestone, 1367,
appsec (1.768 ms) : 1745, 1792
. : milestone, 1768,
appsec_no_iast (1.753 ms) : 1730, 1777
. : milestone, 1753,
code_origins (1.685 ms) : 1651, 1719
. : milestone, 1685,
iast (1.528 ms) : 1504, 1551
. : milestone, 1528,
profiling (1.555 ms) : 1531, 1580
. : milestone, 1555,
tracing (1.513 ms) : 1489, 1537
. : milestone, 1513,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section baseline
no_agent (15.055 s) : 15055000, 15055000
. : milestone, 15055000,
appsec (15.142 s) : 15142000, 15142000
. : milestone, 15142000,
iast (19.222 s) : 19222000, 19222000
. : milestone, 19222000,
iast_GLOBAL (18.054 s) : 18054000, 18054000
. : milestone, 18054000,
profiling (15.535 s) : 15535000, 15535000
. : milestone, 15535000,
tracing (15.05 s) : 15050000, 15050000
. : milestone, 15050000,
section candidate
no_agent (15.408 s) : 15408000, 15408000
. : milestone, 15408000,
appsec (15.064 s) : 15064000, 15064000
. : milestone, 15064000,
iast (18.581 s) : 18581000, 18581000
. : milestone, 18581000,
iast_GLOBAL (18.199 s) : 18199000, 18199000
. : milestone, 18199000,
profiling (14.901 s) : 14901000, 14901000
. : milestone, 14901000,
tracing (15.051 s) : 15051000, 15051000
. : milestone, 15051000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~a40817f409, baseline=1.47.0-SNAPSHOT~9e4966b4a4
dateFormat X
axisFormat %s
section baseline
no_agent (1.481 ms) : 1469, 1493
. : milestone, 1481,
appsec (2.377 ms) : 2333, 2421
. : milestone, 2377,
iast (2.125 ms) : 2070, 2179
. : milestone, 2125,
iast_GLOBAL (2.172 ms) : 2116, 2228
. : milestone, 2172,
profiling (2.003 ms) : 1958, 2047
. : milestone, 2003,
tracing (1.958 ms) : 1915, 2000
. : milestone, 1958,
section candidate
no_agent (1.478 ms) : 1466, 1489
. : milestone, 1478,
appsec (2.373 ms) : 2329, 2416
. : milestone, 2373,
iast (2.125 ms) : 2070, 2180
. : milestone, 2125,
iast_GLOBAL (2.166 ms) : 2110, 2221
. : milestone, 2166,
profiling (1.989 ms) : 1945, 2034
. : milestone, 1989,
tracing (1.954 ms) : 1912, 1997
. : milestone, 1954,
|
pass { | ||
group = 'com.microsoft.azure.functions' | ||
module = 'azure-functions-java-library' | ||
versions = '[1.2.2,)' |
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 think you're targeting this one and not earlier versions because it's the oldest one targeting Java 8 ?
A round major version as lower bound is pretty standard, but a specific version like this deserves a comment I think.
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.
1.2.2
is the earliest stable version I was able to use. Using 1.2.0
results in an error (see below). Prior to 1.2.0
all versions are beta versions. I added a comment to reflect this in code.
The following artifacts could not be resolved: com.microsoft.maven:java-8-parent:pom:8.0.0-SNAPSHOT (absent)
public String hierarchyMarkerType() { | ||
return null; | ||
} |
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 wonder if the Instrumenter.ForTypeHierarchy
is the most relevant here, given that we return null here 🤔
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.
If we assume that "com.microsoft.azure.functions.annotation.FunctionName"
will be visible for any types using that annotation then I would suggest returning "com.microsoft.azure.functions.annotation.FunctionName"
here.
You can then change hierarchyMatcher
to return
return declaresMethod(isAnnotatedWith(named(hierarchyMarkerType())));
to avoid duplicating the constant in the code
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.
@mcculls When I update hierarchyMarkerType
to return com.microsoft.azure.functions.annotation.FunctionName
the class that should be instrumented appears to be skipped as I'm not seeing any spans created for it.
@Override
public String hierarchyMarkerType() {
return "com.microsoft.azure.functions.annotation.FunctionName";
}
For context here's an example of the class that should be instrumented. I wonder if it has something to do with how the Azure Function environment is loading classes?
https://github.com/DataDog/dd-trace-java/blob/95d4c18846c516e62cf7807aaa7ec361816c4478/dd-java-agent/instrumentation/azure-functions/src/test/groovy/Function.java
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.
it could be, in other words it sounds that we cannot assume that "com.microsoft.azure.functions.annotation.FunctionName" will be visible (as in defined as a resource) for any types using that annotation
If that's the case then it's fine to leave hierarchyMarkerType
as null
- just add a comment saying this was intentional because of the class-loading in the Azure Function environment
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.
Sounds good, I added a comment in code for this
if (azureFunctions) { | ||
defaultVersion = "v1"; |
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.
ah ? Why ? Can you add a comment to justify this ?
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.
To be consistent with the instrumentation in other runtimes (node, python) the operation name should be azure.functions.invoke
. I added a comment to reflect this in the code.
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 don't see any blocker
What Does This Do
Add azure-functions instrumentation for Http triggers.
Motivation
Automatically generate spans for http requests made to Azure Functions.
Additional Notes
Azure documentation
Testing in a function deployed to Azure
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: SVLS-5920