Skip to content

[Entitlements] Improve FileAccessTree logging #127050

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

Merged

Conversation

ldematte
Copy link
Contributor

We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.

@ldematte ldematte added >non-issue auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 v9.1.0 :Core/Infra/Entitlements Entitlements infrastructure labels Apr 18, 2025
@ldematte ldematte requested a review from a team as a code owner April 18, 2025 09:41
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Apr 18, 2025
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

These seem like good trace messages to have. Could we also have more debug level, like eg dumping the path arrays if FileAccessTree? That would have made debugging the windows casing issue easier. Since it happens just once per module I think it could be debug level.

@ldematte
Copy link
Contributor Author

These seem like good trace messages to have. Could we also have more debug level, like eg dumping the path arrays if FileAccessTree? That would have made debugging the windows casing issue easier. Since it happens just once per module I think it could be debug level.

I was unsure if I needed to add that; we dump the path array we try to match with in canRead/canWrite already, so it felt like a duplication. But it does not hurt, and we can add e.g. exclusive paths too, especially because it happens once (so it can happen at a debug level). I'll add that.

@rjernst
Copy link
Member

rjernst commented Apr 18, 2025

Maybe we could simplify the trace level to only include the path we are looking for (and maybe the path we match if any), and leave the dump to debug level when the access tree is created?

@ldematte ldematte requested review from rjernst and a team April 22, 2025 08:36
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

return checkPath(normalizePath(path), writePaths);
var normalizedPath = normalizePath(path);
var canWrite = checkPath(normalizedPath, writePaths);
logger.trace(() -> Strings.format("checking [%s] (normalized to [%s]) for READ_WRITE: %b", path, normalizedPath, canWrite));
Copy link
Member

Choose a reason for hiding this comment

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

nit: we're checking write, READ_WRITE has a slightly different meaning

@ldematte ldematte enabled auto-merge (squash) April 22, 2025 13:35
@ldematte ldematte merged commit 73d3153 into elastic:main Apr 22, 2025
17 checks passed
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x
9.0

ldematte added a commit to ldematte/elasticsearch that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
elasticsearchmachine pushed a commit that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
elasticsearchmachine pushed a commit that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
elasticsearchmachine pushed a commit that referenced this pull request Apr 22, 2025
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Core/Infra/Entitlements Entitlements infrastructure >non-issue Team:Core/Infra Meta label for core/infra team v8.18.1 v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants