-
Notifications
You must be signed in to change notification settings - Fork 549
Migrate typing for opentelemetry files #4510
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
4b736e1
to
80dd79f
Compare
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## neel/typing #4510 +/- ##
===============================================
- Coverage 84.68% 84.67% -0.01%
===============================================
Files 144 144
Lines 14847 14854 +7
Branches 2370 2372 +2
===============================================
+ Hits 12573 12578 +5
- Misses 1544 1545 +1
- Partials 730 731 +1
|
if profiler_id is None: | ||
return None | ||
|
||
return {"profiler_id": profiler_id} | ||
|
||
|
||
def get_typed_attribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper function to get an attribute with a certain typecheck
@@ -1561,10 +1561,11 @@ def parse_url(url: str, sanitize: bool = True) -> ParsedUrl: | |||
) | |||
|
|||
|
|||
def is_valid_sample_rate(rate: Any, source: str) -> bool: | |||
def is_valid_sample_rate(rate: Any, source: str) -> Optional[float]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returns the validated float sample_rate
to simplify all the float casts around
80dd79f
to
612f157
Compare
612f157
to
554c391
Compare
5a5ca51
to
3f2b752
Compare
* remove casts * generalize `is_valid_sample_rate` to return the validated float * added a `validate_scopes` helper method to validate the scopes entry on the context and return the narrowed type * added a `get_typed_attribute` helper method to narrow the type on getting attributes from otel * fix a flaky test on gevent
* remove casts * generalize `is_valid_sample_rate` to return the validated float * added a `validate_scopes` helper method to validate the scopes entry on the context and return the narrowed type * added a `get_typed_attribute` helper method to narrow the type on getting attributes from otel * fix a flaky test on gevent
is_valid_sample_rate
to return the validated floatvalidate_scopes
helper method to validate the scopes entry on the context and return the narrowed typeget_typed_attribute
helper method to narrow the type on getting attributes from otel