8000 Add partitioned analytics to new api functions by davisengeler · Pull Request #83 · Vibe-House-LLC/memeSRC · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add partitioned analytics to new api functions #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 19, 2023
Merged

Conversation

davisengeler
Copy link
Contributor

Description

This PR adds functionality for writing partitioned analytics events using the functions powering the new APIs. It writes them to the app's Amplify Storage (S3) to keep everything isolated and contained to a single deployment.

Details

Events are written to S3 using a hive partitioning style prefixing methodology using eventYear, eventMonth, and eventDay, what are automatically derived from the time the event is created: eventTime.

Usage Example

// Prep the event data
const eventData = {
    searchString,
    seriesName
};

// Send the event data
await trackAnalyticsEventToS3(data: eventData, type: "search");

Resulting S3 Object:

analytics/search/eventYear=2023/eventMonth=02/eventDay=19/f94d41dc-8d7f-4f08-8b6e-77360b069a9c.json
{
    "searchString": "for example",
    "seriesName": "seinfeld",
    "eventTime": "2023-02-19T01:15:51.726Z",
    "eventYear": 2023,
    "eventMonth": "02",
    "eventDay": "19"
}

Todo

  • Generalize this functionality (and possibly use a lambda layer) to make it quicker and easier to use in new functions.
  • Add the ability for the app to use Athena to query its analytics data from S3.

@davisengeler davisengeler added the enhancement New feature or request label Feb 19, 2023
@davisengeler davisengeler self-assigned this Feb 19, 2023
@davisengeler davisengeler merged commit 3e3ebd1 into dev Feb 19, 2023
@davisengeler davisengeler deleted the analytics branch February 19, 2023 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0