[Serverless] Add exit_code tag to Cloud Run Jobs shutdown metric#41250
Conversation
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: 00936fe Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | docker_containers_cpu | % cpu utilization | -0.22 | [-3.27, +2.84] | 1 | Logs |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gate_logs | % cpu utilization | +1.06 | [-1.70, +3.83] | 1 | Logs bounds checks dashboard |
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +0.86 | [+0.80, +0.92] | 1 | Logs |
| ➖ | quality_gate_metrics_logs | memory utilization | +0.72 | [+0.50, +0.93] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_logs | memory utilization | +0.49 | [+0.44, +0.54] | 1 | Logs |
| ➖ | otlp_ingest_logs | memory utilization | +0.44 | [+0.32, +0.55] | 1 | Logs |
| ➖ | otlp_ingest_metrics | memory utilization | +0.34 | [+0.22, +0.46] | 1 | Logs |
| ➖ | uds_dogstatsd_20mb_12k_contexts_20_senders | memory utilization | +0.30 | [+0.26, +0.34] | 1 | Logs |
| ➖ | ddot_metrics_sum_cumulative | memory utilization | +0.09 | [-0.03, +0.20] | 1 | Logs |
| ➖ | file_to_blackhole_0ms_latency | egress throughput | +0.02 | [-0.57, +0.61] | 1 | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | +0.00 | [-0.01, +0.01] | 1 | Logs |
| ➖ | file_tree | memory utilization | -0.01 | [-0.05, +0.02] | 1 | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | -0.02 | [-0.22, +0.19] | 1 | Logs |
| ➖ | file_to_blackhole_100ms_latency | egress throughput | -0.02 | [-0.58, +0.55] | 1 | Logs |
| ➖ | file_to_blackhole_500ms_latency | egress throughput | -0.03 | [-0.64, +0.58] | 1 | Logs |
| ➖ | file_to_blackhole_1000ms_latency | egress throughput | -0.04 | [-0.61, +0.53] | 1 | Logs |
| ➖ | ddot_metrics | memory utilization | -0.18 | [-0.34, -0.02] | 1 | Logs |
| ➖ | docker_containers_cpu | % cpu utilization | -0.22 | [-3.27, +2.84] | 1 | Logs |
| ➖ | quality_gate_idle_all_features | memory utilization | -0.23 | [-0.27, -0.20] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_metrics_sum_delta | memory utilization | -0.33 | [-0.48, -0.17] | 1 | Logs |
| ➖ | quality_gate_idle | memory utilization | -0.40 | [-0.44, -0.37] | 1 | Logs bounds checks dashboard |
| ➖ | ddot_metrics_sum_cumulativetodelta_exporter | memory utilization | -0.55 | [-0.75, -0.35] | 1 | Logs |
| ➖ | docker_containers_memory | memory utilization | -2.25 | [-2.40, -2.11] | 1 | Logs |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | links |
|---|---|---|---|---|
| ✅ | docker_containers_cpu | simple_check_run | 10/10 | |
| ✅ | docker_containers_memory | memory_usage | 10/10 | |
| ✅ | docker_containers_memory | simple_check_run | 10/10 | |
| ✅ | file_to_blackhole_0ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_0ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_1000ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_100ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_100ms_latency | memory_usage | 10/10 | |
| ✅ | file_to_blackhole_500ms_latency | lost_bytes | 10/10 | |
| ✅ | file_to_blackhole_500ms_latency | memory_usage | 10/10 | |
| ✅ | quality_gate_idle | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | lost_bytes | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | lost_bytes | 10/10 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | bounds checks dashboard |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
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
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".
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check lost_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
|
| // Copyright 2016-present Datadog, Inc. | ||
|
|
||
| //nolint:revive // TODO(SERV) Fix revive linter | ||
| package exitcode |
There was a problem hiding this comment.
this needs to live in its own package to avoid circular dependency
| metricTimestamp := float64(time.Now().UnixNano()) / float64(time.Second) | ||
| tags := agent.GetExtraTags() | ||
| if len(extraTags) > 0 { | ||
| tags = append(append([]string{}, tags...), extraTags...) |
There was a problem hiding this comment.
copy the original tags so we don't modify the original
| return exitErr.ExitCode() | ||
| } | ||
|
|
||
| log.Debug("using default exit code 1") |
There was a problem hiding this comment.
why is the default 1 and not nil or something? if the error is not a subprocess-failure-type error, why is this the place where we decide that it's "error-like" enough to merit calling it an exit status 1?
There was a problem hiding this comment.
I was keeping the logic of
datadog-agent/cmd/serverless-init/main.go
Lines 291 to 303 in d95118d
but i think it makes sense here -- if err is not nil, then the exit code should not be 0, so 1 is the best default option
There was a problem hiding this comment.
maybe. i guess it depends on what this code is supposed to do.
if the code is supposed to extract the exit code from a runtime error, then it shouldn't invent one if it can't find a runtime error but found a different kind of error instead.
if the code is supposed to generate a numeric error code for us to include for error that may be a runtime error or not, the 1 default is sensible.
i would probably have stuck to former interpretation and let the caller do the "default is 1" logic (along with its logging; the fact that we're logging it is a hint that something fishy is going on).
it's a pretty minor thing so probably not something to really worry about of course.
|
|
||
| // Shutdown emits the shutdown metric for CloudRun | ||
| func (c *CloudRun) Shutdown(agent serverlessMetrics.ServerlessMetricAgent) { | ||
| func (c *CloudRun) Shutdown(agent serverlessMetrics.ServerlessMetricAgent, _ error) { |
There was a problem hiding this comment.
if we're doing all this plumbing anyway, why not include the exit code in all of our shutdown metrics?
There was a problem hiding this comment.
Should we? This change here is just so we can include it in the Cloud Run Jobs UI, but we won't be using the exit_code tag for any other of the cloud services
There was a problem hiding this comment.
i suppose it's a product decision. is there a significant cost to adding this everywhere? seems like a pretty handy thing? though i guess if we don't need it, that's also fine.
domalessi
left a comment
There was a problem hiding this comment.
Left a suggestion to make the release note more clear.
…ed.yaml Co-authored-by: domalessi <[email protected]>
| --- | ||
| enhancements: | ||
| - | | ||
| The `task.ended` enhanced shutdown metric for Cloud Run Jobs now includes the exit code as a tag. |
There was a problem hiding this comment.
should we use the actual metric names here?
|
approved, though we should probably get some expert opinion re: the cardinality of the new tag we're adding. |
|
/merge |
|
View all feedbacks in Devflow UI.
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
The expected merge time in
|
What does this PR do?
Add an
exit_codetag on thegcp.run.job.enhanced.task.endedmetric.Motivation
Will be used on the UI to display the exit code of each task, as well as to determine if the task succeeded (
exit_code=0) or failed (exit_code!=0)https://datadoghq.atlassian.net/browse/SVLS-7553
Describe how you validated your changes
Unit tests and manually deploying a container to Cloud Run Jobs with a custom build of the agent.
Additional Notes
This is easiest reviewed commit-by-commit