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

Can't set keen.timestamp property #8

Closed rbxbx closed 9 years ago

rbxbx commented 10 years ago

"You have the ability to overwrite the keen.timestamp property. This could be useful, for example, if you are backfilling historical data." – https://keen.io/docs/event-data-modeling/event-data-intro/

However, https://github.com/keenlabs/KeenClient-Java/blob/master/src/main/java/io/keen/client/java/KeenClient.java#L239 currently prevents this.

I'm trying to use the library to import some legacy data and without being able to set this property, I can't do any useful time based analysis.

Thanks!

Cheers.

rbxbx commented 10 years ago

to be clear, my data looks something like

{ foo: 123,
  keen: {timestamp: "2013-10-22 14:45:26"},
  bar: 456 }
dkador commented 10 years ago

This is a bit confusing but you need to use a different method:

public void addEvent(String eventCollection, Map<String, Object> event, Map<String, Object> keenProperties,
                         AddEventCallback callback)

Set your timestamp in the keenProperties map. And just set callback to null if you don't want one.

Let me know if that doesn't work?

rbxbx commented 10 years ago

I believe that worked! Thank you :)

Any reason it can't be supported in the same method? I seem to recall overriding this property working with the Ruby library. (I could be incorrect, it was some time ago that I used it).

Cheers.

dkador commented 10 years ago

No, there's no real reason other than attempting to codify the difference between an event's body and the keen namespace through interface design. It should be simple enough to support both approaches though. 

What do you think?

On Wed, Oct 23, 2013 at 3:10 AM, Robert Pitts notifications@github.com wrote:

I believe that worked! Thank you :) Any reason it can't be supported in the same method? I seem to recall overriding this property working with the Ruby library. (I could be incorrect, it was some time ago that I used it).

Cheers.

Reply to this email directly or view it on GitHub: https://github.com/keenlabs/KeenClient-Java/issues/8#issuecomment-26893616