Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit ea74d73

Browse files
committed
debug tracking
1 parent e6b6fa0 commit ea74d73

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

api_server/config/dev-secrets.json

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"STORAGE_MONGO_URL",
4848
"TELEMETRY_SEGMENT_TOKEN",
4949
"TELEMETRY_SEGMENT_WEB_TOKEN",
50+
"TELEMETRY_ENDPOINT",
5051
"UNIVERSAL_SECRETS_TELEMETRY",
5152
"UNIVERSAL_SECRETS_TELEMETRY",
5253
"SHARED_SECRETS_COMMENT_ENGINE",

api_server/modules/analytics/analytics_client.js

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class AnalyticsClient {
5959
}
6060

6161
//this.segment.track(trackData);
62+
if (options.request) {
63+
options.request.log('TRACKING TO ' + this.config.telemetryEndpoint + '/events');
64+
options.request.log('trackData:', JSON.stringify(trackData));
65+
}
6266
Fetch(
6367
this.config.telemetryEndpoint + '/events',
6468
{

api_server/modules/apiweb/web_track_request.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
const RestfulRequest = require(process.env.CSSVC_BACKEND_ROOT + '/api_server/lib/util/restful/restful_request.js');
44

55
const ALLOWED_EVENTS = [
6-
'codestream/ide_redirect displayed',
7-
'codestream/ide_redirect failed',
8-
'codestream/ide selected'
6+
'codestream/ide_redirect displayed',
7+
'codestream/ide_redirect failed',
8+
'codestream/ide selected'
99
];
1010

1111
class WebTrackRequest extends RestfulRequest {
@@ -24,23 +24,23 @@ class WebTrackRequest extends RestfulRequest {
2424
{
2525
required: {
2626
string: ['event'],
27-
object:['properties']
27+
object:['properties']
2828
},
2929
}
3030
);
3131

32-
const { event } = this.request.body;
33-
if (!ALLOWED_EVENTS.includes(event)) {
34-
throw this.errorHandler.error('invalidParameter', { info: 'not a valid event' });
35-
}
36-
}
32+
const { event } = this.request.body;
33+
if (!ALLOWED_EVENTS.includes(event)) {
34+
throw this.errorHandler.error('invalidParameter', { info: 'not a valid event' });
35+
}
36+
}
3737

3838
async process () {
3939
await this.requireAndAllow();
4040

41-
const { event, properties } = this.request.body;
42-
this.api.services.analytics.track(event, properties);
43-
}
41+
const { event, properties } = this.request.body;
42+
this.api.services.analytics.track(event, properties, { request: this });
43+
}
4444
}
4545

4646
module.exports = WebTrackRequest;

codestream-docker.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@
248248
"telemetry": {
249249
"segment": {
250250
"token": "${TELEMETRY_SEGMENT_TOKEN}",
251-
"webToken": "${TELEMETRY_SEGMENT_WEB_TOKEN}"
251+
"webToken": "${TELEMETRY_SEGMENT_WEB_TOKEN}",
252+
"telemetryEndpoint": "${TELEMETRY_ENDPOINT}"
252253
}
253254
},
254255
"universalSecrets": {

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ services:
6363
- INTEGRATIONS_TRELLO_CLOUD_APP_CLIENT_ID
6464
- TELEMETRY_SEGMENT_TOKEN
6565
- TELEMETRY_SEGMENT_WEB_TOKEN
66+
- TELEMETRY_ENDPOINT
67+
- TELEMETRY_
6668
- UNIVERSAL_SECRETS_TELEMETRY
6769
volumes:
6870
mongodata:

0 commit comments

Comments
 (0)