Skip to content

Commit d49adb0

Browse files
authored
Merge pull request #6006 from Countly/sc-sdk-changes
[sdk] Added Server Config options
2 parents 67d4802 + 29bfd7d commit d49adb0

File tree

5 files changed

+101
-69
lines changed

5 files changed

+101
-69
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Features:
33
- [alerts] alerts table default order should be by creation time newest at the top
44
- [core] allow tracking Countly dashboard usage with Countly
5+
- [sdk] Improved and added new Server Config options
56

67
Enterprise Features:
78
- [journey_engine] Editing/Deleting/Duplication of blocks and version management

plugins/sdk/frontend/public/javascripts/countly.views.js

+78-53
Original file line numberDiff line numberDiff line change
@@ -72,159 +72,167 @@
7272
return {
7373
groups: {
7474
global: {
75-
label: "SDK control",
75+
label: "Global Controls",
7676
list: ["tracking", "networking"]
7777
},
7878
features: {
79-
label: "SDK features",
80-
list: ["crt", "vt", "st", "cet", "ecz", "cr", "log"]
79+
label: "SDK Features",
80+
list: ["crt", "vt", "st", "cet", "ecz", "cr"]
8181
},
8282
settings: {
83-
label: "SDK settings",
84-
list: ["sui", "eqs", "rqs", "ebs", "czi", "dort"]
83+
label: "SDK Settings",
84+
list: ["sui", "eqs", "rqs", "czi", "dort", "scui"]
8585
},
8686
limits: {
8787
label: "SDK Limits",
88-
list: ["lkl", "lvs", "lsv", "lbc"]
88+
list: ["lkl", "lvs", "lsv", "lbc", "ltlpt", "ltl"]
8989
},
9090
},
9191
configs: {
9292
tracking: {
9393
type: "switch",
94-
name: "SDK Tracking",
95-
description: "Enable or disable tracking any data in the SDK. If disabled, tracking new data will stop, but already collected data will be sent as long as networking is enabled",
94+
name: "Allow Tracking",
95+
description: "Enable or disable any tracking (gathering) of data in the SDK (default: enabled)",
9696
default: true,
9797
value: null
9898
},
9999
networking: {
100100
type: "switch",
101-
name: "SDK Networking",
102-
description: "Enable or disable networking calls within SDK. If disabled no network requests will come from SDK (except SDK config call), but data would still be recorded and preserved on device up to the SDK limits",
101+
name: "Allow Networking",
102+
description: "Enable or disable all networking calls from SDK except SDK config call. Does not effect tracking of data (default: enabled)",
103103
default: true,
104104
value: null
105105
},
106106
crt: {
107107
type: "switch",
108-
name: "Crashes",
109-
description: "Enable or disable automatic tracking of unhandled crashes",
108+
name: "Allow Crash Tracking",
109+
description: "Enable or disable tracking of crashes (default: enabled)",
110110
default: true,
111111
value: null
112112
},
113113
vt: {
114114
type: "switch",
115-
name: "Views",
116-
description: "Enable or disable automatic tracking of views",
115+
name: "Allow View Tracking",
116+
description: "Enable or disable tracking of views (default: enabled)",
117117
default: true,
118118
value: null
119119
},
120120
st: {
121121
type: "switch",
122-
name: "Session Tracking",
123-
description: "Enable or disable automatic session tracking",
122+
name: "Allow Session Tracking",
123+
description: "Enable or disable tracking of sessions (default: enabled)",
124124
default: true,
125125
value: null
126126
},
127127
sui: {
128128
type: "number",
129129
name: "Session Update Interval",
130-
description: "How often to send heartbeat to server in seconds",
130+
description: "How often to send session update information to server in seconds (default: 60)",
131131
default: 60,
132132
value: null
133133
},
134134
cet: {
135135
type: "switch",
136-
name: "Custom Event Tracking",
137-
description: "Track custom events",
136+
name: "Allow Custom Event Tracking",
137+
description: "Enable or disable tracking of custom events (default: enabled)",
138138
default: true,
139139
value: null
140140
},
141141
ecz: {
142142
type: "switch",
143-
name: "Content Zone",
144-
description: "Display content from Countly",
145-
default: true,
143+
name: "Enable Content Zone",
144+
description: "Enable or disable listening to Journey related contents (default: false)",
145+
default: false,
146146
value: null
147147
},
148148
cr: {
149149
type: "switch",
150-
name: "Consent Requests",
151-
description: "Ask for consents",
152-
default: true,
150+
name: "Require Consent",
151+
description: "Enable or disable requiring consent for tracking (default: false)",
152+
default: false,
153153
value: null
154154
},
155155
rqs: {
156156
type: "number",
157157
name: "Request Queue Size",
158-
description: "How many requests to store in queue, if SDK cannot connect to server",
158+
description: "How many requests to store in queue, if SDK cannot connect to server (default: 1000)",
159159
default: 1000,
160160
value: null
161161
},
162162
eqs: {
163163
type: "number",
164164
name: "Event Queue Size",
165-
description: "How many events to store in queue before they would be batched and sent to server",
166-
default: 10,
167-
value: null
168-
},
169-
ebs: {
170-
type: "number",
171-
name: "Event Batch Size",
172-
description: "How many events to store in queue before they would be batched and sent to server",
173-
default: 10,
165+
description: "How many events to store in queue before they would be batched and sent to server (default: 100)",
166+
default: 100,
174167
value: null
175168
},
176169
czi: {
177170
type: "number",
178171
name: "Content Zone Interval",
179-
description: "How often to check for new content",
172+
description: "How often to check for new Journey content in seconds (default: 30, min: 15)",
180173
default: 30,
181174
value: null
182175
},
183176
dort: {
184177
type: "number",
185-
name: "Drop old requests",
186-
description: "Provide time in seconds after which requests should be dropped if they are not sent to server",
178+
name: "Request Drop Age",
179+
description: "Provide time in hours after which an old request should be dropped if they are not sent to server (default: 0 = not enabled)",
187180
default: 0,
188181
value: null
189182
},
190183
lkl: {
191184
type: "number",
192-
name: "Limit Key Length",
193-
description: "Maximum length of event key",
194-
default: 256,
185+
name: "Max Key Length",
186+
description: "Maximum length of an Event's key (including name) (default: 128)",
187+
default: 128,
195188
value: null
196189
},
197190
lvs: {
198191
type: "number",
199-
name: "Limit Value Size",
200-
description: "Maximum value size of event segment",
192+
name: "Max Value Size",
193+
description: "Maximum length of an Event's segment value (default: 256)",
201194
default: 256,
202195
value: null
203196
},
204197
lsv: {
205198
type: "number",
206-
name: "Limit Number of Segments",
207-
description: "Maximum segments of event",
199+
name: "Max Number of Segments",
200+
description: "Maximum amount of segmentation key/value pairs per Event (default: 100)",
208201
default: 100,
209202
value: null
210203
},
211204
lbc: {
212205
type: "number",
213-
name: "Limit Breadcrump",
214-
description: "Maximum breadcrump size",
206+
name: "Max Breadcrumb Count",
207+
description: "Maximum breadcrumb count that can be provided by the developer (default: 100)",
215208
default: 100,
216209
value: null
217210
},
218-
log: {
219-
type: "switch",
220-
name: "Logging",
221-
description: "Enable SDK logging",
222-
default: true,
211+
ltlpt: {
212+
type: "number",
213+
name: "Max Trace Line Per Thread",
214+
description: "Maximum stack trace lines that would be recorded per thread (default: 30)",
215+
default: 30,
216+
value: null
217+
},
218+
ltl: {
219+
type: "number",
220+
name: "Max Trace Length Per Line",
221+
description: "Maximum length of a stack trace line to be recorded (default: 200)",
222+
default: 200,
223+
value: null
224+
},
225+
scui: {
226+
type: "number",
227+
name: "Server Config Update Interval",
228+
description: "How often to check for new server config in hours (default: 4)",
229+
default: 4,
223230
value: null
224231
}
225232
},
226233
diff: [],
227-
description: "This is experimental feature and not all SDKs and SDK versions yet support it. Refer to the SDK documentation for more information"
234+
description: "This is experimental feature and not all SDKs and SDK versions yet support it. Refer to the SDK documentation for more information",
235+
downloadDescription: "Download the current SDK configuration as a JSON file to provide to the SDK",
228236
};
229237
},
230238
methods: {
@@ -246,6 +254,23 @@
246254
}
247255
}
248256
},
257+
downloadConfig: function() {
258+
var params = this.$store.getters["countlySDK/sdk/all"];
259+
var data = {};
260+
data.v = 1; // check sdk/api/api.js for version
261+
data.t = Date.now();
262+
data.c = params || {};
263+
var configData = JSON.stringify(data, null, 2);
264+
var blob = new Blob([configData], { type: 'application/json' });
265+
var url = URL.createObjectURL(blob);
266+
var a = document.createElement('a');
267+
a.href = url;
268+
a.download = 'sdk-config.json';
269+
document.body.appendChild(a);
270+
a.click();
271+
document.body.removeChild(a);
272+
URL.revokeObjectURL(url);
273+
},
249274
save: function() {
250275
var params = this.$store.getters["countlySDK/sdk/all"];
251276
var data = params || {};

plugins/sdk/frontend/public/templates/config.html

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<div v-bind:class="[componentId]" class="configurations">
22
<cly-header
33
title="SDK Configuration (Experimental)"
4-
:tooltip="{description}"
5-
>
4+
:tooltip="{description}">
5+
<template v-slot:header-right>
6+
<div class="bu-level-item">
7+
<el-button @click="downloadConfig" type="default" size="small" icon="cly-icon-btn cly-icon-download">
8+
Download Config
9+
</el-button>
10+
</div>
11+
</template>
612
</cly-header>
713
<cly-main>
814
<div v-if="!isTableLoading" class="bu-columns bu-is-gapless">
@@ -114,4 +120,4 @@ <h3 v-if="group.label" class="bu-mb-4" data-test-id="sdk-control-label">
114120
</div>
115121
<cly-diff-helper :diff="diff" @discard="unpatch" @save="save"></cly-diff-helper>
116122
</cly-main>
117-
</div>
123+
</div>

ui-tests/cypress/lib/dashboard/manage/sdk/configurations.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ const verifyStaticElementsOfPage = () => {
3030

3131
cy.verifyElement({
3232
labelElement: sdkConfiguratonsPageElements.SDK_CONTROL_LABEL,
33-
labelText: "SDK control",
33+
labelText: "Global Controls",
3434
});
3535

3636
cy.verifyElement({
3737
labelElement: sdkConfiguratonsPageElements.SDK_TRACKING_LABEL,
38-
labelText: "SDK Tracking",
38+
labelText: "Allow Tracking",
3939
});
4040

4141
cy.verifyElement({
4242
labelElement: sdkConfiguratonsPageElements.SDK_TRACKING_DESCRIPTION,
43-
labelText: "Enable or disable tracking any data in the SDK. If disabled, tracking new data will stop, but already collected data will be sent as long as networking is enabled",
43+
labelText: "Enable or disable any tracking (gathering) of data in the SDK (default: enabled)",
4444
});
4545

4646
cy.verifyElement({
4747
labelElement: sdkConfiguratonsPageElements.SDK_NETWORKING_LABEL,
48-
labelText: "SDK Networking",
48+
labelText: "Allow Networking",
4949
});
5050

5151
cy.verifyElement({
5252
labelElement: sdkConfiguratonsPageElements.SDK_NETWORKING_DESCRIPTION,
53-
labelText: "Enable or disable networking calls within SDK. If disabled no network requests will come from SDK (except SDK config call), but data would still be recorded and preserved on device up to the SDK limits",
53+
labelText: "Enable or disable all networking calls from SDK except SDK config call. Does not effect tracking of data (default: enabled)",
5454
});
5555
};
5656

@@ -98,4 +98,4 @@ module.exports = {
9898
clickRequestStatsTab,
9999
clickHealthCheckTab,
100100
clickSdkConfigurationTab
101-
};
101+
};

