mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 02:42:59 +00:00 
			
		
		
		
	 7709d9df20
			
		
	
	
		7709d9df20
		
			
		
	
	
	
	
		
			
			Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: jZonG <jzongcode@gmail.com>
		
			
				
	
	
		
			30 lines
		
	
	
		
			706 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			706 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 'use client'
 | |
| 
 | |
| import { useEffect } from 'react'
 | |
| import * as Sentry from '@sentry/react'
 | |
| 
 | |
| const isDevelopment = process.env.NODE_ENV === 'development'
 | |
| 
 | |
| const SentryInit = ({
 | |
|   children,
 | |
| }: { children: React.ReactNode }) => {
 | |
|   useEffect(() => {
 | |
|     const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
 | |
|     if (!isDevelopment && SENTRY_DSN) {
 | |
|       Sentry.init({
 | |
|         dsn: SENTRY_DSN,
 | |
|         integrations: [
 | |
|           Sentry.browserTracingIntegration(),
 | |
|           Sentry.replayIntegration(),
 | |
|         ],
 | |
|         tracesSampleRate: 0.1,
 | |
|         replaysSessionSampleRate: 0.1,
 | |
|         replaysOnErrorSampleRate: 1.0,
 | |
|       })
 | |
|     }
 | |
|   }, [])
 | |
|   return children
 | |
| }
 | |
| 
 | |
| export default SentryInit
 |