File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
docs/platforms/python/tracing/configure-sampling Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ def traces_sampler(sampling_context: SamplingContext) -> float:
158158 return 0.8
159159
160160 # Sample less for high-volume, low-value paths
161- transaction_name = transaction_ctx[" name" ]
161+ name = transaction_ctx[" name" ]
162162 if name and name.startswith(" /api/metrics" ):
163163 return 0.01
164164
@@ -259,17 +259,17 @@ def traces_sampler(sampling_context: SamplingContext) -> float:
259259
260260 # Sample more transactions with high memory usage
261261 # Note: memory_usage_mb is a custom attribute
262- if data [" memory_usage_mb" ] > 500 :
262+ if custom_sampling_ctx [" memory_usage_mb" ] > 500 :
263263 return 0.8
264264
265265 # Sample more transactions with high CPU usage
266266 # Note: cpu_percent is a custom attribute
267- if data [" cpu_percent" ] > 80 :
267+ if custom_sampling_ctx [" cpu_percent" ] > 80 :
268268 return 0.8
269269
270270 # Sample more transactions with high database load
271271 # Note: db_connections is a custom attribute
272- if data [" db_connections" ] > 100 :
272+ if custom_sampling_ctx [" db_connections" ] > 100 :
273273 return 0.7
274274
275275 # Default sampling rate
You can’t perform that action at this time.
0 commit comments