Validate event name for frontend logging#9438
Conversation
1fd3f3f to
94dc73a
Compare
|
There's a couple more through |
app/services/analytics_events.rb
Outdated
There was a problem hiding this comment.
Is **extra unused on purpose?
There was a problem hiding this comment.
yeah, frontend events only accept keys that are defined (due to this) so passing extra into the logging is not doing anything. I've updated the other frontend events accordingly.
b0348f0 to
842ded8
Compare
added in 5e03e1b9e3fe128f95d6e938e7973fd117f59951 |
5b25c9e to
6e3bcd2
Compare
aduth
left a comment
There was a problem hiding this comment.
I think this looks good, I'll take a detailed look a little later.
app/services/analytics_events.rb
Outdated
There was a problem hiding this comment.
To the earlier point about this **_extra, can we just exclude it? Or is the problem that the send will always try to pass a hash of values; in which case, could we make sure that only happens if it's non-empty? I guess I'm thinking that we should either never expect **extra to be passed, or we could just log the **extra for consistency with other events (except for methods like this which don't have any arguments).
There was a problem hiding this comment.
We're limited by https://github.com/18F/identity-idp/blob/d099da2181ab73c733f8a0dea561ca4152e5aa10/lib/analytics_events_documenter.rb#L114-L116 which ends up failing lint with:
app/services/analytics_events.rb:704 idv_back_image_clicked missing **extra
d099da2 to
8dbe5f0
Compare
spec/features/idv/analytics_spec.rb
Outdated
There was a problem hiding this comment.
We could add a { ... }.compact inside AnalyticsEvents if we wanted to minimize diff noise here
There was a problem hiding this comment.
Removing nil values is a change to downstream logging behavior and I'm not sure if the presence of nil is important or depended on in some way :/
There was a problem hiding this comment.
usually nil values are elided by CW, so it's not meaningful, but happy to err on the conservative side of this and leave these nils in there
0775bda to
bca802f
Compare
changelog: Internal, Logging, Validate frontend logging events
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
bca802f to
4b16f6c
Compare
🛠 Summary of changes
Action item from the 2023-09-07 contingency planning scenario to require validation of events logged from the frontend
Related to #9421