@@ -287,6 +287,10 @@ def value(self, key: str) -> None:
287
287
return None
288
288
289
289
290
+ def _strip_leading_slash (path : str ) -> str :
291
+ return path .lstrip (" /" ).strip ()
292
+
293
+
290
294
def convert_to_bool (value : Any ) -> bool :
291
295
if isinstance (value , bool ):
292
296
return value
@@ -339,14 +343,22 @@ def convert_to_list(value: Any) -> List[Any]:
339
343
return []
340
344
341
345
346
+ def convert_ignore_paths (value : Any ) -> List [str ]:
347
+ """
348
+ Removes leading slashes from paths and returns a list of strings.
349
+ """
350
+ raw_paths = convert_to_list (value )
351
+ return [_strip_leading_slash (path ) for path in raw_paths ]
352
+
353
+
342
354
def convert_endpoint_sampling (value : Union [str , Dict [str , Any ]]) -> Dict [str , int ]:
343
355
"""
344
356
Converts endpoint sampling configuration from string or dict format
345
357
to a normalized dict.
346
358
Example: '/endpoint:40,/test:0' -> {'/endpoint': 40, '/test': 0}
347
359
"""
348
360
if isinstance (value , dict ):
349
- return {k : int (v ) for k , v in value .items ()}
361
+ return {_strip_leading_slash ( k ) : int (v ) for k , v in value .items ()}
350
362
if isinstance (value , str ):
351
363
if not value .strip ():
352
364
return {}
@@ -362,7 +374,7 @@ def convert_endpoint_sampling(value: Union[str, Dict[str, Any]]) -> Dict[str, in
362
374
"Must be between 0 and 100."
363
375
)
364
376
continue
365
- result [endpoint . strip ( )] = rate_int
377
+ result [_strip_leading_slash ( endpoint )] = rate_int
366
378
except ValueError :
367
379
logger .warning (f"Invalid sampling configuration: { pair } " )
368
380
continue
@@ -375,9 +387,9 @@ def convert_endpoint_sampling(value: Union[str, Dict[str, Any]]) -> Dict[str, in
375
387
"core_agent_download" : convert_to_bool ,
376
388
"core_agent_launch" : convert_to_bool ,
377
389
"disabled_instruments" : convert_to_list ,
378
- "ignore" : convert_to_list ,
379
- "ignore_endpoints" : convert_to_list ,
380
- "ignore_jobs" : convert_to_list ,
390
+ "ignore" : convert_ignore_paths ,
391
+ "ignore_endpoints" : convert_ignore_paths ,
392
+ "ignore_jobs" : convert_ignore_paths ,
381
393
"monitor" : convert_to_bool ,
382
394
"sample_rate" : convert_sample_rate ,
383
395
"sample_endpoints" : convert_endpoint_sampling ,
0 commit comments