Skip to content
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

update ECS v4 client #23248

Merged
merged 3 commits into from
Mar 12, 2024
Merged

update ECS v4 client #23248

merged 3 commits into from
Mar 12, 2024

Conversation

kangyili
Copy link
Contributor

Update ECS V4 client and types. This PR is used by #21836

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

@pr-commenter
Copy link

pr-commenter bot commented Feb 28, 2024

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: ff9b2090-1e41-4d95-bc53-bf864f0761be
Baseline: cebbda1
Comparison: b40b844
Total CPUs: 7

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

Experiments with missing or malformed data

  • basic_py_check

Usually, this warning means that there is no usable optimization goal data for that experiment, which could be a result of misconfiguration.

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.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.84 [-5.72, +7.39]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.84 [-5.72, +7.39]
process_agent_real_time_mode memory utilization +0.65 [+0.60, +0.70]
tcp_syslog_to_blackhole ingress throughput +0.41 [+0.36, +0.47]
process_agent_standard_check_with_stats memory utilization +0.28 [+0.23, +0.32]
trace_agent_msgpack ingress throughput +0.01 [-0.00, +0.02]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.02 [-0.04, +0.00]
process_agent_standard_check memory utilization -0.15 [-0.19, -0.10]
uds_dogstatsd_to_api_cpu % cpu utilization -0.23 [-1.65, +1.19]
otel_to_otel_logs ingress throughput -0.59 [-1.24, +0.06]
idle memory utilization -0.80 [-0.84, -0.75]
file_tree memory utilization -1.11 [-1.22, -1.00]

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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

@kangyili kangyili marked this pull request as ready for review March 7, 2024 13:27
@kangyili kangyili requested a review from a team as a code owner March 7, 2024 13:27
Copy link
Member

@L3n41c L3n41c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is an issue with the fact that V4FromCurrentTask(…) uses the same globalUtil.initV3orV4 sync.Once object as V3orV4FromCurrentTask(…).

If both functions are called, only one of the two will be allowed to setup its retrier.
The other will panic when calling TriggerRetry.

Comment on lines 128 to 141
globalUtil.initV3orV4.Do(func() {
globalUtil.initRetryV4.SetupRetrier(&retry.Config{ //nolint:errcheck
Name: "ecsutil-meta-v4",
AttemptMethod: initV4,
Strategy: retry.Backoff,
InitialRetryDelay: initialRetryDelay,
MaxRetryDelay: maxRetryDelay,
})
})
if err := globalUtil.initRetryV4.TriggerRetry(); err != nil {
log.Debugf("ECS metadata v4 client init error: %s", err)
return nil, err
}
return globalUtil.v3or4, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m wondering if reusing the same v3or4 field of globalUtil could be problematic.

Let’s consider the following scenario:

  • A legacy piece of code calls V3orV4FromCurrentTask().
    • V3orV4FromCurrentTask() runs the globalUtil.initV3orV4 sync.Once function and setups the globalUtil.initRetryV3orV4 retrier with the initV3orV4 function.
    • V3orV4FromCurrentTask() then calls globalUtil.initRetryV3orV4.TriggerRetry() which calls initV3orV3 and sets globalUtil.v3or4 with a V3 client.
      Then,
  • Another piece of code calls V4FromCurrentTask().
    • V4FromCurrentTask() calls globalUtil.initV3orV4.Do(…) but initV3orV4 has already been invoked. So, the anonymous function isn’t called and globalUtil.initRetryV4.SetupRetrier(…) isn’t called.
    • When globalUtil.initRetryV4.TriggerRetry() is then called, and it will panic because the retrier hasen’t been setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I created a new v4 field
9244446

pkg/util/ecs/metadata/v3or4/client_test.go Outdated Show resolved Hide resolved
pkg/util/ecs/metadata/v3or4/client_test.go Outdated Show resolved Hide resolved
Comment on lines +21 to +27
EphemeralStorageMetrics map[string]int64 `json:"EphemeralStorageMetrics,omitempty"`
ServiceName string `json:"ServiceName,omitempty"`
VPCID string `json:"VPCID,omitempty"`
PullStartedAt string `json:"PullStartedAt,omitempty"`
PullStoppedAt string `json:"PullStoppedAt,omitempty"`
ExecutionStoppedAt string `json:"ExecutionStoppedAt,omitempty"`
AvailabilityZone string `json:"AvailabilityZone,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to eventually use those new fields or have they been added for the sake of completeness and in order to have a perfect 1-1 mapping between what ECS exposes and what we decode ?

I’m wondering if we didn’t skip the decoding of unused fields on purpose to avoid consuming memory to store unused data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we will need all fields as we're going to add a new core check to collect ecs tasks. The check will use workloadmeta.

@kangyili kangyili requested a review from L3n41c March 11, 2024 08:49
Copy link
Member

@L3n41c L3n41c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left minor simplification suggestions.

pkg/util/ecs/metadata/clients.go Outdated Show resolved Hide resolved
pkg/util/ecs/metadata/v3or4/client_test.go Outdated Show resolved Hide resolved
@kangyili
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Mar 12, 2024

🚂 MergeQueue

Pull request added to the queue.

This build is going to start soon! (estimated merge in less than 27m)

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit 51a2884 into main Mar 12, 2024
164 of 167 checks passed
@dd-mergequeue dd-mergequeue bot deleted the kangyi/ecs-v4-client branch March 12, 2024 09:22
@github-actions github-actions bot added this to the 7.53.0 milestone Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants