keenlabs / KeenClient-Java

Official Java client for the Keen IO API. Build analytics features directly into your Java apps.
https://keen.io/docs
MIT License
74 stars 43 forks source link

Must specify a non-null, non-empty event #41

Open danielross opened 9 years ago

danielross commented 9 years ago

In KeenClient.java the validateEvent throws an error if the event is null or empty.

If I have set some global properties and want to simply add an event to my collection without adding any extra attributes. How am I supposed to do that?

Thanks

joshed-io commented 9 years ago

Thanks for opening the issue @danielross. Sounds like a bug to me, you should be able to send an event with just the global properties. @Geeber what do you think?

Geeber commented 9 years ago

Yep I think it's a bug. @smurthas think you can add this as something to get fixed in the 3.0 release?

We could also consider doing a quick patch in the 2.1.x line. I think all it would take is changing line 1150 of KeenClient.java from

if (event == null || event.size() == 0) {

to

if (event == null) {

That would allow empty events. I guess we would probably also want to add something to the end of validateAndBuildEvent, after the global properties have been inserted, to check if the resulting map is still empty. I do think it probably makes sense to treat an empty event as an error if there are no global properties; would you agree @danielross?

danielross commented 9 years ago

Thanks for the response. I think I would agree that a 'completely empty' event should be treated as an error. It depends really on whether allowing people to send events without properties, which are basically just counters, is of sufficient value to you.