ui-tests/cypress/support/elements/dashboard/manage/sdk/configurations.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ export default {
44

55
SDK_CONTROL_LABEL: 'sdk-control-label',
66

7-
SDK_TRACKING_LABEL: 'sdk-tracking-title-label',
8-
SDK_TRACKING_DESCRIPTION: 'sdk-tracking-description-label',
9-
SDK_TRACKING_SWITCH: 'sdk-tracking-el-switch-wrapper',
7+
SDK_TRACKING_LABEL: 'allow-tracking-title-label',
8+
SDK_TRACKING_DESCRIPTION: 'allow-tracking-description-label',
9+
SDK_TRACKING_SWITCH: 'allow-tracking-el-switch-wrapper',
1010

11-
SDK_NETWORKING_LABEL: 'sdk-networking-title-label',
12-
SDK_NETWORKING_DESCRIPTION: 'sdk-networking-description-label',
13-
SDK_NETWORKINF_SWITCH: 'sdk-networking-el-switch-wrapper',
11+
SDK_NETWORKING_LABEL: 'allow-networking-title-label',
12+
SDK_NETWORKING_DESCRIPTION: 'allow-networking-description-label',
13+
SDK_NETWORKINF_SWITCH: 'allow-networking-el-switch-wrapper',
1414

1515
TAB_SDK_STATS: 'tab-sdk-stats-title',
1616
TAB_REQUEST_STATS: 'tab-request-stats-title',
1717
TAB_HEALTH_CHECK: 'tab-health-check-title',
1818
TAB_SDK_CONFIGURATION: 'tab-sdk-configuration-title'
19-
};
19+
};

0 commit comments

Comments
 (0)