@@ -511,6 +511,19 @@ def __init__(self, load_balancing_policy=None, retry_policy=None,
511511 self .graph_options .set_source_analytics ()
512512
513513
514+ class ApplicationInfo (object ):
515+ def __init__ (self , application_name = None , application_version = None , client_id = None ):
516+ if not isinstance (application_name , str ):
517+ raise TypeError ('application_name must be a string' )
518+ if not isinstance (application_version , str ):
519+ raise TypeError ('application_version must be a string' )
520+ if not isinstance (client_id , str ):
521+ raise TypeError ('client_id must be a string' )
522+ self .application_name = application_name
523+ self .application_version = application_version
524+ self .client_id = client_id
525+
526+
514527class ProfileManager (object ):
515528
516529 def __init__ (self ):
@@ -706,6 +719,15 @@ class Cluster(object):
706719 Setting this to :const:`False` disables compression.
707720 """
708721
722+ application_info = None
723+ """
724+ An instance of :class:`.cluster.ApplicationInfo` or one of its subclasses.
725+
726+ Defaults to None
727+
728+ When not None makes driver sends information about application that uses driver in startup frame
729+ """
730+
709731 _auth_provider = None
710732 _auth_provider_callable = None
711733
@@ -1204,6 +1226,7 @@ def __init__(self,
12041226 shard_aware_options = None ,
12051227 metadata_request_timeout = None ,
12061228 column_encryption_policy = None ,
1229+ application_info = None
12071230 ):
12081231 """
12091232 ``executor_threads`` defines the number of threads in a pool for handling asynchronous tasks such as
@@ -1329,6 +1352,14 @@ def __init__(self,
13291352 raise TypeError ("address_translator should not be a class, it should be an instance of that class" )
13301353 self .address_translator = address_translator
13311354
1355+ if application_info is not None :
1356+ if isinstance (application_info , type ):
1357+ raise TypeError ("application_info should not be a class, it should be an instance of ApplicationInfo class" )
1358+ if not isinstance (application_info , ApplicationInfo ):
1359+ raise TypeError (
1360+ "application_info should be an instance of ApplicationInfo class" )
1361+ self .application_info = application_info
1362+
13321363 if timestamp_generator is not None :
13331364 if not callable (timestamp_generator ):
13341365 raise ValueError ("timestamp_generator must be callable" )
@@ -1779,6 +1810,7 @@ def _make_connection_kwargs(self, endpoint, kwargs_dict):
17791810 kwargs_dict .setdefault ('user_type_map' , self ._user_types )
17801811 kwargs_dict .setdefault ('allow_beta_protocol_version' , self .allow_beta_protocol_version )
17811812 kwargs_dict .setdefault ('no_compact' , self .no_compact )
1813+ kwargs_dict .setdefault ('application_info' , self .application_info )
17821814
17831815 return kwargs_dict
17841816
0 commit comments