keenlabs / keen-sdk-net

A .NET SDK for the Keen IO API
MIT License
37 stars 24 forks source link

Port streaming/event upload functionality #61

Closed baumatron closed 7 years ago

baumatron commented 7 years ago

This work item encompasses bring over code that allows SDK clients to stream events to Keen IO. The goal here is parity with the existing legacy PCL, though possibly without EventCachePortable, which merits its own issue. The bulk of this should be simply copying code over to the new netstandard project and getting it to build. All tests associated with the ported features should be ported as well.

Donistivanov commented 7 years ago

I will work on this

masojus commented 7 years ago

Depending on how much gets included in Issue #60, a good place to start might be looking at the call graph that needs to be supported to invoke KeenClient.AddEvents()/KeenClient.AddEventsAsync() without any cache, global properties support or add-ons. It might turn out the global properties and add-ons stuff is easy to port too, so if it's harder to exclude those than keep them, then just drag them in while you're at it.

Doing this much implies at a minimum that there's support for project settings and constructing the KeenClient, of course. It also means (in order to fully work) that you'll need to support Event.AddEvents() which in turn brings in KeenHttpClient and all the Http-related underpinnings. HttpClient is notoriously different across platforms, so I would expect this to be the bumpiest part. In theory you can avoid porting HttpClientCache by providing another implementation of IKeenHttpClientProvider that uses a simpler IHttpClientProvider based on KeenHttpClientFactory if that turns out to be useful. If it all just works without too much hackery that would be even better!

Also be wary at first of dragging in the cache code (See Issues #62 and #65).

masojus commented 7 years ago

I took a look at moving the Http code over in case there were any major hiccups, but it seems to be working OK. I ported enough code to retrieve some collection schemas and ran that code in a test project, and it succeeded. We need the test project in place so we can port tests while we're at it, but the fact that the Http code is working well means porting the rest should go fairly smoothly. See commit c39b1eb.

Donistivanov commented 7 years ago

So what is left is moving the tests, and some other functions?

masojus commented 7 years ago

@Donistivanov Yes, once Issue #74 is fixed, lots of tests need to be ported, and hopefully expanded upon. But in addition to that, I only barely scratched the surface of the APIs KeenClient provides, so continuing to port the rest of the Event-streaming functionality would be next (this Issue). After that the other Query-related stuff described in the "Port Keen PCL to netstandard" Project would follow, and some of the corner cases like the Event Cache implementations.

masojus commented 7 years ago

Fixed with PR #101, see commit 791d009