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

Track caller's emitted events #3268

Merged
merged 4 commits into from
May 31, 2024
Merged

Track caller's emitted events #3268

merged 4 commits into from
May 31, 2024

Conversation

sug0
Copy link
Contributor

@sug0 sug0 commented May 20, 2024

Describe your changes

Track the source code origin of some emitted event in Namada.

Indicate on which release or other PRs this topic is based on

v0.36.1

Checklist before merging to draft

  • I have added a changelog
  • Git history is in acceptable state

@sug0 sug0 added the enhancement New feature or request label May 20, 2024
@sug0 sug0 requested a review from tzemanovic May 20, 2024 07:47
@sug0 sug0 force-pushed the tiago/track-caller-events branch from 430d746 to 83a3ef4 Compare May 20, 2024 07:52
crates/events/src/tracer.rs Outdated Show resolved Hide resolved
crates/events/src/tracer.rs Show resolved Hide resolved
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 88.66995% with 23 lines in your changes are missing coverage. Please review.

Project coverage is 53.85%. Comparing base (c7d79f4) to head (df4b4f7).
Report is 29 commits behind head on main.

Files Patch % Lines
crates/events/src/tracer.rs 88.66% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3268      +/-   ##
==========================================
+ Coverage   53.79%   53.85%   +0.06%     
==========================================
  Files         314      315       +1     
  Lines      105784   105987     +203     
==========================================
+ Hits        56903    57083     +180     
- Misses      48881    48904      +23     

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

@sug0 sug0 force-pushed the tiago/track-caller-events branch 2 times, most recently from 854703a to b5dd972 Compare May 20, 2024 10:07
sug0 added a commit that referenced this pull request May 20, 2024
@sug0 sug0 marked this pull request as ready for review May 20, 2024 10:13
tzemanovic
tzemanovic previously approved these changes May 20, 2024
sug0 added a commit that referenced this pull request May 20, 2024
@sug0 sug0 force-pushed the tiago/track-caller-events branch from ebbed13 to 73e0543 Compare May 20, 2024 11:33
sug0 added a commit that referenced this pull request May 20, 2024
@sug0 sug0 force-pushed the tiago/track-caller-events branch from 73e0543 to 11b9d05 Compare May 20, 2024 11:36
@sug0 sug0 requested a review from brentstone May 20, 2024 14:43

let trace = event.read_attribute::<EventOrigin>().unwrap();

assert!(trace.line > start_line && trace.line < end_line);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe trace.line == start_line + 1 && trace.line == END_LINE - 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doesn't matter to be precise, we only care to check if the event was emitted within a certain region of the source code

@sug0 sug0 force-pushed the tiago/track-caller-events branch from 11b9d05 to df4b4f7 Compare May 22, 2024 08:32
@sug0 sug0 mentioned this pull request May 22, 2024
tzemanovic added a commit that referenced this pull request May 24, 2024
* origin/tiago/track-caller-events:
  Changelog for #3268
  Activate `debug` feat when `testing` is active
  Test event emission origin
  Track the origin of emitted events
@brentstone brentstone merged commit 18e8920 into main May 31, 2024
18 of 19 checks passed
@brentstone brentstone deleted the tiago/track-caller-events branch May 31, 2024 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants