datadog-agent
datadog-agent copied to clipboard
Update serverless-init Cloud Run service to support cloud run functions vs Cloud Functions
What does this PR do?
Update serverless-init Cloud Run service to support Cloud Run functions
This adds the other environmental variables returned by cloud run and cloud run functions into the tag array. K_CONFIGURATION, FUNCTION_SIGNATURE_TYPE, FUNCTION_TARGET
This also updates the metric prefix to be gcp.cloudfunction and the origin is cloudfunction
Motivation
Google Cloud Run Function now supports sidecars under cloud run
Additional Notes
Currently blocks PR #29057 which will update the origin to cloudrunfunction when we make this product GA
Possible Drawbacks / Trade-offs
Currently, this approach will work for all runtimes except Go. Which does not have any out of the box environmental variables we could use to mark a service as a cloud function source deploy. We will need to force the customer to add FUNCTION_TARGET to the variables during setup so that in datadog everything is tagged correctly
Describe how to test/QA your changes
added a new test case TestGetCloudRunFunctionTagsWithEnvironmentVariables you can also run all test locally by running go test -tags "test" -v ./cmd/serverless-init/...
Test changes on VM
Use this command from test-infra-definitions to manually test this PR changes on a VM:
inv create-vm --pipeline-id=44405040 --os-family=ubuntu
Note: This applies to commit b63215bc
Regression Detector
Regression Detector Results
Run ID: 9fd97ba8-2a83-438d-8e5c-60e26c2e9df6 Metrics dashboard Target profiles
Baseline: edc716fac20474b7ee0a0db327eeb1cc9babe0bc Comparison: b63215bc583afb9ece376caa425374bd918926b2
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
No significant changes in experiment optimization goals
Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%
There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +0.42 | [+0.37, +0.46] | 1 | Logs |
| ➖ | file_tree | memory utilization | +0.40 | [+0.29, +0.50] | 1 | Logs |
| ➖ | idle | memory utilization | +0.20 | [+0.16, +0.25] | 1 | Logs |
| ➖ | otel_to_otel_logs | ingress throughput | +0.07 | [-0.75, +0.89] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.00, +0.00] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.01, +0.01] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | -0.20 | [-0.96, +0.55] | 1 | Logs |
| ➖ | basic_py_check | % cpu utilization | -1.33 | [-4.11, +1.45] | 1 | Logs |
| ➖ | pycheck_lots_of_tags | % cpu utilization | -1.46 | [-4.09, +1.18] | 1 | Logs |
Bounds Checks
| perf | experiment | bounds_check_name | replicates_passed |
|---|---|---|---|
| ✅ | idle | memory_usage | 10/10 |
Explanation
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Go Package Import Differences
Baseline: edc716fac20474b7ee0a0db327eeb1cc9babe0bc Comparison: b63215bc583afb9ece376caa425374bd918926b2
| binary | os | arch | change |
|---|---|---|---|
| serverless | linux | amd64 | +0, -1
-github.com/DataDog/datadog-agent/cmd/serverless-init/cloudservice/helper
|
| serverless | linux | arm64 | +0, -1
-github.com/DataDog/datadog-agent/cmd/serverless-init/cloudservice/helper
|
Serverless Benchmark Results
BenchmarkStartEndInvocation comparison between edc716fac20474b7ee0a0db327eeb1cc9babe0bc and 24cc28dd514a8681c6430a7cd3c428d67892eca9.
tl;dr
Use these benchmarks as an insight tool during development.
-
Skim down the
vs basecolumn in each chart. If there is a~, then there was no statistically significant change to the benchmark. Otherwise, ensure the estimated percent change is either negative or very small. -
The last row of each chart is the
geomean. Ensure this percentage is either negative or very small.
What is this benchmarking?
The BenchmarkStartEndInvocation compares the amount of time it takes to call the start-invocation and end-invocation endpoints. For universal instrumentation languages (Dotnet, Golang, Java, Ruby), this represents the majority of the duration overhead added by our tracing layer.
The benchmark is run using a large variety of lambda request payloads. In the charts below, there is one row for each event payload type.
How do I interpret these charts?
The charts below comes from benchstat. They represent the statistical change in duration (sec/op), memory overhead (B/op), and allocations (allocs/op).
The benchstat docs explain how to interpret these charts.
Before the comparison table, we see common file-level configuration. If there are benchmarks with different configuration (for example, from different packages), benchstat will print separate tables for each configuration.
The table then compares the two input files for each benchmark. It shows the median and 95% confidence interval summaries for each benchmark before and after the change, and an A/B comparison under "vs base". ... The p-value measures how likely it is that any differences were due to random chance (i.e., noise). The "~" means benchstat did not detect a statistically significant difference between the two inputs. ...
Note that "statistically significant" is not the same as "large": with enough low-noise data, even very small changes can be distinguished from noise and considered statistically significant. It is, of course, generally easier to distinguish large changes from noise.
Finally, the last row of the table shows the geometric mean of each column, giving an overall picture of how the benchmarks changed. Proportional changes in the geomean reflect proportional changes in the benchmarks. For example, given n benchmarks, if sec/op for one of them increases by a factor of 2, then the sec/op geomean will increase by a factor of ⁿ√2.
I need more help
First off, do not worry if the benchmarks are failing. They are not tests. The intention is for them to be a tool for you to use during development.
If you would like a hand interpreting the results come chat with us in #serverless-agent in the internal DataDog slack or in #serverless in the public DataDog slack. We're happy to help!
Benchmark stats
goos: linux
goarch: amd64
pkg: github.com/DataDog/datadog-agent/pkg/serverless/daemon
cpu: AMD EPYC 7763 64-Core Processor
│ baseline/benchmark.log │ current/benchmark.log │
│ sec/op │ sec/op vs base │
api-gateway-appsec.json 86.02µ ± 3% 84.73µ ± 11% ~ (p=0.971 n=10)
api-gateway-kong-appsec.json 68.13µ ± 3% 66.95µ ± 1% -1.73% (p=0.035 n=10)
api-gateway-kong.json 64.84µ ± 2% 65.53µ ± 1% ~ (p=0.579 n=10)
api-gateway-non-proxy-async.json 101.5µ ± 1% 104.1µ ± 1% +2.51% (p=0.000 n=10)
api-gateway-non-proxy.json 101.8µ ± 1% 104.4µ ± 2% +2.52% (p=0.000 n=10)
api-gateway-websocket-connect.json 67.36µ ± 1% 69.55µ ± 2% +3.24% (p=0.000 n=10)
api-gateway-websocket-default.json 60.71µ ± 1% 62.91µ ± 1% +3.63% (p=0.000 n=10)
api-gateway-websocket-disconnect.json 61.46µ ± 2% 62.91µ ± 1% +2.35% (p=0.004 n=10)
api-gateway.json 114.6µ ± 2% 116.0µ ± 2% ~ (p=0.159 n=10)
application-load-balancer.json 63.16µ ± 3% 64.21µ ± 2% ~ (p=0.105 n=10)
cloudfront.json 46.99µ ± 2% 48.61µ ± 2% +3.44% (p=0.007 n=10)
cloudwatch-events.json 37.70µ ± 2% 38.71µ ± 2% +2.66% (p=0.000 n=10)
cloudwatch-logs.json 64.23µ ± 1% 66.73µ ± 2% +3.89% (p=0.000 n=10)
custom.json 30.61µ ± 1% 31.42µ ± 2% +2.64% (p=0.002 n=10)
dynamodb.json 92.99µ ± 1% 96.36µ ± 2% +3.62% (p=0.000 n=10)
empty.json 29.07µ ± 1% 29.68µ ± 2% +2.09% (p=0.009 n=10)
eventbridge-custom.json 41.85µ ± 2% 43.21µ ± 1% +3.26% (p=0.000 n=10)
http-api.json 72.17µ ± 2% 73.71µ ± 1% +2.13% (p=0.000 n=10)
kinesis-batch.json 70.62µ ± 1% 71.90µ ± 1% +1.81% (p=0.001 n=10)
kinesis.json 53.82µ ± 2% 54.51µ ± 1% ~ (p=0.063 n=10)
s3.json 59.86µ ± 1% 60.34µ ± 2% ~ (p=0.247 n=10)
sns-batch.json 88.92µ ± 1% 91.52µ ± 2% +2.92% (p=0.000 n=10)
sns.json 64.46µ ± 1% 65.84µ ± 2% +2.14% (p=0.003 n=10)
snssqs.json 110.2µ ± 1% 113.1µ ± 1% +2.66% (p=0.000 n=10)
snssqs_no_dd_context.json 99.47µ ± 1% 100.81µ ± 2% +1.35% (p=0.011 n=10)
sqs-aws-header.json 54.95µ ± 2% 55.09µ ± 2% ~ (p=0.912 n=10)
sqs-batch.json 93.55µ ± 1% 95.18µ ± 1% +1.74% (p=0.001 n=10)
sqs.json 68.88µ ± 2% 69.68µ ± 3% ~ (p=0.052 n=10)
sqs_no_dd_context.json 62.02µ ± 2% 62.47µ ± 1% ~ (p=0.579 n=10)
geomean 66.20µ 67.46µ +1.91%
│ baseline/benchmark.log │ current/benchmark.log │
│ B/op │ B/op vs base │
api-gateway-appsec.json 37.32Ki ± 0% 37.32Ki ± 0% ~ (p=0.565 n=10)
api-gateway-kong-appsec.json 26.92Ki ± 0% 26.91Ki ± 0% ~ (p=0.422 n=10)
api-gateway-kong.json 24.42Ki ± 0% 24.41Ki ± 0% ~ (p=0.985 n=10)
api-gateway-non-proxy-async.json 48.09Ki ± 0% 48.10Ki ± 0% ~ (p=0.591 n=10)
api-gateway-non-proxy.json 47.31Ki ± 0% 47.31Ki ± 0% ~ (p=1.000 n=10)
api-gateway-websocket-connect.json 25.49Ki ± 0% 25.49Ki ± 0% ~ (p=0.209 n=10)
api-gateway-websocket-default.json 21.39Ki ± 0% 21.41Ki ± 0% ~ (p=0.117 n=10)
api-gateway-websocket-disconnect.json 21.19Ki ± 0% 21.18Ki ± 0% ~ (p=0.725 n=10)
api-gateway.json 49.55Ki ± 0% 49.56Ki ± 0% ~ (p=0.839 n=10)
application-load-balancer.json 23.27Ki ± 0% 23.27Ki ± 0% ~ (p=0.470 n=10)
cloudfront.json 17.67Ki ± 0% 17.66Ki ± 0% ~ (p=0.617 n=10)
cloudwatch-events.json 11.71Ki ± 0% 11.72Ki ± 0% ~ (p=0.066 n=10)
cloudwatch-logs.json 53.36Ki ± 0% 53.37Ki ± 0% ~ (p=0.182 n=10)
custom.json 9.731Ki ± 0% 9.735Ki ± 0% ~ (p=0.670 n=10)
dynamodb.json 40.78Ki ± 0% 40.79Ki ± 0% ~ (p=0.670 n=10)
empty.json 9.275Ki ± 0% 9.289Ki ± 0% ~ (p=1.000 n=10)
eventbridge-custom.json 13.44Ki ± 0% 13.44Ki ± 0% ~ (p=0.985 n=10)
http-api.json 23.78Ki ± 0% 23.79Ki ± 0% ~ (p=0.247 n=10)
kinesis-batch.json 27.03Ki ± 0% 27.04Ki ± 0% ~ (p=0.171 n=10)
kinesis.json 17.81Ki ± 0% 17.81Ki ± 0% ~ (p=0.288 n=10)
s3.json 20.37Ki ± 0% 20.35Ki ± 0% -0.09% (p=0.029 n=10)
sns-batch.json 38.65Ki ± 0% 38.65Ki ± 0% ~ (p=0.838 n=10)
sns.json 23.95Ki ± 0% 23.96Ki ± 0% ~ (p=0.739 n=10)
snssqs.json 50.62Ki ± 0% 50.62Ki ± 0% ~ (p=0.280 n=10)
snssqs_no_dd_context.json 44.86Ki ± 0% 44.91Ki ± 0% +0.11% (p=0.025 n=10)
sqs-aws-header.json 18.80Ki ± 1% 18.78Ki ± 0% ~ (p=0.971 n=10)
sqs-batch.json 41.65Ki ± 0% 41.61Ki ± 0% ~ (p=0.089 n=10)
sqs.json 25.54Ki ± 0% 25.48Ki ± 0% ~ (p=0.063 n=10)
sqs_no_dd_context.json 20.72Ki ± 0% 20.71Ki ± 0% ~ (p=0.796 n=10)
geomean 25.76Ki 25.76Ki +0.00%
│ baseline/benchmark.log │ current/benchmark.log │
│ allocs/op │ allocs/op vs base │
api-gateway-appsec.json 629.5 ± 0% 630.0 ± 0% ~ (p=1.000 n=10)
api-gateway-kong-appsec.json 488.0 ± 0% 488.0 ± 0% ~ (p=1.000 n=10)
api-gateway-kong.json 466.0 ± 0% 466.0 ± 0% ~ (p=1.000 n=10) ¹
api-gateway-non-proxy-async.json 725.5 ± 0% 726.0 ± 0% ~ (p=1.000 n=10)
api-gateway-non-proxy.json 716.0 ± 0% 716.0 ± 0% ~ (p=1.000 n=10)
api-gateway-websocket-connect.json 453.0 ± 0% 453.0 ± 0% ~ (p=1.000 n=10)
api-gateway-websocket-default.json 379.0 ± 0% 379.0 ± 0% ~ (p=1.000 n=10) ¹
api-gateway-websocket-disconnect.json 370.0 ± 0% 370.0 ± 0% ~ (p=1.000 n=10)
api-gateway.json 790.5 ± 0% 791.0 ± 0% ~ (p=0.650 n=10)
application-load-balancer.json 353.0 ± 0% 353.0 ± 0% ~ (p=1.000 n=10) ¹
cloudfront.json 284.0 ± 0% 284.0 ± 0% ~ (p=1.000 n=10)
cloudwatch-events.json 220.0 ± 0% 220.0 ± 0% ~ (p=1.000 n=10)
cloudwatch-logs.json 215.0 ± 0% 215.5 ± 0% ~ (p=0.650 n=10)
custom.json 168.0 ± 0% 168.0 ± 0% ~ (p=1.000 n=10)
dynamodb.json 589.0 ± 0% 589.0 ± 0% ~ (p=1.000 n=10)
empty.json 159.0 ± 1% 159.0 ± 1% ~ (p=1.000 n=10)
eventbridge-custom.json 254.0 ± 0% 254.0 ± 0% ~ (p=1.000 n=10)
http-api.json 432.0 ± 0% 432.0 ± 0% ~ (p=0.369 n=10)
kinesis-batch.json 390.5 ± 0% 391.0 ± 0% ~ (p=1.000 n=10)
kinesis.json 285.0 ± 0% 285.0 ± 0% ~ (p=1.000 n=10)
s3.json 358.0 ± 0% 357.0 ± 0% ~ (p=0.132 n=10)
sns-batch.json 455.0 ± 0% 454.5 ± 0% ~ (p=0.577 n=10)
sns.json 323.0 ± 0% 323.0 ± 0% ~ (p=0.518 n=10)
snssqs.json 438.0 ± 0% 438.0 ± 0% ~ (p=0.367 n=10)
snssqs_no_dd_context.json 399.0 ± 0% 400.0 ± 0% ~ (p=0.080 n=10)
sqs-aws-header.json 274.0 ± 1% 273.0 ± 0% ~ (p=0.867 n=10)
sqs-batch.json 504.0 ± 0% 503.0 ± 0% ~ (p=0.157 n=10)
sqs.json 351.0 ± 1% 350.0 ± 0% ~ (p=0.123 n=10)
sqs_no_dd_context.json 324.5 ± 0% 324.5 ± 0% ~ (p=0.906 n=10)
geomean 376.3 376.3 -0.01%
¹ all samples are equal