feat(instrument): stop returning error with instrument functions#229
feat(instrument): stop returning error with instrument functions#229
Conversation
rybit
left a comment
There was a problem hiding this comment.
Couple notes:
- should the errors be logged at Info level? I think Warning could work.
- should we log out more information, like the userid or traits?
- I think that if you start calling the global methods without calling
Inityou're going to panic (b/c the MockClient has a nil Logger). I think that we should not do this, it is especially annoying for tests.
yeah good point. I think the given the nature of errors, feels like the most cause is "you're doing something wrong" (client is closed early, or malformed input), so I think it can justify the warning.
I'm having a bit mixed feeling about this; what are we trying to do with these info? Like, we want to backfill manually? I think we should be able to treat this more with "best effort reporting" than "we can't miss any message" situation.
I do have a doc explaining how you use this with test: netlify-commons/instrument/doc.go Lines 22 to 27 in e703089 I'll see what I can tweak here. |
While using
instrumentin identeer, I realized that I had to do the error check every time I call the tracking.https://github.com/netlify/identeer/pull/96/files#r602408645
This is not a user friendly shape, and also the user could only do the "logging the failure" really, nothing more. With this PR, netlify-commons will do the logging part for you, so that you can use
instrumentas a one liner.reference: Segment would return the error with the tracking for the following case, which should be okay to "ignore":
BREAKING CHANGES:
Functions with instrument like
instrument.Identify,instrument.Trackwill no longer returnerror. If you were using this before with the error handling, please remove the error handling.