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

Feature: event system and impression data events #113

Merged
merged 8 commits into from
Nov 30, 2022

Conversation

daveleek
Copy link
Collaborator

@daveleek daveleek commented Oct 25, 2022

Description

Aims to add an event system to the SDK and a first implementation for impression data/events: https://docs.getunleash.io/advanced/impression-data#impression-event-data

Fixes # (issue)
#108

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • ran all the existing unit tests
  • ran the cake script testing
  • added more unit tests and ran them
  • explicitly tested serialization/deserialization

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@daveleek daveleek marked this pull request as ready for review November 2, 2022 23:36
Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

This is pretty cool, just a small question about error handling but looks pretty darn good to me

callback(evtConfig);
EventConfig = evtConfig;
}
catch (Exception ex)
Copy link
Member

Choose a reason for hiding this comment

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

Is there something that can be raised here? This looks pretty harmless to me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This particular one is probably very harmless, it's the callback where you configure all the handlers for the various events. But anything started in here that fails on a file lock or whatever will crash the startup of Unleash

Copy link
Member

Choose a reason for hiding this comment

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

I can stand by that!

Variant = variant
});
}
catch (Exception ex)
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, I can't see an obvious exception that could be caught here, is this just being defensive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here I'm trapping event emitting, if your logger fails for some reason for instance, that won't crash harder than an error in the log

Copy link
Member

Choose a reason for hiding this comment

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

Sure, I can live with that, seems polite to log an error if something super unexpected happens here

@daveleek
Copy link
Collaborator Author

Thanks @sighphyre for review and questions. I've attempted a few more details in response. Perhaps this is a code area that could do with some comments 🤔

I'm trapping exceptions here since these two callbacks are code coming from outside Unleash, but I'm open for anything :)

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants