Skip to content

Commit 54ba5da

Browse files
committed
fix: Request span for WebSocketTransport is incorrectly set
1 parent 3470b7f commit 54ba5da

File tree

12 files changed

+154
-67
lines changed

12 files changed

+154
-67
lines changed

packages/cubejs-api-gateway/SubscriptionServer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const uuid = require('uuid/v4');
12
const UserError = require('./UserError');
23

34
const methodParams = {
@@ -61,7 +62,8 @@ class SubscriptionServer {
6162
throw new UserError(`Unsupported method: ${message.method}`);
6263
}
6364

64-
const requestId = message.requestId || `${connectionId}-${message.messageId}`;
65+
const baseRequestId = message.requestId || `${connectionId}-${message.messageId}`;
66+
const requestId = `${baseRequestId}-span-${uuid()}`;
6567
context = await this.apiGateway.contextByReq(message, authContext.authInfo, requestId);
6668

6769
const allowedParams = methodParams[message.method];

packages/cubejs-api-gateway/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ class ApiGateway {
450450
// TODO subscribe to refreshKeys instead of constantly firing load
451451
await this.load({
452452
query,
453-
context: { ...context, requestId: `${context.requestId}-${uuid()}` },
453+
context,
454454
res: (message, opts) => {
455455
if (message.error) {
456456
error = { message, opts };

packages/cubejs-athena-driver/yarn.lock

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# yarn lockfile v1
33

44

5-
"@cubejs-backend/query-orchestrator@^0.17.9":
6-
version "0.17.9"
7-
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.17.9.tgz#5da93cc1a47712c1510d63a326a3615fa7c8aa4c"
8-
integrity sha512-8VMxSPOp5XQbn3xsB9ncYDPyWIntTbFGPveDO3iwiQQEn2dBQm3JhcbRysxyq01IgdKRyJcHt01tFqtQOIKGvA==
5+
"@cubejs-backend/query-orchestrator@^0.18.3":
6+
version "0.18.3"
7+
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.18.3.tgz#a05825432699ace9987457779d64f1bae3e7b196"
8+
integrity sha512-piqdLy2ni+x+B1WDydrM3FFWbS7Zc1ZkkaiRj9bHSPGyOaobuAnWZD/ps4/rRmgkE/57Dq9+I7lmkUQdbxDiJQ==
99
dependencies:
10-
ramda "^0.24.1"
10+
generic-pool "^3.7.1"
11+
ramda "^0.27.0"
1112
redis "^2.8.0"
1213

1314
aws-sdk@^2.403.0:
@@ -49,6 +50,11 @@ events@1.1.1:
4950
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
5051
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
5152

53+
generic-pool@^3.7.1:
54+
version "3.7.1"
55+
resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.7.1.tgz#36fe5bb83e7e0e032e5d32cd05dc00f5ff119aa8"
56+
integrity sha512-ug6DAZoNgWm6q5KhPFA+hzXfBLFQu5sTXxPpv44DmE0A2g+CiHoq9LTVdkXpZMkYVMoGw83F6W+WT0h0MFMK/w==
57+
5258
ieee754@1.1.8:
5359
version "1.1.8"
5460
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
@@ -79,10 +85,10 @@ querystring@0.2.0:
7985
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
8086
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
8187

82-
ramda@^0.24.1:
83-
version "0.24.1"
84-
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857"
85-
integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc=
88+
ramda@^0.27.0:
89+
version "0.27.0"
90+
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.0.tgz#915dc29865c0800bf3f69b8fd6c279898b59de43"
91+
integrity sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==
8692

8793
redis-commands@^1.2.0:
8894
version "1.4.0"

packages/cubejs-bigquery-driver/yarn.lock

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# yarn lockfile v1
33

44

5-
"@cubejs-backend/query-orchestrator@^0.17.10":
6-
version "0.17.10"
7-
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.17.10.tgz#44604f30acee7c65a4dde92af662aad605d195af"
8-
integrity sha512-hmNWfaFapKZPS4ePIYvjxMelUKd2KIPdLh0vikcdhVCj++M9+0fyFnEUvpoPdYjc8jciksVEfA7ehId0C6xE3Q==
5+
"@cubejs-backend/query-orchestrator@^0.18.3":
6+
version "0.18.3"
7+
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.18.3.tgz#a05825432699ace9987457779d64f1bae3e7b196"
8+
integrity sha512-piqdLy2ni+x+B1WDydrM3FFWbS7Zc1ZkkaiRj9bHSPGyOaobuAnWZD/ps4/rRmgkE/57Dq9+I7lmkUQdbxDiJQ==
99
dependencies:
10-
ramda "^0.24.1"
10+
generic-pool "^3.7.1"
11+
ramda "^0.27.0"
1112
redis "^2.8.0"
1213

1314
"@google-cloud/bigquery@^4.1.4":
@@ -252,6 +253,11 @@ gcp-metadata@^2.0.0:
252253
gaxios "^2.0.0"
253254
json-bigint "^0.3.0"
254255

256+
generic-pool@^3.7.1:
257+
version "3.7.1"
258+
resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.7.1.tgz#36fe5bb83e7e0e032e5d32cd05dc00f5ff119aa8"
259+
integrity sha512-ug6DAZoNgWm6q5KhPFA+hzXfBLFQu5sTXxPpv44DmE0A2g+CiHoq9LTVdkXpZMkYVMoGw83F6W+WT0h0MFMK/w==
260+
255261
google-auth-library@^4.0.0:
256262
version "4.2.5"
257263
resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-4.2.5.tgz#79b8ce6843525cb3a6e61cf97abef333d1386bd5"
@@ -381,11 +387,6 @@ process-nextick-args@~2.0.0:
381387
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
382388
integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==
383389

384-
ramda@^0.24.1:
385-
version "0.24.1"
386-
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857"
387-
integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc=
388-
389390
ramda@^0.27.0:
390391
version "0.27.0"
391392
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.0.tgz#915dc29865c0800bf3f69b8fd6c279898b59de43"

packages/cubejs-client-core/dist/cubejs-client-core.esm.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ var operators = {
723723
title: '<='
724724
}]
725725
};
726+
/**
727+
* Contains information about available cubes and it's members.
728+
*/
726729

727730
var Meta =
728731
/*#__PURE__*/
@@ -749,6 +752,24 @@ function () {
749752
return c[memberType];
750753
}));
751754
}
755+
/**
756+
* Get meta information for member of a cube
757+
* Member meta information contains:
758+
* ```javascript
759+
* {
760+
* name,
761+
* title,
762+
* shortTitle,
763+
* type,
764+
* description,
765+
* format
766+
* }
767+
* ```
768+
* @param memberName - Fully qualified member name in a form `Cube.memberName`
769+
* @param memberType - `measures`, `dimensions` or `segments`
770+
* @return {Object} containing meta information about member
771+
*/
772+
752773
}, {
753774
key: "resolveMember",
754775
value: function resolveMember(memberName, memberType) {
@@ -1465,7 +1486,7 @@ function () {
14651486
* @name cubejs
14661487
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
14671488
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
1468-
* Can be an async function without arguments that returns API token.
1489+
* Can be an async function without arguments that returns API token. Optional.
14691490
* @param options - options object.
14701491
* @param options.apiUrl - URL of your Cube.js Backend.
14711492
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.

packages/cubejs-client-core/dist/cubejs-client-core.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,9 @@ var operators = {
729729
title: '<='
730730
}]
731731
};
732+
/**
733+
* Contains information about available cubes and it's members.
734+
*/
732735

733736
var Meta =
734737
/*#__PURE__*/
@@ -755,6 +758,24 @@ function () {
755758
return c[memberType];
756759
}));
757760
}
761+
/**
762+
* Get meta information for member of a cube
763+
* Member meta information contains:
764+
* ```javascript
765+
* {
766+
* name,
767+
* title,
768+
* shortTitle,
769+
* type,
770+
* description,
771+
* format
772+
* }
773+
* ```
774+
* @param memberName - Fully qualified member name in a form `Cube.memberName`
775+
* @param memberType - `measures`, `dimensions` or `segments`
776+
* @return {Object} containing meta information about member
777+
*/
778+
758779
}, {
759780
key: "resolveMember",
760781
value: function resolveMember(memberName, memberType) {
@@ -1471,7 +1492,7 @@ function () {
14711492
* @name cubejs
14721493
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
14731494
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
1474-
* Can be an async function without arguments that returns API token.
1495+
* Can be an async function without arguments that returns API token. Optional.
14751496
* @param options - options object.
14761497
* @param options.apiUrl - URL of your Cube.js Backend.
14771498
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.

packages/cubejs-client-core/dist/cubejs-client-core.umd.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14244,6 +14244,9 @@
1424414244
title: '<='
1424514245
}]
1424614246
};
14247+
/**
14248+
* Contains information about available cubes and it's members.
14249+
*/
1424714250

