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

add dub #54

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/web/public/content/dub.md
Original file line number Diff line number Diff line change
@@ -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=<your 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).
Binary file added apps/web/public/dub_favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions apps/web/src/components/tools/dub/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use client"

import { useQueryState } from 'nuqs'
import { useEffect } from 'react'

export default function DubDashboard() {
const [token] = useQueryState('token')

useEffect(() => {
async function fetchMetrics() {
if (!token) return

try {
const [] = await Promise.all([
])
} catch (error) {
console.error('Failed to fetch metrics:', error)
}
}

fetchMetrics()
}, [token])

return (
<div className="space-y-8">
{/* Metrics Row */}
<div className="grid gap-4 md:grid-cols-3">
</div>

{/* Charts Grid */}
<div className="grid gap-4 md:grid-cols-2">
</div>
</div>
)
}
19 changes: 19 additions & 0 deletions apps/web/src/components/tools/dub/readme.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="container max-w-4xl mx-auto py-8">
<Markdown content={content} />
</div>
);
}
13 changes: 13 additions & 0 deletions apps/web/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ export const TOOLS: Record<string, AppGridItem> = {
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 = {
Expand Down Expand Up @@ -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;
13 changes: 13 additions & 0 deletions tinybird/datasources/dub.datasource
Original file line number Diff line number Diff line change
@@ -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:$.event` DEFAULT 'unknown',
`event` JSON(max_dynamic_types=2, max_dynamic_paths=16) `json:$` DEFAULT '{}'

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(event_time)"
ENGINE_SORTING_KEY "event_time"
Loading