Skip to content
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

Update - refactor telemetry tracking logic in oss #1069

Merged
merged 9 commits into from
Jan 8, 2024

Conversation

aybruhm
Copy link
Member

@aybruhm aybruhm commented Dec 18, 2023

Description

This PR refactors the telemetry tracking logic in OSS.

Related Issue

Closes #199_ag-cloud

@aybruhm aybruhm requested a review from mmabrouk December 18, 2023 10:36
Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR @aybruhm !
Code wise, I approve it. However, there are failing tests. Can you please look into this.

@mmabrouk
Copy link
Member

@devgenix can you please test the implementation (serve from cli (current version) then use in web cloud version to check for any bugs). Thank you!

@mmabrouk mmabrouk requested a review from devgenix December 18, 2023 11:05
@aybruhm
Copy link
Member Author

aybruhm commented Dec 18, 2023

Thanks for the quick PR @aybruhm ! Code wise, I approve it. However, there are failing tests. Can you please look into this.

@mmabrouk, the failed frontend tests are a result of our OpenAI quota.

@aybruhm aybruhm requested a review from mmabrouk December 20, 2023 00:06
@mmabrouk
Copy link
Member

@devgenix please see above

Copy link
Contributor

@devgenix devgenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's caused by this PR but after serving an app ( in both OSS and Cloud ), it fails to run in the playground with this error;
image

@mmabrouk
Copy link
Member

mmabrouk commented Dec 22, 2023

@devgenix can you look more into this?!
What's the container outputs? Who is calling this module error? Does this happen when you checkout your main?...

@devgenix
Copy link
Contributor

@devgenix can you look more into this?! What's the container outputs? Who is calling this module error? Does this happen when you checkout your main?...

I just checked out main and it's happening there too.

@mmabrouk
Copy link
Member

@devgenix and?

Copy link
Contributor

@devgenix devgenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a re-check after noticing the error to be happening in other branches too.
It happens that the error I was getting earlier was coming from the clashing dependencies of Langchain and Openai in my local environment. Once I resolved it and re-tested this, all was good.

Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aybruhm sorry for the very late review. Please see the comment


export const generateOrRetrieveDistinctId = (): string => {
if (typeof localStorage !== "undefined") {
let distinctId = localStorage.getItem("posthog_distinct_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to generate a posthog distinct id in this case, I though if we leave it empty posthog would take care of all of this automatically

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aybruhm reminder

Copy link
Member Author

@aybruhm aybruhm Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made changes because PostHog wasn't keeping IDs unique for user requests.

When I tested it without the current code changes, I noticed that after a while, PostHog started using a different ID for the events been triggered. So, I figured it'd be better to generate a UUID for each user, stick it to their browser, and let PostHog use that as their distinct ID. This way, even if a user takes off for a few days and comes back (unless they clear their browser storage), PostHog will keep on tracking them with the generated UUID as their ID.

@mmabrouk

Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @aybruhm and sorry for the late review

@mmabrouk mmabrouk merged commit 12b4fcc into main Jan 8, 2024
8 checks passed
@aakrem aakrem deleted the gh/telemetry-tracking-issue-fixed branch January 31, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants