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

Fix sidecar logging #521

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Fix sidecar logging #521

merged 1 commit into from
Jul 8, 2024

Conversation

cataphract
Copy link
Contributor

Broken by ce2afd9, since when parse_uri starts returning a bogus uri, with the path put in the authority in hexadecimal form and the actual path empty. Sidestep that mess by not using parse_uri.

@cataphract cataphract requested review from a team as code owners July 8, 2024 13:10
@pr-commenter
Copy link

pr-commenter bot commented Jul 8, 2024

Benchmarks

Comparison

Parameters

Baseline Candidate
config baseline candidate
git_branch main glopes/fix-sidecar-logging
git_commit_date 1720187087 1720450243
git_commit_sha 6f91123 108f9fa
iterations 707.0 715.0
See matching parameters
Baseline Candidate
ci_job_date 1720450532 1720450532
ci_job_id 565228694 565228694
ci_pipeline_id 38579693 38579693
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.

Candidate

Candidate benchmark details

Group 1

iterations config cpu_model ci_job_date ci_job_id ci_pipeline_id git_commit_sha git_commit_date git_branch
715.0 candidate Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 1720450532 565228694 38579693 108f9fa 1720450243 glopes/fix-sidecar-logging
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 69.970µs 70.052µs ± 0.038µs 70.049µs ± 0.025µs 70.074µs 70.115µs 70.125µs 70.136µs 0.12% 0.096 -0.523 0.05% 0.004µs 1 100
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [70.044µs; 70.059µs] or [-0.011%; +0.011%] None None None

Warnings

Scenario: sql/obfuscate_sql_string, Metric: execution_time

Measurements are autocorrelated.

Autocorrelation is present for lags 1..10.

The measurements are not independent, thus confidence intervals
may be less precise.
---------------------------------------------------------------------------
Scenario: sql/obfuscate_sql_string, Metric: execution_time

Sample size is 100, which is lower than 105.

The minimal sample size in case of normal distribution to achieve significance
level of 0.05 for difference of means with effect size Cohen's d = 0.5 must be at
least 105.

The conclusions from confidence intervals may be invalid.
---------------------------------------------------------------------------

Baseline

Baseline benchmark details

Group 1

iterations config cpu_model ci_job_date ci_job_id ci_pipeline_id git_commit_sha git_commit_date git_branch
707.0 baseline Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 1720450532 565228694 38579693 6f91123 1720187087 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 70.799µs 70.856µs ± 0.026µs 70.854µs ± 0.016µs 70.872µs 70.896µs 70.920µs 70.930µs 0.11% 0.115 -0.014 0.04% 0.003µs 1 100
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [70.851µs; 70.861µs] or [-0.007%; +0.007%] None None None

Warnings

Scenario: sql/obfuscate_sql_string, Metric: execution_time

Measurements are autocorrelated.

Autocorrelation is present for lags 1..10.

The measurements are not independent, thus confidence intervals
may be less precise.
---------------------------------------------------------------------------
Scenario: sql/obfuscate_sql_string, Metric: execution_time

Sample size is 100, which is lower than 105.

The minimal sample size in case of normal distribution to achieve significance
level of 0.05 for difference of means with effect size Cohen's d = 0.5 must be at
least 105.

The conclusions from confidence intervals may be invalid.
---------------------------------------------------------------------------

@cataphract cataphract force-pushed the glopes/fix-sidecar-logging branch 2 times, most recently from eac99b3 to 4b6ff40 Compare July 8, 2024 13:30
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.46%. Comparing base (6f91123) to head (108f9fa).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #521      +/-   ##
==========================================
- Coverage   70.46%   70.46%   -0.01%     
==========================================
  Files         205      205              
  Lines       27939    27936       -3     
==========================================
- Hits        19688    19685       -3     
  Misses       8251     8251              
Components Coverage Δ
crashtracker 16.72% <ø> (ø)
datadog-alloc 98.76% <ø> (ø)
data-pipeline 51.15% <ø> (ø)
data-pipeline-ffi 0.00% <ø> (ø)
ddcommon 86.58% <ø> (ø)
ddcommon-ffi 75.31% <ø> (ø)
ddtelemetry 59.33% <ø> (ø)
ipc 84.66% <ø> (ø)
profiling 78.63% <ø> (ø)
profiling-ffi 58.19% <ø> (ø)
serverless 0.00% <ø> (ø)
sidecar 36.14% <40.00%> (-0.06%) ⬇️
sidecar-ffi 0.00% <ø> (ø)
spawn-worker 54.98% <ø> (ø)
trace-mini-agent 69.70% <ø> (ø)
trace-normalization 98.24% <ø> (ø)
trace-obfuscation 95.75% <ø> (ø)
trace-protobuf 77.16% <ø> (ø)
trace-utils 90.76% <ø> (ø)

Comment on lines 132 to 133
method if method.starts_with("file:///") => {
let fixed_uri = format!("file://./{}", &method[7..]);
Uri::from_str(&fixed_uri)
.map(|u| LogMethod::File(PathBuf::from(&u.path())))
.unwrap_or_default()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just this instead of the roundtrip to url?

Suggested change
method if method.starts_with("file:///") => {
let fixed_uri = format!("file://./{}", &method[7..]);
Uri::from_str(&fixed_uri)
.map(|u| LogMethod::File(PathBuf::from(&u.path())))
.unwrap_or_default()
}
method if method.starts_with("file://") => {
let path = method.strip_prefix("file://").unwrap();
LogMethod::File(PathBuf::from(path))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because the specification for the path is in the form file:///my/path. However, even though this is a valid URI (with an empty host), see RFC 3986:

  URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

      hier-part   = "//" authority path-abempty
                  / path-absolute
                  / path-rootless
                  / path-empty

      authority   = [ userinfo "@" ] host [ ":" port ]

      host        = IP-literal / IPv4address / reg-name
      reg-name    = *( unreserved / pct-encoded / sub-delims )

   If the URI scheme defines a default for host, then that default
   applies when the host subcomponent is undefined or when the
   registered name is empty (zero length).  For example, the "file" URI
   scheme is defined so that no authority, an empty host, and
   "localhost" all mean the end-user's machine, whereas the "http"
   scheme considers a missing authority or empty host invalid.

the http package rejects the uri for not having a host. So add a bogus host (.).

Copy link
Contributor

Choose a reason for hiding this comment

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

Going through the Uri struct is not a good idea. If there are non-alphanumeric characters, they would need to be URL-encoded for this to work. This value comes from an env variable that can be manually supplied so encoding is painful to do.

We already do not follow the URI standard for unix sockets URL (since the logic is just unix:// + path on disk without any special encoding ) so I don't see the point of arbitrarily following it for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah sorry I didn't read that right. I can't just strip the prefix because it may have urlencoded characters

Broken by ce2afd9, since when parse_uri
starts returning a bogus uri, with the path put in the authority in
hexadecimal form and the actual path empty. Sidestep that mess by not
using parse_uri.
@cataphract cataphract merged commit b7a8566 into main Jul 8, 2024
32 checks passed
@cataphract cataphract deleted the glopes/fix-sidecar-logging branch July 8, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants