π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
Basic Sentry Metric Functionality (#1064)
Enno Gelhausbd70bb655554
diff --git a/apps/backend/src/api/routes/auth.controller.ts b/apps/backend/src/api/routes/auth.controller.tsindex f576f38f9..338bf962c 100644--- a/apps/backend/src/api/routes/auth.controller.ts+++ b/apps/backend/src/api/routes/auth.controller.ts@@ -21,6 +21,7 @@ import { EmailService } from '@gitroom/nestjs-libraries/services/email.service';import { RealIP } from 'nestjs-real-ip';import { UserAgent } from '@gitroom/nestjs-libraries/user/user.agent';import { Provider } from '@prisma/client';+import * as Sentry from '@sentry/nestjs';@ApiTags('Auth')@Controller('/auth')@@ -101,6 +102,7 @@ export class AuthController {}}+ Sentry.metrics.count("new_user", 1);response.header('onboarding', 'true');response.status(200).json({register: true,diff --git a/apps/backend/src/public-api/routes/v1/public.integrations.controller.ts b/apps/backend/src/public-api/routes/v1/public.integrations.controller.tsindex 7f27ad093..2655f699b 100644--- a/apps/backend/src/public-api/routes/v1/public.integrations.controller.ts+++ b/apps/backend/src/public-api/routes/v1/public.integrations.controller.ts@@ -30,12 +30,13 @@ import { UploadDto } from '@gitroom/nestjs-libraries/dtos/media/upload.dto';import axios from 'axios';import { Readable } from 'stream';import { lookup } from 'mime-types';+import * as Sentry from '@sentry/nestjs';@ApiTags('Public API')@Controller('/public/v1')export class PublicIntegrationsController {private storage = UploadFactory.createStorage();-+constructor(private _integrationService: IntegrationService,private _postsService: PostsService,@@ -48,6 +49,7 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@UploadedFile('file') file: Express.Multer.File) {+ Sentry.metrics.count("public_api-request", 1);if (!file) {throw new HttpException({ msg: 'No file provided' }, 400);}@@ -65,6 +67,7 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Body() body: UploadDto) {+ Sentry.metrics.count("public_api-request", 1);const response = await axios.get(body.url, {responseType: 'arraybuffer',});@@ -96,6 +99,7 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Param('id') id?: string) {+ Sentry.metrics.count("public_api-request", 1);return { date: await this._postsService.findFreeDateTime(org.id, id) };}@@ -104,6 +108,7 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Query() query: GetPostsDto) {+ Sentry.metrics.count("public_api-request", 1);const posts = await this._postsService.getPosts(org.id, query);return {posts,@@ -117,6 +122,7 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Body() rawBody: any) {+ Sentry.metrics.count("public_api-request", 1);const body = await this._postsService.mapTypeToPost(rawBody,org.id,@@ -133,17 +139,20 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Param() body: { id: string }) {+ Sentry.metrics.count("public_api-request", 1);const getPostById = await this._postsService.getPost(org.id, body.id);return this._postsService.deletePost(org.id, getPostById.group);}@Get('/is-connected')async getActiveIntegrations(@GetOrgFromRequest() org: Organization) {+ Sentry.metrics.count("public_api-request", 1);return { connected: true };}@Get('/integrations')async listIntegration(@GetOrgFromRequest() org: Organization) {+ Sentry.metrics.count("public_api-request", 1);return (await this._integrationService.getIntegrationsList(org.id)).map((org) => ({id: org.id,@@ -167,11 +176,13 @@ export class PublicIntegrationsController {@GetOrgFromRequest() org: Organization,@Body() body: VideoDto) {+ Sentry.metrics.count("public_api-request", 1);return this._mediaService.generateVideo(org, body);}@Post('/video/function')videoFunction(@Body() body: VideoFunctionDto) {+ Sentry.metrics.count("public_api-request", 1);return this._mediaService.videoFunction(body.identifier,body.functionName,diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.tsindex fea332712..12163659b 100644--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.service.ts@@ -38,6 +38,7 @@ import { plainToInstance } from 'class-transformer';import { validate } from 'class-validator';import { stripHtmlValidation } from '@gitroom/helpers/utils/strip.html.validation';dayjs.extend(utc);+import * as Sentry from '@sentry/nestjs';type PostWithConditionals = Post & {integration?: Integration;@@ -717,6 +718,7 @@ export class PostsService {});}+ Sentry.metrics.count("post_created", 1);postList.push({postId: posts[0].id,integration: post.integration.id,diff --git a/package.json b/package.jsonindex a4c1e46c9..be1d46047 100644--- a/package.json+++ b/package.json@@ -78,9 +78,9 @@"@neynar/react": "^0.9.7","@postiz/wallets": "^0.0.1","@prisma/client": "^6.5.0",- "@sentry/nestjs": "^10.12.0",- "@sentry/nextjs": "^10.12.0",- "@sentry/profiling-node": "^10.12.0",+ "@sentry/nestjs": "^10.25.0",+ "@sentry/nextjs": "^10.25.0",+ "@sentry/profiling-node": "^10.25.0","@solana/wallet-adapter-react": "^0.15.35","@solana/wallet-adapter-react-ui": "^0.9.35","@swc/helpers": "0.5.13",