Add Sentry integration info (#116)

![Screenshot 2023-11-20 at 5 52 01 PM](https://github.com/hyperdxio/hyperdx/assets/149748269/806a6c02-9b40-4901-b342-20a54da9e4e5)
This commit is contained in:
Shorpo 2023-11-20 19:46:31 -07:00 committed by GitHub
parent df19eef14c
commit f205ed5b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/app': patch
---
feat: Add Sentry Integration section to Team Settings

View file

@ -32,6 +32,7 @@ describe('team router', () => {
Object {
"allowedAuthMethods": Array [],
"name": "fake@deploysentinel.com's Team",
"sentryDSN": "",
"teamInvites": Array [],
"users": Array [
Object {

View file

@ -71,6 +71,20 @@ router.post('/', isUserAuthenticated, async (req, res, next) => {
}
});
const getSentryDSN = (apiKey: string, ingestorApiUrl: string) => {
try {
const url = new URL(ingestorApiUrl);
url.username = apiKey.replaceAll('-', '');
url.pathname = '0';
// TODO: Set up hostname from env variable
url.hostname = 'localhost';
return url.toString();
} catch (e) {
logger.error(serializeError(e));
return '';
}
};
router.get('/', isUserAuthenticated, async (req, res, next) => {
try {
const teamId = req.user?.team;
@ -114,6 +128,7 @@ router.get('/', isUserAuthenticated, async (req, res, next) => {
name: ti.name,
url: `${config.FRONTEND_URL}/join-team?token=${ti.token}`,
})),
sentryDSN: getSentryDSN(team.apiKey, config.INGESTOR_API_URL),
});
} catch (e) {
next(e);

View file

@ -61,7 +61,7 @@ export default function MyApp({ Component, pageProps }: AppProps) {
<Head>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css"
/>
<link rel="icon" type="image/png" sizes="32x32" href="/Icon32.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />

View file

@ -258,7 +258,7 @@ export default function TeamPage() {
<div className="my-5">
<h2>Slack Webhooks</h2>
<div className="text-muted">
Lean how to set up a Slack webhook{' '}
Learn how to set up a Slack webhook{' '}
<a
href="https://api.slack.com/messaging/webhooks"
target="_blank"
@ -341,6 +341,27 @@ export default function TeamPage() {
</Modal.Body>
</Modal>
</div>
{team.sentryDSN && (
<div className="my-5">
<h2>Sentry Integration</h2>
<div className="mb-2 text-muted">
To setup Sentry integration, use your Sentry DSN below.
</div>
<div>
<strong>{team.sentryDSN}</strong>
<CopyToClipboard text={team.sentryDSN}>
<Button
variant="link"
className="px-0 text-muted-hover text-decoration-none fs-7 ms-3"
>
📋 Copy URL
</Button>
</CopyToClipboard>
</div>
</div>
)}
{hasAllowedAuthMethods && (
<>
<h2>Security Policies</h2>