-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add support for multiuser permissions in unix #43483
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
Adds multi-user Unix permission handling for local storage by introducing a helper to set parent (0o755) and storage (0o700) directory permissions and adds related test cases.
- Replaces direct chmod with _set_unix_permissions for Unix paths.
- Adds three tests covering success and two failure scenarios related to permission setting.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_storage.py | Introduces _set_unix_permissions and updates Unix branch to use it. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_storage.py | Adds tests for multi-user Unix permission scenarios and error handling. |
...onitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_storage.py
Show resolved
Hide resolved
...onitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_storage.py
Outdated
Show resolved
Hide resolved
...onitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_storage.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_storage.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_storage.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_storage.py
Outdated
Show resolved
Hide resolved
…orage.py Co-authored-by: Copilot <[email protected]>
…orage.py Co-authored-by: Copilot <[email protected]>
...onitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_storage.py
Outdated
Show resolved
Hide resolved
| self._storage_directory = kwargs.get("storage_directory") | ||
| elif not self._disable_offline_storage: | ||
| shared_root = os.path.join(tempfile.gettempdir(), _AZURE_TEMPDIR_PREFIX) | ||
| user_segment = getpass.getuser() |
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.
This might return an exception if the user details are not found, should we skip the user_segment in that case?
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.
There are other unique properties that can be used, like time, new guid or similar
.NET use a hash with ikey, user name and process name
https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs#L25
It will be good to have same logic in all exporters, having some language differentiator as well
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.
Also this issue should be present in Node.js as well, only ikey is used to differentiate folders
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.
Regarding what to do if some information is not available, we should try to build a hash using what is present to ensure problem is less likely to happen
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.
Also this issue should be present in Node.js as well, only ikey is used to differentiate folders
Will create a separate task for it.
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.
There are other unique properties that can be used, like time, new guid or similar
.NET use a hash with ikey, user name and process name https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs#L25
It will be good to have same logic in all exporters, having some language differentiator as well
When you say language differentiator, do you mean a difference in the functionality across languages or add a language attribute to this directory path?
|
I have tested this PR, but it will still create the directory |
@berland I’m updating the implementation to align with the .NET SDK approach for creating a unique subdirectory. Once I push these changes, I’ll share an update so you can test and confirm if it works for you. |
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_base_exporter.py
Outdated
Show resolved
Hide resolved
|
Some comments to the current PR:
|
Description
Adds folder permissions for Unix when multiple users are using the same system.
Fixes - #43414
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines