@@ -127,7 +127,8 @@ def _load_credential_from_envvar(
127127 if credential_env :
128128 credentials = _import_config_component (
129129 credential_env , "opentelemetry_otlp_credential_provider"
130- )
130+ )()
131+ print (credentials )
131132 if isinstance (credentials , ChannelCredentials ):
132133 return ("credentials" , credentials )
133134 elif isinstance (credentials , Session ):
@@ -265,22 +266,11 @@ def _init_exporter(
265266 )
266267 or otlp_credential_param_for_all_signal_types
267268 )
268- if not otlp_credential_param :
269- return exporter_class (** exporter_args_map )
270- credential_key , credential = otlp_credential_param
271- params = inspect .signature (exporter_class .__init__ ).parameters
272- if (
273- credential_key == "credentials"
274- and "credentials" in params
275- and "ChannelCredentials" in params ["credentials" ].annotation
276- ):
277- return exporter_class (credentials = credential , ** exporter_args_map )
278- if (
279- credential_key == "session"
280- and "session" in params
281- and "Session" in params ["session" ].annotation
282- ):
283- return exporter_class (session = credential , ** exporter_args_map )
269+ if otlp_credential_param :
270+ credential_key , credential = otlp_credential_param
271+ # We only want to inject credentials into the appropriate OTLP HTTP // GRPC exporters.
272+ if credential_key in inspect .signature (exporter_class .__init__ ).parameters and ("opentelemetry.exporter.otlp.proto.http" in str (exporter_class ) or "opentelemetry.exporter.otlp.proto.grpc" in str (exporter_class )):
273+ exporter_args_map [credential_key ] = credential
284274 return exporter_class (** exporter_args_map )
285275
286276
0 commit comments