Skip to content

Commit 1c17863

Browse files
committed
refactor(o11y): make _has_provider more robust by using getattr
1 parent 57014ab commit 1c17863

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

  • packages/google-api-core/google/api_core/observability

packages/google-api-core/google/api_core/observability/options.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ def _has_provider(
8181
if client_options is None:
8282
return False
8383

84-
options_dict = (
85-
client_options
86-
if isinstance(client_options, dict)
87-
else getattr(client_options, "__dict__", {})
88-
)
89-
return options_dict.get(provider_key) is not None
84+
if isinstance(client_options, dict):
85+
return client_options.get(provider_key) is not None
86+
87+
return getattr(client_options, provider_key, None) is not None
9088

9189

9290
def resolve_feature_flags(

0 commit comments

Comments
 (0)