1424814251
var Meta =
1424914252
/*#__PURE__*/
@@ -14270,6 +14273,24 @@
1427014273
return c[memberType];
1427114274
}));
1427214275
}
14276+
/**
14277+
* Get meta information for member of a cube
14278+
* Member meta information contains:
14279+
* ```javascript
14280+
* {
14281+
* name,
14282+
* title,
14283+
* shortTitle,
14284+
* type,
14285+
* description,
14286+
* format
14287+
* }
14288+
* ```
14289+
* @param memberName - Fully qualified member name in a form `Cube.memberName`
14290+
* @param memberType - `measures`, `dimensions` or `segments`
14291+
* @return {Object} containing meta information about member
14292+
*/
14293+
1427314294
}, {
1427414295
key: "resolveMember",
1427514296
value: function resolveMember(memberName, memberType) {
@@ -15916,7 +15937,7 @@
1591615937
* @name cubejs
1591715938
* @param apiToken - [API token](security) is used to authorize requests and determine SQL database you're accessing.
1591815939
* In the development mode, Cube.js Backend will print the API token to the console on on startup.
15919-
* Can be an async function without arguments that returns API token.
15940+
* Can be an async function without arguments that returns API token. Optional.
1592015941
* @param options - options object.
1592115942
* @param options.apiUrl - URL of your Cube.js Backend.
1592215943
* By default, in the development environment it is `http://localhost:4000/cubejs-api/v1`.

packages/cubejs-client-ws-transport/src/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class WebSocketTransport {
126126
request(method, { baseRequestId, ...params }) {
127127
const message = {
128128
messageId: this.messageCounter++,
129+
requestId: baseRequestId,
129130
method,
130131
params
131132
};
@@ -150,14 +151,9 @@ class WebSocketTransport {
150151

151152
const transport = this;
152153

153-
let spanCounter = 1;
154-
155154
return {
156155
async subscribe(callback) {
157-
transport.sendMessage({
158-
requestId: baseRequestId && `${baseRequestId}-span-${spanCounter++}`,
159-
...message
160-
});
156+
transport.sendMessage(message);
161157
const result = await new Promise((resolve) => {
162158
nextMessage = resolve;
163159
if (pendingResults.length) {

packages/cubejs-hive-driver/yarn.lock

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# yarn lockfile v1
33

44

5-
"@cubejs-backend/query-orchestrator@^0.17.10":
6-
version "0.17.10"
7-
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.17.10.tgz#44604f30acee7c65a4dde92af662aad605d195af"
8-
integrity sha512-hmNWfaFapKZPS4ePIYvjxMelUKd2KIPdLh0vikcdhVCj++M9+0fyFnEUvpoPdYjc8jciksVEfA7ehId0C6xE3Q==
5+
"@cubejs-backend/query-orchestrator@^0.18.3":
6+
version "0.18.3"
7+
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.18.3.tgz#a05825432699ace9987457779d64f1bae3e7b196"
8+
integrity sha512-piqdLy2ni+x+B1WDydrM3FFWbS7Zc1ZkkaiRj9bHSPGyOaobuAnWZD/ps4/rRmgkE/57Dq9+I7lmkUQdbxDiJQ==
99
dependencies:
10-
ramda "^0.24.1"
10+
generic-pool "^3.7.1"
11+
ramda "^0.27.0"
1112
redis "^2.8.0"
1213

1314
abbrev@1:
@@ -59,7 +60,7 @@ escape-string-regexp@~1.0.5:
5960
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
6061
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
6162

62-
generic-pool@^3.6.0:
63+
generic-pool@^3.6.0, generic-pool@^3.7.1:
6364
version "3.7.1"
6465
resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.7.1.tgz#36fe5bb83e7e0e032e5d32cd05dc00f5ff119aa8"
6566
integrity sha512-ug6DAZoNgWm6q5KhPFA+hzXfBLFQu5sTXxPpv44DmE0A2g+CiHoq9LTVdkXpZMkYVMoGw83F6W+WT0h0MFMK/w==
@@ -208,10 +209,10 @@ q@1.0.x:
208209
resolved "https://registry.yarnpkg.com/q/-/q-1.0.1.tgz#11872aeedee89268110b10a718448ffb10112a14"
209210
integrity sha1-EYcq7t7okmgRCxCnGESP+xARKhQ=
210211

211-
ramda@^0.24.1:
212-
version "0.24.1"
213-
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857"
214-
integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc=
212+
ramda@^0.27.0:
213+
version "0.27.0"
214+
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.0.tgz#915dc29865c0800bf3f69b8fd6c279898b59de43"
215+
integrity sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==
215216

216217
redis-commands@^1.2.0:
217218
version "1.5.0"

packages/cubejs-mongobi-driver/yarn.lock

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# yarn lockfile v1
33

44

5-
"@cubejs-backend/query-orchestrator@^0.17.10":
6-
version "0.17.10"
7-
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.17.10.tgz#44604f30acee7c65a4dde92af662aad605d195af"
8-
integrity sha512-hmNWfaFapKZPS4ePIYvjxMelUKd2KIPdLh0vikcdhVCj++M9+0fyFnEUvpoPdYjc8jciksVEfA7ehId0C6xE3Q==
5+
"@cubejs-backend/query-orchestrator@^0.18.3":
6+
version "0.18.3"
7+
resolved "https://registry.yarnpkg.com/@cubejs-backend/query-orchestrator/-/query-orchestrator-0.18.3.tgz#a05825432699ace9987457779d64f1bae3e7b196"
8+
integrity sha512-piqdLy2ni+x+B1WDydrM3FFWbS7Zc1ZkkaiRj9bHSPGyOaobuAnWZD/ps4/rRmgkE/57Dq9+I7lmkUQdbxDiJQ==
99
dependencies:
10-
ramda "^0.24.1"
10+
generic-pool "^3.7.1"
11+
ramda "^0.27.0"
1112
redis "^2.8.0"
1213

1314
ansicolors@~0.3.2:
@@ -50,6 +51,11 @@ generic-pool@^3.6.0:
5051
resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.6.0.tgz#34e3124d9af754c8bfee7c15906e7347dc543afc"
5152
integrity sha512-9tRjIJzgW+ZyYeFBhfLRUefnQwF+IFfEsUkdZB5o75/gb4OZWnYb4ZjPcZc1bl9ofhWCN2rGhXa0SQwF64jTLw==
5253

54+
generic-pool@^3.7.1:
55+
version "3.7.1"
56+
resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.7.1.tgz#36fe5bb83e7e0e032e5d32cd05dc00f5ff119aa8"
57+
integrity sha512-ug6DAZoNgWm6q5KhPFA+hzXfBLFQu5sTXxPpv44DmE0A2g+CiHoq9LTVdkXpZMkYVMoGw83F6W+WT0h0MFMK/w==
58+
5359
iconv-lite@^0.5.0:
5460
version "0.5.1"
5561
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.5.1.tgz#b2425d3c7b18f7219f2ca663d103bddb91718d64"
@@ -109,10 +115,10 @@ pseudomap@^1.0.2:
109115
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
110116
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=
111117

112-
ramda@^0.24.1:
113-
version "0.24.1"
114-
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857"
115-
integrity sha1-w7d1UZfzW43DUCIoJixMkd22uFc=
118+
ramda@^0.27.0:
119+
version "0.27.0"
120+
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.0.tgz#915dc29865c0800bf3f69b8fd6c279898b59de43"
121+
integrity sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==
116122

117123
redeyed@~2.1.0:
118124
version "2.1.1"

0 commit comments

Comments
 (0)