2424import com .looker .rtl .Transport ;
2525import com .looker .rtl .TransportKt ;
2626import com .looker .sdk .ApiSettings ;
27+ import com .looker .sdk .Constants ;
2728import com .looker .sdk .LookerSDK ;
2829
2930import java .sql .SQLException ;
@@ -48,6 +49,8 @@ private LookerSdkFactory() {
4849
4950 private static final String RESULT_FORMAT = "json_bi" ;
5051 private static final String QUERY_ENDPOINT = "/api/4.0/sql_interface_queries/%s/run/%s" ;
52+ private static final String DRIVER_USER_AGENT = "looker-jdbc-driver-1.24.1" ;
53+ private static final String USER_AGENT_STRING = "User-Agent" ;
5154
5255 /**
5356 * 1 hour in seconds. This is not configurable.
@@ -125,12 +128,15 @@ private static AuthSession createAuthSession(String url, Map<String, String> pro
125128
126129 ConfigurationProvider finalizedConfig = ApiSettings .fromMap (apiConfig );
127130
131+ // assign values for user agent and x-looker-appid headers and add to session
128132 String userAgent = props .get ("userAgent" );
129- if (userAgent != null ) {
130- Map <String , String > headers = finalizedConfig .getHeaders ();
131- headers .put ("User-Agent" , props .get ("userAgent" ));
132- finalizedConfig .setHeaders (headers );
133+ if (userAgent == null ) {
134+ userAgent = DRIVER_USER_AGENT ;
133135 }
136+ Map <String , String > headers = finalizedConfig .getHeaders ();
137+ headers .put (USER_AGENT_STRING , userAgent );
138+ headers .put (Constants .LOOKER_APPID , userAgent );
139+ finalizedConfig .setHeaders (headers );
134140
135141 AuthSession session = new AuthSession (finalizedConfig , new Transport (finalizedConfig ));
136142
0 commit comments