promotably / api

API service
Eclipse Public License 1.0
0 stars 1 forks source link

Switch from transit to JSON for event serialization #231

Closed vrivellino closed 9 years ago

vrivellino commented 9 years ago

Sister issue to https://github.com/promotably/scribe/issues/12, and should be completed after it is deployed.

vrivellino commented 9 years ago

Before this change goes out in api, let's make sure the S3 archival function will support the new format. I made some assumptions already about it's structure: https://github.com/promotably/lambchop/blob/master/kinesis-archive/ProcessKinesisRecords.js#L62-L84

cvillecsteele commented 9 years ago

@worth @vrivellino is this closed?

vrivellino commented 9 years ago

@cvillecsteele It's not. https://github.com/promotably/scribe/issues/12 is, tho. :-)

EDIT: Thought you asked Why is this closed.

cvillecsteele commented 9 years ago

Is this done?

cvillecsteele commented 9 years ago

Broken record: @vrivellino @worth is this one done?

vrivellino commented 9 years ago

Just tested in staging. Lambda-to-S3 is functioning, but looks like env is not getting set.

Here are events I pulled out of S3 (not in chronological order).

{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "offer-made",
  "msg": {
    "message-id": "2b14bced-a7ed-4d04-bcff-8f822570994f",
    "recorded-at": "20150602T210608Z",
    "event-name": "offer-made",
    "attributes": {
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "event-name": "offer-made",
      "expiry": "2015-06-02T21:21:08.347Z",
      "control-group": false,
      "offer-id": "b8f38583-1bbb-4ca7-96cc-376b1827563c",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36",
      "code": "KZAEXQ",
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0",
      "promo-id": "62f4add0-5e7a-458f-a014-178b135eebde"
    }
  }
}
{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "productview",
  "msg": {
    "message-id": "39971a2b-0a2f-4425-9ee3-ff85c2552142",
    "recorded-at": "20150602T210622Z",
    "event-name": "productview",
    "attributes": {
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "event-name": "productview",
      "user-agent": "Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/42.0.2311.152 Safari\\/537.36",
      "control-group": false,
      "user-id": "0",
      "event-format-version": "2",
      "modified-at": null,
      "source": {
        "category": "direct",
        "data": {
          "page": null,
          "referer": null
        }
      },
      "sku": "",
      "offer-id": "b8f38583-1bbb-4ca7-96cc-376b1827563c",
      "request-format-version": "1.1.0",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36",
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "site-session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0"
    }
  }
}
{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "shopper-qualified-offers",
  "msg": {
    "message-id": "5571851c-9f1b-4f95-999c-551151e6dbeb",
    "recorded-at": "20150602T210608Z",
    "event-name": "shopper-qualified-offers",
    "attributes": {
      "control-group": false,
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "offer-ids": [
        "b8f38583-1bbb-4ca7-96cc-376b1827563c"
      ],
      "event-name": "shopper-qualified-offers",
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0"
    }
  }
}
{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "session-start",
  "msg": {
    "message-id": "876b4399-0ef0-49b5-89ad-72e738af4eb8",
    "recorded-at": "20150602T210608Z",
    "event-name": "session-start",
    "attributes": {
      "event-name": "session-start",
      "event-format-version": "1",
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "control-group": false,
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "created-at": "2015-06-02T21:06:08.347Z",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0",
      "request-headers": {
        "accept": "*\\/*",
        "accept-encoding": "gzip, deflate, sdch",
        "accept-language": "en-US,en;q=0.8",
        "connection": "close",
        "host": "api-staging.promotably.com",
        "referer": "http:\\/\\/promostaging.wpengine.com\\/",
        "user-agent": "Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/42.0.2311.152 Safari\\/537.36",
        "x-forwarded-for": "10.236.162.244"
      }
    }
  }
}
{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "offershown",
  "msg": {
    "message-id": "c0e69cda-4708-41da-8b28-67e193d025ae",
    "recorded-at": "20150602T210609Z",
    "event-name": "offershown",
    "attributes": {
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "event-name": "offershown",
      "user-agent": "Mozilla\\/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/42.0.2311.152 Safari\\/537.36",
      "control-group": false,
      "event-format-version": "2",
      "offer-id": "b8f38583-1bbb-4ca7-96cc-376b1827563c",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36",
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "seconds-remaining": 874,
      "site-session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0"
    }
  }
}
{
  "v": "1",
  "env": null,
  "src": "api",
  "type": "bucket-assigned",
  "msg": {
    "message-id": "db17089e-0a95-4599-8cc6-1c573b1d1d2c",
    "recorded-at": "20150602T210608Z",
    "event-name": "bucket-assigned",
    "attributes": {
      "control-group": false,
      "session-id": "47e93549-8fc8-4ce6-851b-bdce4239a661",
      "event-format-version": "1",
      "event-name": "bucket-assigned",
      "site-shopper-id": "fa882909-1338-4093-bffa-31a37b8d9db0",
      "site-id": "d6fe7d47-9782-4af7-8caf-f2e8a18ec750",
      "bucket": "test",
      "shopper-id": "68b89175-a4fc-4843-8f2a-d679d49c6a36"
    }
  }
}