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

Reinstate tracing instrumentation on ReadOnlyDevice::encrypt #2873

Merged
merged 2 commits into from Nov 22, 2023

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 22, 2023

Until #2862, GroupSessionManager::encrypt_session_for called Device::encrypt (via Device::maybe_encrypt_room_key.

Device::encrypt is a thin wrapper for ReadOnlyDevice::encrypt, but it also has an instrument annotation.

#2862 short-cuts Device::encrypt and calls ReadOnlyDevice::encrypt directly: that was functionally fine but of course means that we no longer benefit from the instrument annotation.

This PR rectifies the situation by pushing the annotation down to ReadOnlyDevice::encrypt. It also adds some documentation for that function, since we are using it in more places now.

(Longer-term, I think we should probably aim to get rid of Device::encrypt altogether, but that's a refactor I don't want to take on today.)

Until #2862,
`GroupSessionManager::encrypt_session_for` called `Device::encrypt` (via
`Device::maybe_encrypt_room_key`.

`Device::encrypt` is a thin wrapper for `ReadOnlyDevice::encrypt`, but it also
has an `instrument` annotation.

#2862 short-cuts
`Device::encrypt` and calls `ReadOnlyDevice::encrypt` directly: that was
functionally fine but of course means that we no longer benefit from the
`instrument` annotation.

This PR rectifies the situation by pushing the annotation down to
`ReadOnlyDevice::encrypt`.
@richvdh richvdh requested a review from a team as a code owner November 22, 2023 11:10
@richvdh richvdh requested review from bnjbvr and removed request for a team November 22, 2023 11:10
///
/// # Arguments
///
/// * `event_type` - The type of the event that should be encrypted.
Copy link
Contributor

Choose a reason for hiding this comment

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

This method has an additional argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦 thank you

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bb4254b) 82.46% compared to head (ed571d4) 82.46%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2873   +/-   ##
=======================================
  Coverage   82.46%   82.46%           
=======================================
  Files         211      211           
  Lines       21639    21639           
=======================================
  Hits        17844    17844           
  Misses       3795     3795           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richvdh richvdh merged commit 2aaa709 into main Nov 22, 2023
35 checks passed
@richvdh richvdh deleted the rav/encrypt_instrumentation branch November 22, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants