This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
feature: adding telemetry #70
Merged
seveibar
merged 6 commits into
tscircuit:main
from
DamilolaAlao:add-telemetry-to-to-tsci-dev
Jul 11, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
28e7aa3
feature: adding telemetry
DamilolaAlao a98d45d
add: tsup config
DamilolaAlao ed61f63
Merge branch 'tscircuit:main' into add-telemetry-to-to-tsci-dev
DamilolaAlao 5b43493
update: tsup config
DamilolaAlao 2d8aa44
set default POSTHOG API KEY
DamilolaAlao 3c8c583
add: posthog proxy
DamilolaAlao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { PostHog } from 'posthog-node' | ||
|
||
const POSTHOG_API_KEY: string | undefined = process.env.POSTHOG_API_KEY | ||
|
||
let posthogInstance: PostHog | null = null | ||
|
||
if (POSTHOG_API_KEY) { | ||
posthogInstance = new PostHog( | ||
POSTHOG_API_KEY, | ||
{ host: 'https://us.i.posthog.com' } | ||
) | ||
} | ||
|
||
const posthogProxy = new Proxy<PostHog>({} as PostHog, { | ||
get(target, prop) { | ||
if (posthogInstance) { | ||
return Reflect.get(posthogInstance, prop) | ||
} | ||
// Return a no-op function for any method call if PostHog is not initialized | ||
return () => {} | ||
} | ||
}) | ||
|
||
export default posthogProxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'tsup' | ||
|
||
export default defineConfig({ | ||
env: { | ||
POSTHOG_API_KEY: JSON.stringify(process.env.POSTHOG_API_KEY || ''), | ||
}, | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh this is a nice method