Skip to content

Commit

Permalink
feat: enable profiling for 20 percent of instances
Browse files Browse the repository at this point in the history
  • Loading branch information
KishenKumarrrrr committed Nov 1, 2024
1 parent 0766973 commit 33224ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shared/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import tracer from 'dd-trace'
import { ClientRequest, IncomingMessage } from 'http'
import { Span } from 'opentracing'

const RANDOM_NUMBER_MAX_100 = Math.floor(Math.random() * 100) + 1 // Number from 1 - 100
const ENABLE_PROFILING_FOR_20_PER_CENT = RANDOM_NUMBER_MAX_100 <= 20 // 20% chance of enabling profiling

// Make it an init function so the code won't be evaluated and flagged as invalid
// on frontend linting-in-background during development
export function init() {
tracer.init({
profiling: true,
profiling: ENABLE_PROFILING_FOR_20_PER_CENT,
})
tracer.use('http', {
client: {
Expand Down

0 comments on commit 33224ed

Please sign in to comment.