MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveSamplingRatio

Function resolveSamplingRatio

apps/sim/instrumentation-node.ts:99–110  ·  view source on GitHub ↗
(_isLocalEndpoint: boolean)

Source from the content-addressed store, hash-verified

97// Sampling ratio from env (mirrors Go's `samplerFromEnv`); fallback
98// is 100% everywhere. Retention caps cost, not sampling.
99function resolveSamplingRatio(_isLocalEndpoint: boolean): number {
100 const raw = process.env.TELEMETRY_SAMPLING_RATIO || process.env.OTEL_TRACES_SAMPLER_ARG || ''
101 if (raw) {
102 const parsed = Number.parseFloat(raw)
103 if (Number.isFinite(parsed)) {
104 if (parsed <= 0) return 0
105 if (parsed >= 1) return 1
106 return parsed
107 }
108 }
109 return 1.0
110}
111
112// Tags allowed spans with `mothership.origin` and prepends
113// `sim-mothership:` to the span name so backends can visually split

Callers 1

initializeOpenTelemetryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected