-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix sidecar logging #521
Conversation
BenchmarksComparisonParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Warnings
BaselineBaseline benchmark detailsGroup 1
Warnings
|
eac99b3
to
4b6ff40
Compare
Codecov ReportAttention: Patch coverage is
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
|
sidecar/src/config.rs
Outdated
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() | ||
} |
There was a problem hiding this comment.
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?
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)) | |
} |
There was a problem hiding this comment.
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 (.).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
4b6ff40
to
1c53282
Compare
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.
1c53282
to
108f9fa
Compare
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.