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

chore(config): Refactor secrets loading to avoid use of futures::executor::block_on #21073

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

jszwedko
Copy link
Member

@jszwedko jszwedko commented Aug 14, 2024

Since the caller was async no need to have the nested functions be sync.

I spent an hour or so trying to keep SecretBackendLoader#retrieve in a functional processing style, but gave up and went for the simpler approach of iterating and mutating.

Signed-off-by: Jesse Szwedko [email protected]

…ock_on

Since the caller was async no need to have the nested functions be sync.

Signed-off-by: Jesse Szwedko <[email protected]>
@jszwedko jszwedko added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Aug 14, 2024
@jszwedko jszwedko marked this pull request as ready for review August 14, 2024 18:09
@jszwedko jszwedko requested a review from a team as a code owner August 14, 2024 18:09
@jszwedko jszwedko changed the title chore: Refactor secrets loading to avoid use of futures::executor::block_on chore(config): Refactor secrets loading to avoid use of futures::executor::block_on Aug 14, 2024
@datadog-vectordotdev
Copy link

datadog-vectordotdev bot commented Aug 14, 2024

Datadog Report

Branch report: jszwedko/remove-usages-of-block
Commit report: 234994f
Test service: vector

✅ 0 Failed, 7 Passed, 0 Skipped, 25.5s Total Time

src/config/loading/secret.rs Outdated Show resolved Hide resolved
Comment on lines 65 to 81
let backend_secrets = backend
.retrieve(keys.clone(), signal_rx)
.map_ok(|backend_secrets| {
backend_secrets.into_iter().map(|(k, v)| {
trace!(message = "Successfully retrieved a secret.", backend = ?backend_name, key = ?k);
(format!("{}.{}", backend_name, k), v)
}).collect::<HashMap<String, String>>()
})
.map_err(|e| {
format!(
"Error while retrieving secret from backend \"{}\": {}.",
backend_name, e
)
})
.await?;

secrets.extend(backend_secrets);
Copy link
Member

Choose a reason for hiding this comment

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

Since you were unable to find a functional-style mechanism for this (possibly due to interactions with async calls), would it make sense to just loop over backend.retrieve(…) instead of using map_ok and map_err?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good thought, that is clearer. I made this change in 34964f4

src/config/loading/secret.rs Outdated Show resolved Hide resolved
src/config/loading/secret.rs Outdated Show resolved Hide resolved
jszwedko and others added 2 commits August 14, 2024 13:26
Signed-off-by: Jesse Szwedko <[email protected]>
@jszwedko jszwedko enabled auto-merge August 14, 2024 20:32
@jszwedko jszwedko added this pull request to the merge queue Aug 14, 2024
Copy link

Regression Detector Results

Run ID: 2a621853-51c4-477a-bbdb-00cd5ef4b6e6 Metrics dashboard

Baseline: 61b1b18
Comparison: e601b9b

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

Significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

perf experiment goal Δ mean % Δ mean % CI links
syslog_log2metric_humio_metrics ingress throughput +5.26 [+5.08, +5.43]

Experiments ignored for regressions

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

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput +16.06 [+8.65, +23.48]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput +16.06 [+8.65, +23.48]
syslog_log2metric_humio_metrics ingress throughput +5.26 [+5.08, +5.43]
syslog_splunk_hec_logs ingress throughput +1.92 [+1.77, +2.07]
splunk_hec_route_s3 ingress throughput +1.91 [+1.60, +2.22]
http_text_to_http_json ingress throughput +1.48 [+1.35, +1.62]
http_to_http_acks ingress throughput +1.05 [-0.27, +2.37]
http_to_s3 ingress throughput +0.66 [+0.39, +0.93]
fluent_elasticsearch ingress throughput +0.46 [-0.03, +0.95]
syslog_regex_logs2metric_ddmetrics ingress throughput +0.33 [+0.19, +0.47]
http_to_http_noack ingress throughput +0.17 [+0.09, +0.26]
datadog_agent_remap_datadog_logs_acks ingress throughput +0.16 [-0.04, +0.36]
http_to_http_json ingress throughput +0.08 [+0.01, +0.14]
syslog_loki ingress throughput +0.05 [-0.02, +0.12]
splunk_hec_indexer_ack_blackhole ingress throughput +0.02 [-0.06, +0.10]
socket_to_socket_blackhole ingress throughput +0.02 [-0.03, +0.07]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.08, +0.10]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.01 [-0.12, +0.14]
otlp_http_to_blackhole ingress throughput -0.07 [-0.21, +0.06]
otlp_grpc_to_blackhole ingress throughput -0.32 [-0.44, -0.20]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -0.42 [-0.51, -0.34]
syslog_humio_logs ingress throughput -0.96 [-1.09, -0.83]
datadog_agent_remap_blackhole ingress throughput -1.76 [-1.89, -1.64]
syslog_log2metric_splunk_hec_metrics ingress throughput -1.95 [-2.08, -1.83]
datadog_agent_remap_datadog_logs ingress throughput -2.30 [-2.48, -2.13]
http_elasticsearch ingress throughput -2.51 [-2.68, -2.35]
datadog_agent_remap_blackhole_acks ingress throughput -4.58 [-4.73, -4.43]

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

Merged via the queue into master with commit e601b9b Aug 14, 2024
80 checks passed
@jszwedko jszwedko deleted the jszwedko/remove-usages-of-block branch August 14, 2024 22:34
AndrooTheChen pushed a commit to discord/vector that referenced this pull request Sep 23, 2024
…utor::block_on (vectordotdev#21073)

* chore: Refactor secrets loading to avoid use of futures::executor::block_on

Since the caller was async no need to have the nested functions be sync.

Signed-off-by: Jesse Szwedko <[email protected]>

* Apply suggestions from code review

Co-authored-by: Bruce Guenter <[email protected]>

* pr feedback

Signed-off-by: Jesse Szwedko <[email protected]>

---------

Signed-off-by: Jesse Szwedko <[email protected]>
Co-authored-by: Bruce Guenter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Changes in this PR do not need user-facing explanations in the release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants