Skip to content

Conversation

luis-herasme
Copy link
Member

@luis-herasme luis-herasme commented Sep 21, 2024

Checklist

  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Added PostHog for API request tracking

Related Issue

#571

Copy link

changeset-bot bot commented Sep 21, 2024

⚠️ No Changeset found

Latest commit: 5bc20fe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blobscan-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2024 3:34pm
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
blobscan-docs ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2024 3:34pm
blobscan-gnosis ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2024 3:34pm
blobscan-holesky ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2024 3:34pm
blobscan-mainnet ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2024 3:34pm
blobscan-sepolia ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2024 3:34pm

Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 31.03448% with 40 lines in your changes missing coverage. Please review.

Project coverage is 89.00%. Comparing base (3507a88) to head (5bc20fe).
Report is 48 commits behind head on main.

Files with missing lines Patch % Lines
packages/api/src/context.ts 11.90% 37 Missing ⚠️
packages/api/src/posthog.ts 81.81% 2 Missing ⚠️
packages/env/index.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
- Coverage   89.38%   89.00%   -0.38%     
==========================================
  Files         150      154       +4     
  Lines        9933    10245     +312     
  Branches     1035     1142     +107     
==========================================
+ Hits         8879     9119     +240     
- Misses       1054     1126      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Sep 21, 2024

📦 Next.js Bundle Analysis for @blobscan/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 332.79 KB (🔴 +87.17 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

New Pages Added

The following pages were added to the bundle from the code in this PR:

Page Size (compressed) First Load % of Budget (350 KB)
/block_neighbor 251 B 333.04 KB 95.15%
/stats 347.54 KB 680.33 KB 194.38%

Eight Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/ 351.81 KB 684.6 KB 195.60% (🟢 -5.01%)
/address/[address] 26.94 KB 359.73 KB 102.78% (🟢 -4.80%)
/blob/[hash] 27.62 KB 360.41 KB 102.98% (🟢 -4.24%)
/blobs 76.51 KB 409.3 KB 116.94% (🟡 +12.49%)
/block/[id] 14.3 KB 347.09 KB 99.17% (🟢 -4.16%)
/blocks 74.21 KB 407 KB 116.29% (🟡 +12.47%)
/tx/[hash] 16.3 KB 349.09 KB 99.74% (🟡 +0.87%)
/txs 73.71 KB 406.5 KB 116.14% (🟡 +10.47%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

Copy link
Member

@PabloCastellano PabloCastellano left a comment

Choose a reason for hiding this comment

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

some last changes and we're ready to merge

Copy link
Member

@PabloCastellano PabloCastellano left a comment

Choose a reason for hiding this comment

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

LGTM! 👌

Copy link
Member

@PJColombo PJColombo left a comment

Choose a reason for hiding this comment

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

Nice job.

We should move the posthog setup from the api package to the rest-api-server app instead.

The api is consumed by both the web and the REST API apps. So we're basically setting up twice for the web

@PabloCastellano PabloCastellano merged commit e7187c3 into main Oct 17, 2024
11 of 14 checks passed
@PabloCastellano PabloCastellano deleted the posthog-api branch October 17, 2024 05:02
luis-herasme added a commit that referenced this pull request Oct 19, 2024
* feat: Add PostHog integration for API request tracking

* chore: added changeset

* feat: Add posthog to trpc/api

* feat: PostHog is now optional

* chore: Remove unnecessary include in tsconfig.json

* Update .changeset/brave-pants-divide.md

Co-authored-by: Pablo Castellano <[email protected]>

* chore: Use a random UUID for the PostHog distinctId

* feat: Add posthog-js to the frontend

* refactor: Update posthog.capture to use getIP function

* chore: Rename POSTHOG_KEY to POSTHOG_ID

* docs: Added posthog .env docs

* refactor: Update PostHog host URL in environment configuration

* chore: Remove PostHog changeset

* Adds NEXT_PUBLIC_POSTHOG_ID and NEXT_PUBLIC_POSTHOG_HOST to env

---------

Co-authored-by: Pablo Castellano <[email protected]>
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