From a40eb182fc11c28e5f740f3401f52b146d60b091 Mon Sep 17 00:00:00 2001 From: sdairs Date: Mon, 13 Jan 2025 13:10:22 +0000 Subject: [PATCH 1/4] basic setup --- apps/web/public/content/dub.md | 22 +++++++++++ apps/web/public/dub_favicon.png | Bin 0 -> 851 bytes .../src/components/tools/dub/dashboard.tsx | 35 ++++++++++++++++++ apps/web/src/components/tools/dub/readme.tsx | 19 ++++++++++ apps/web/src/lib/constants.ts | 13 +++++++ tinybird/datasources/dub.datasource | 13 +++++++ 6 files changed, 102 insertions(+) create mode 100644 apps/web/public/content/dub.md create mode 100644 apps/web/public/dub_favicon.png create mode 100644 apps/web/src/components/tools/dub/dashboard.tsx create mode 100644 apps/web/src/components/tools/dub/readme.tsx create mode 100644 tinybird/datasources/dub.datasource diff --git a/apps/web/public/content/dub.md b/apps/web/public/content/dub.md new file mode 100644 index 0000000..48e461c --- /dev/null +++ b/apps/web/public/content/dub.md @@ -0,0 +1,22 @@ +# Connect Dub to Tinybird + +1. Open the Dub UI and go to the Settings > Webhooks page. + +2. Select "Create Webhook". + +3. In Tinybird, go to Tokens, and copy the `append` token. + +4. Back in Dub, paste the Events API URL as your webhook URL. Use the query parameter `name=dub` and `token=`. For example: + +``` +https://api.tinybird.co/v0/events?name=dub&token=TOKEN +``` + +5. Select the checkboxes for the events you want to send to Tinybird, and select "Create webhook". + +6. You're done. Dub will now push events to Tinybird via the [Events API](https://tinybird.co/docs/get-data-in/ingest-apis/events-api). + + +## See also + +* [Events API](https://tinybird.co/docs/get-data-in/ingest-apis/events-api). diff --git a/apps/web/public/dub_favicon.png b/apps/web/public/dub_favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..7aa285a4bf3b8e531473df6a4e714433a49dcf4e GIT binary patch literal 851 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-G$+Qd;gjJKptm- zM`SSrljaf-W>gpZlnxYRFY)wsWq-lS#A~SMR{3@o0|Vn@PZ!4!kK;?H`ezFViX5%~ zoK}*USg zFB+yfgy>x5m~`Q>(u{NS%`fxpE&uv%Pw}&T=H=%KJ=%}k%3Xe7r<%u5FEN#G_uj1O zipK4K3RYfLOX*q^8E6r@;@g&ghia!Y>t9ZiY1iXW@l=1zu6ru-gVgUiw;zbJEYy1b zCV2C~**tF^urvxV&w9E2`GH`TB!TyfeC+x26b1hNjFmXB;k4T?A3i%q#(jT}ncXcx&+AOtxg(Gr$A(noJ?rUia zu^bQKoy~G_-@1=;bf@(+_&PJ|M^zuWoci#=MT0d*vv1#tna6OAXX%Su>3cb3yxOK( z9DJL^qP^_KzY+syx zQ}&a)e;f>}k*fPVuivL(|DP0(_V7Edb3RTr|MP2q?iu5KXY5l?FLUavVdZ*qdgAiX z(2$F(_H@hYiUpUfToSoSe)@NB7t^WDTeg^U2SlXQ-g8~H(Z%R;#Iy2=iMib}laq5N zWUlMbRLp(lS-EZJ)}!| { + async function fetchMetrics() { + if (!token) return + + try { + const [] = await Promise.all([ + ]) + } catch (error) { + console.error('Failed to fetch metrics:', error) + } + } + + fetchMetrics() + }, [token]) + + return ( +
+ {/* Metrics Row */} +
+
+ + {/* Charts Grid */} +
+
+
+ ) +} diff --git a/apps/web/src/components/tools/dub/readme.tsx b/apps/web/src/components/tools/dub/readme.tsx new file mode 100644 index 0000000..9405e5b --- /dev/null +++ b/apps/web/src/components/tools/dub/readme.tsx @@ -0,0 +1,19 @@ +'use client'; + +import { useEffect, useState } from 'react'; +import { Markdown } from '@/components/markdown'; +import { getMarkdownContent } from '@/lib/markdown'; + +export default function DubReadme() { + const [content, setContent] = useState(''); + + useEffect(() => { + getMarkdownContent('dub').then(setContent); + }, []); + + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/apps/web/src/lib/constants.ts b/apps/web/src/lib/constants.ts index 91500af..2da4526 100644 --- a/apps/web/src/lib/constants.ts +++ b/apps/web/src/lib/constants.ts @@ -127,6 +127,15 @@ export const TOOLS: Record = { icon: '👀', icon_url: '/sentry_favicon.ico' }, + // Links + dub: { + id: 'dub', + ds: 'dub', + name: 'dub', + description: 'Link infrastructure', + icon: '👀', + icon_url: '/dub_favicon.png' + }, }; export const TOOL_IMPORTS = { @@ -182,6 +191,10 @@ export const TOOL_IMPORTS = { Dashboard: dynamic(() => import('@/components/tools/pagerduty/dashboard')), Readme: dynamic(() => import('@/components/tools/pagerduty/readme')), }, + dub: { + Dashboard: dynamic(() => import('@/components/tools/dub/dashboard')), + Readme: dynamic(() => import('@/components/tools/dub/readme')), + }, } as const; export type ToolId = keyof typeof TOOL_IMPORTS; \ No newline at end of file diff --git a/tinybird/datasources/dub.datasource b/tinybird/datasources/dub.datasource new file mode 100644 index 0000000..bdda19c --- /dev/null +++ b/tinybird/datasources/dub.datasource @@ -0,0 +1,13 @@ +TOKEN "append" APPEND +TOKEN "read" READ + +TAGS "dub" + +SCHEMA > + `event_time` DateTime64(3) `json:$.tinybirdIngestTime` DEFAULT now(), + `event_type` String `json:$.type` DEFAULT 'unknown', + `event` JSON `json:$` DEFAULT '{}' + +ENGINE "MergeTree" +ENGINE_PARTITION_KEY "toYYYYMM(event_time)" +ENGINE_SORTING_KEY "event_time" From 3058f8d407ca68c3c78912567ff9c49d75dd8b1c Mon Sep 17 00:00:00 2001 From: sdairs Date: Mon, 13 Jan 2025 13:13:33 +0000 Subject: [PATCH 2/4] casing --- apps/web/src/lib/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/lib/constants.ts b/apps/web/src/lib/constants.ts index 2da4526..020421d 100644 --- a/apps/web/src/lib/constants.ts +++ b/apps/web/src/lib/constants.ts @@ -131,7 +131,7 @@ export const TOOLS: Record = { dub: { id: 'dub', ds: 'dub', - name: 'dub', + name: 'Dub', description: 'Link infrastructure', icon: '👀', icon_url: '/dub_favicon.png' From 4fcd42cf2e050cf71f4501c0d996d2f46341faea Mon Sep 17 00:00:00 2001 From: sdairs Date: Mon, 13 Jan 2025 13:19:00 +0000 Subject: [PATCH 3/4] event type --- tinybird/datasources/dub.datasource | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinybird/datasources/dub.datasource b/tinybird/datasources/dub.datasource index bdda19c..cd90edd 100644 --- a/tinybird/datasources/dub.datasource +++ b/tinybird/datasources/dub.datasource @@ -5,7 +5,7 @@ TAGS "dub" SCHEMA > `event_time` DateTime64(3) `json:$.tinybirdIngestTime` DEFAULT now(), - `event_type` String `json:$.type` DEFAULT 'unknown', + `event_type` String `json:$.event` DEFAULT 'unknown', `event` JSON `json:$` DEFAULT '{}' ENGINE "MergeTree" From a4bd5de1e46b642f804bd492a3c3d36d44893483 Mon Sep 17 00:00:00 2001 From: sdairs Date: Mon, 13 Jan 2025 13:25:58 +0000 Subject: [PATCH 4/4] type --- tinybird/datasources/dub.datasource | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinybird/datasources/dub.datasource b/tinybird/datasources/dub.datasource index cd90edd..78bfa34 100644 --- a/tinybird/datasources/dub.datasource +++ b/tinybird/datasources/dub.datasource @@ -6,7 +6,7 @@ TAGS "dub" SCHEMA > `event_time` DateTime64(3) `json:$.tinybirdIngestTime` DEFAULT now(), `event_type` String `json:$.event` DEFAULT 'unknown', - `event` JSON `json:$` DEFAULT '{}' + `event` JSON(max_dynamic_types=2, max_dynamic_paths=16) `json:$` DEFAULT '{}' ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(event_time)"