diff --git a/index.d.ts b/index.d.ts index 0d4e17bea..f90069015 100644 --- a/index.d.ts +++ b/index.d.ts @@ -615,6 +615,14 @@ declare module 'snowflake-sdk' { */ requestId?: string; + /** + * The request GUID is a unique identifier of an HTTP request issued to Snowflake. + * Unlike the requestId, it is regenerated even when the request is resend with the retry mechanism. + * If not specified, request GUIDs are attached to all requests to Snowflake for better traceability. + * In the majority of cases it should not be set or filled with true value. + */ + includeGuid?: string; + /** * Use different rest endpoints based on whether the query id is available. */ diff --git a/lib/services/sf.js b/lib/services/sf.js index a1b26edfe..de8ebe447 100644 --- a/lib/services/sf.js +++ b/lib/services/sf.js @@ -375,7 +375,6 @@ function SnowflakeService(connectionConfig, httpClient, config) { * @constructor */ function OperationRequest(options) { - options = { ...options, ...{ includeGuid: true } }; OperationAbstract.apply(this, [options]); } @@ -787,6 +786,8 @@ function StateAbstract(options) { // augment the options with the absolute url requestOptions.absoluteUrl = this.buildFullUrl(requestOptions.url); + + requestOptions.includeGuid = Util.exists(requestOptions.includeGuid) ? requestOptions.includeGuid : true; }; /** @@ -1253,7 +1254,6 @@ StateConnecting.prototype.continue = function () { scope: this, startTime: startTime, retry: numRetries, - includeGuid: true, callback: requestCallback }); request.send(); @@ -1409,7 +1409,6 @@ StateConnected.prototype.destroy = function (options) { method: 'POST', url: `/session?delete=true&requestId=${requestID}`, scope: this, - includeGuid: true, callback: function (err) { // if the destroy request succeeded or the session already expired, we're disconnected if (!err || err.code === GSErrors.code.GONE_SESSION || err.code === GSErrors.code.SESSION_TOKEN_EXPIRED) { @@ -1450,7 +1449,6 @@ StateRenewing.prototype.enter = function () { 'REQUEST_TYPE': 'RENEW', 'oldSessionToken': this.tokenInfo.getSessionToken(), }, - includeGuid: true, scope: this, callback: function (err, body) { // if the request succeeded