aws-sam-cli
aws-sam-cli copied to clipboard
Make minor tweaks before launch
Which issue(s) does this change fix?
N/A
Why is this change necessary?
There were a few things I wasn't happy with reflecting on some of my previous code, and they were too small to fit into PRs on their own. Thus, they've been delegated to this PR, which has many tiny adjustments and tweaks, outlined below in order of significance.
How does it address the issue?
-
EventTracker.send_events
now executes on a thread! Previously, this logic was only implemented when the function was called at capacity. Now, it's the default! -
EventTracker
now storessession_id
locally. This fixes a bug I was only recently made aware of, where Events sent in a thread did not contain the session ID, thus preventing us from linking the data. With the new implementation, the session ID is appended to the Metric before it is sent out. - The decorators on
sam sync
are rearranged (namely,track_command
andtrack_long_event
have swapped places). This will prevent onesend_events
from being called, then the "end event" being added, and then one moresend_events
being called.- This reasoning has also been added to the docstring for the
track_long_event
decorator.
- This reasoning has also been added to the docstring for the
- The attribute
EventType._events
has been renamed toEventType._event_values
. This not only prevents ambiguity, but also prevents confusion withEventTracker._events
. - Added a docstring to
EventTracker.get_tracked_events
method. - Added a comment beside
EventType._event_values
to provide explanation as to what the value represents. - Added comments in the
track_long_event
decorator to provide clarity on the process of the method.
What side effects does this change have?
Aside from some readability improvements within my code, the only notable side effect is the EventTracker.send_events
executing on a separate thread always.
Mandatory Checklist
PRs will only be reviewed after checklist is complete
- [x] Add input/output type hints to new functions/methods
- [ ] Write design document if needed (Do I need to write a design document?)
- [x] Write/update unit tests
- [x] Write/update integration tests
- [ ] Write/update functional tests if needed
- [x]
make pr
passes - [ ]
make update-reproducible-reqs
if dependencies were changed - [ ] Write documentation
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.