Skip to content

Require **extra in Analytics Events Documentation#6052

Merged
zachmargolis merged 3 commits intomainfrom
margolis-analytics-extra
Mar 14, 2022
Merged

Require **extra in Analytics Events Documentation#6052
zachmargolis merged 3 commits intomainfrom
margolis-analytics-extra

Conversation

@zachmargolis
Copy link
Contributor

With our old freeform analytics, there was no enforcement of params. If there are keys that are logged in production, but not covered in our test suite, we'll get UnknownArgument errors. #6050 was the result of letting one of those slip through to production.

This PR adds and enforces **extra on

  • Thanks to Add unused method argument lint #6012, we can also make sure that these **extra is passed along, so the attributes won't be skipped
  • I decided that our no-attribute events would be okay

I'd love to discourage the freeform param in the future, so one idea could be that new methods go in AnalyticsEventsNew which would not need **extra and the ones we migrate go to AnalyticsEventsOld or something... but that's an exploration for anther time. This PR should help us run our transition more smoothly in the meantime

**Why**: To prevent undocumented params from causing errors

[skip changelog]
@zachmargolis zachmargolis force-pushed the margolis-analytics-extra branch from b3608e3 to b2910f4 Compare March 11, 2022 21:44
error_details: nil,
email_addresses: nil
email_addresses: nil,
**extra
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is going to become a pattern, is there an easy way to log what the extra attributes are? That way it's easy to hunt them down later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we could add something like undocumented_keys: extra.keys to the payload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had some metaprogramming ideas, none of which panned out quickly, so I filed LG-5969 to follow up

Copy link
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

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

👍🏼 👍🏼 👍🏼

@zachmargolis zachmargolis merged commit 93d572b into main Mar 14, 2022
@zachmargolis zachmargolis deleted the margolis-analytics-extra branch March 14, 2022 18:31
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.

3 participants