Giter VIP home page Giter VIP logo

amplitudelambda's Introduction

README

Project overview

Some information is available from the server-side (Comandante) and not the client-side (Android)

Status quo: Tala's Android events were logged in Amplitude, but not server-side.

Project objective : write a AWS Lambda that reads server-side (Comandante) info from Kinesis and creates a corresponding HTTP POST request to Amplitude.

Process Diagram

Amplitude EVENT vs IDENTIFICATION

There are two types of posts -- event and identification.

  1. Event posts are logged as events that can be viewed on a user's timeline. User properties sent with an event post will be reflected accordingly.
  2. Identification posts can be viewed as "update user properties only" posts -- they are not sent with events; user properties added / changed with these posts will be reflected starting with the next Event post. For example, consider the following stream of three consecutive posts for single user: (Event post 1) -> (Identification post 1: add property field "KYC status") -> (Event post 2) Event post 1 on the user's timeline will not have a "KYC status" field. Identification post 1 will not appear on the user's timeline. Event post 2 will reflect the "KYC status" field.
Design choices
  • Used snake_case instead of CamelCase to reflect Tala's Comandante Style guide . Although Comandante is written in Kotlin (not Go), much of the Json information we handle with this lambda is formatted in Comandante; Lambda selects the relevant fields but otherwise doesn't do much to reformat.
What needs to happen on Comandante

Comandante must create appropriate json byte array. For rudimentary testing purposes, I added the following lines to the main function in Comandante.

val kinesisPublisher = KinesisPublisher()
kinesisPublisher.addUserRecord("""[{"user_id":"test-user-molly-9", "post_type": "event", "person_id": "111111123456", "event_type":"Cashout: Request", "country":"BRAZIL", "loan_application_id": "16"}] """.toByteArray())

Next steps would be to incrementally log the fields and build the string in Comandante.

What needs to happen on AWS

Please refer to the AWS Kinesis stream test-amplitude and the AWS Lambda test-amplitude-molly in the legacy environment, as well as the procedures on this page .

  • With this project, build executable "main" and zip main into deployment package "deployment.zip"
  • Use execution role service-role/lambda-kinesis

Important Notes

  • Set GOOS to Linux
  • Must set Handler name to the name of the executable (thus, in this case, set as "main")

amplitudelambda's People

Contributors

mollyhkim avatar nrghosh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.