Skip to content

Commit 8e28fa7

Browse files
committed
Integrates ConfigCat SDK for feature flag management and telemetry updates
(#5092, gitkraken/vscode-gitlens-private#78)
1 parent a85622c commit 8e28fa7

11 files changed

Lines changed: 334 additions & 45 deletions

File tree

ThirdPartyNotices.txt

Lines changed: 71 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,77 @@ GitLens
33
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
44
This project incorporates components from the projects listed below.
55

6-
1. @eamodio/supertalk-core version 0.0.6 (https://github.com/eamodio/supertalk)
7-
2. @eamodio/supertalk-signals version 0.0.6 (https://github.com/eamodio/supertalk)
8-
3. @eamodio/supertalk version 0.0.7 (https://github.com/eamodio/supertalk)
9-
4. @gitlens/ai version 0.0.1 (undefined)
10-
5. @gitlens/git-cli version 0.0.1 (undefined)
11-
6. @gitlens/git-github version 0.0.1 (undefined)
12-
7. @gitlens/git version 0.0.1 (undefined)
13-
8. @lit-labs/signals version 0.2.0 (https://github.com/lit/lit)
14-
9. @lit-labs/virtualizer version 2.1.1 (https://github.com/lit/lit)
15-
10. @lit/context version 1.1.6 (https://github.com/lit/lit)
16-
11. @lit/react version 1.0.8 (https://github.com/lit/lit)
17-
12. @lit/task version 1.0.3 (https://github.com/lit/lit)
18-
13. @octokit/graphql version 9.0.3 (https://github.com/octokit/graphql.js)
19-
14. @octokit/request-error version 7.1.0 (https://github.com/octokit/request-error.js)
20-
15. @octokit/request version 10.0.8 (https://github.com/octokit/request.js)
21-
16. @octokit/types version 16.0.0 (https://github.com/octokit/types.ts)
22-
17. @opentelemetry/api version 1.9.0 (https://github.com/open-telemetry/opentelemetry-js)
23-
18. @opentelemetry/exporter-trace-otlp-http version 0.213.0 (https://github.com/open-telemetry/opentelemetry-js)
24-
19. @opentelemetry/resources version 2.6.0 (https://github.com/open-telemetry/opentelemetry-js)
25-
20. @opentelemetry/sdk-trace-base version 2.6.0 (https://github.com/open-telemetry/opentelemetry-js)
26-
21. @opentelemetry/semantic-conventions version 1.40.0 (https://github.com/open-telemetry/opentelemetry-js)
27-
22. @shoelace-style/shoelace version 2.20.1 (https://github.com/shoelace-style/shoelace)
28-
23. @vscode/codicons version 0.0.45 (https://github.com/microsoft/vscode-codicons)
29-
24. billboard.js version 3.18.0 (https://github.com/naver/billboard.js)
30-
25. diff2html version 3.4.56 (https://github.com/rtfpessoa/diff2html)
31-
26. dragula version 3.7.3 (https://github.com/bevacqua/dragula)
32-
27. driver.js version 1.4.0 (https://github.com/kamranahmedse/driver.js)
33-
28. fflate version 0.8.2 (https://github.com/101arrowz/fflate)
34-
29. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
35-
30. ignore version 7.0.5 (https://github.com/kaelzhang/node-ignore)
36-
31. lit version 3.3.2 (https://github.com/lit/lit)
37-
32. marked version 17.0.5 (https://github.com/markedjs/marked)
38-
33. microsoft/vscode (https://github.com/microsoft/vscode)
39-
34. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
40-
35. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)
41-
36. path-browserify version 1.0.1 (https://github.com/browserify/path-browserify)
42-
37. react-dom version 19.2.4 (https://github.com/facebook/react)
43-
38. react version 19.2.4 (https://github.com/facebook/react)
44-
39. signal-polyfill version 0.2.2 (https://github.com/proposal-signals/signal-polyfill)
45-
40. signal-utils version 0.21.1 (https://github.com/proposal-signals/signal-utils)
46-
41. slug version 11.0.1 (https://github.com/Trott/slug)
47-
42. sortablejs version 1.15.7 (https://github.com/SortableJS/Sortable)
48-
43. vscode-uri version 3.1.0 (https://github.com/microsoft/vscode-uri)
6+
1. @configcat/sdk version 1.0.2 (https://github.com/configcat/js-unified-sdk)
7+
2. @eamodio/supertalk-core version 0.0.6 (https://github.com/eamodio/supertalk)
8+
3. @eamodio/supertalk-signals version 0.0.6 (https://github.com/eamodio/supertalk)
9+
4. @eamodio/supertalk version 0.0.7 (https://github.com/eamodio/supertalk)
10+
5. @gitlens/ai version 0.0.1 (undefined)
11+
6. @gitlens/git-cli version 0.0.1 (undefined)
12+
7. @gitlens/git-github version 0.0.1 (undefined)
13+
8. @gitlens/git version 0.0.1 (undefined)
14+
9. @lit-labs/signals version 0.2.0 (https://github.com/lit/lit)
15+
10. @lit-labs/virtualizer version 2.1.1 (https://github.com/lit/lit)
16+
11. @lit/context version 1.1.6 (https://github.com/lit/lit)
17+
12. @lit/react version 1.0.8 (https://github.com/lit/lit)
18+
13. @lit/task version 1.0.3 (https://github.com/lit/lit)
19+
14. @octokit/graphql version 9.0.3 (https://github.com/octokit/graphql.js)
20+
15. @octokit/request-error version 7.1.0 (https://github.com/octokit/request-error.js)
21+
16. @octokit/request version 10.0.8 (https://github.com/octokit/request.js)
22+
17. @octokit/types version 16.0.0 (https://github.com/octokit/types.ts)
23+
18. @opentelemetry/api version 1.9.0 (https://github.com/open-telemetry/opentelemetry-js)
24+
19. @opentelemetry/exporter-trace-otlp-http version 0.213.0 (https://github.com/open-telemetry/opentelemetry-js)
25+
20. @opentelemetry/resources version 2.6.0 (https://github.com/open-telemetry/opentelemetry-js)
26+
21. @opentelemetry/sdk-trace-base version 2.6.0 (https://github.com/open-telemetry/opentelemetry-js)
27+
22. @opentelemetry/semantic-conventions version 1.40.0 (https://github.com/open-telemetry/opentelemetry-js)
28+
23. @shoelace-style/shoelace version 2.20.1 (https://github.com/shoelace-style/shoelace)
29+
24. @vscode/codicons version 0.0.45 (https://github.com/microsoft/vscode-codicons)
30+
25. billboard.js version 3.18.0 (https://github.com/naver/billboard.js)
31+
26. diff2html version 3.4.56 (https://github.com/rtfpessoa/diff2html)
32+
27. dragula version 3.7.3 (https://github.com/bevacqua/dragula)
33+
28. driver.js version 1.4.0 (https://github.com/kamranahmedse/driver.js)
34+
29. fflate version 0.8.2 (https://github.com/101arrowz/fflate)
35+
30. https-proxy-agent version 5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
36+
31. ignore version 7.0.5 (https://github.com/kaelzhang/node-ignore)
37+
32. lit version 3.3.2 (https://github.com/lit/lit)
38+
33. marked version 17.0.5 (https://github.com/markedjs/marked)
39+
34. microsoft/vscode (https://github.com/microsoft/vscode)
40+
35. node-fetch version 2.7.0 (https://github.com/bitinn/node-fetch)
41+
36. os-browserify version 0.3.0 (https://github.com/CoderPuppy/os-browserify)
42+
37. path-browserify version 1.0.1 (https://github.com/browserify/path-browserify)
43+
38. react-dom version 19.2.4 (https://github.com/facebook/react)
44+
39. react version 19.2.4 (https://github.com/facebook/react)
45+
40. signal-polyfill version 0.2.2 (https://github.com/proposal-signals/signal-polyfill)
46+
41. signal-utils version 0.21.1 (https://github.com/proposal-signals/signal-utils)
47+
42. slug version 11.0.1 (https://github.com/Trott/slug)
48+
43. sortablejs version 1.15.7 (https://github.com/SortableJS/Sortable)
49+
44. vscode-uri version 3.1.0 (https://github.com/microsoft/vscode-uri)
50+
51+
%% @configcat/sdk NOTICES AND INFORMATION BEGIN HERE
52+
=========================================
53+
MIT License
54+
55+
Copyright (c) 2025 ConfigCat
56+
57+
Permission is hereby granted, free of charge, to any person obtaining a copy
58+
of this software and associated documentation files (the "Software"), to deal
59+
in the Software without restriction, including without limitation the rights
60+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61+
copies of the Software, and to permit persons to whom the Software is
62+
furnished to do so, subject to the following conditions:
63+
64+
The above copyright notice and this permission notice shall be included in all
65+
copies or substantial portions of the Software.
66+
67+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73+
SOFTWARE.
74+
75+
=========================================
76+
END OF @configcat/sdk NOTICES AND INFORMATION
4977

5078
%% @eamodio/supertalk-core NOTICES AND INFORMATION BEGIN HERE
5179
=========================================

docs/telemetry-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// Cohort number between 1 and 100 to use for percentage-based rollouts
3333
'global.device.cohort': number,
3434
'global.enabled': boolean,
35+
'global.featureFlags': string,
3536
'global.folders.count': number,
3637
'global.folders.schemes': string,
3738
'global.gk.mcp.registrationCompleted': boolean,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27404,6 +27404,7 @@
2740427404
"@eamodio/supertalk": "0.0.7",
2740527405
"@eamodio/supertalk-core": "0.0.6",
2740627406
"@eamodio/supertalk-signals": "0.0.6",
27407+
"@configcat/sdk": "^1.0.2",
2740727408
"@gitkraken/gitkraken-components": "13.0.0-vnext.27",
2740827409
"@gitkraken/provider-apis": "0.40.0",
2740927410
"@gitlens/ai": "workspace:*",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/constants.telemetry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface TelemetryGlobalContext extends SubscriptionEventData {
3636
/** Cohort number between 1 and 100 to use for percentage-based rollouts */
3737
'device.cohort': number;
3838
enabled: boolean;
39+
featureFlags: string;
3940
prerelease: boolean;
4041
install: boolean;
4142
upgrade: boolean;

src/container.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type { GlCommands } from './constants.commands.js';
2424
import { extensionPrefix } from './constants.js';
2525
import { MarkdownContentProvider } from './documents/markdown.js';
2626
import { EventBus } from './eventBus.js';
27+
import type { FeatureFlagService } from './featureFlags/featureFlagService.js';
2728
import { GitFileSystemProvider } from './git/fsProvider.js';
2829
import { GitProviderService } from './git/gitProviderService.js';
2930
import type { RepositoryLocationProvider } from './git/location/repositorylocationProvider.js';
@@ -435,6 +436,28 @@ export class Container {
435436
return this._cloudIntegrations;
436437
}
437438

439+
private _featureFlags: Promise<FeatureFlagService | undefined> | undefined;
440+
get featureFlags(): Promise<FeatureFlagService | undefined> {
441+
if (this._featureFlags == null) {
442+
async function load(this: Container) {
443+
try {
444+
const featureFlags = new (
445+
await import(/* webpackChunkName: "feature-flags" */ './featureFlags/featureFlagService.js')
446+
).ConfigCatFeatureFlagService(this);
447+
this._disposables.push(featureFlags);
448+
return featureFlags;
449+
} catch (ex) {
450+
Logger.error(ex);
451+
return undefined;
452+
}
453+
}
454+
455+
this._featureFlags = load.call(this);
456+
}
457+
458+
return this._featureFlags;
459+
}
460+
438461
private _drafts: DraftService | undefined;
439462
get drafts(): DraftService {
440463
if (this._drafts == null) {

src/extension.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export async function activate(context: ExtensionContext): Promise<GitLensApi |
255255
upgrade: previousVersion != null && gitlensVersion !== previousVersion,
256256
upgradedFrom: previousVersion != null && gitlensVersion !== previousVersion ? previousVersion : undefined,
257257
});
258+
await setFeatureFlagTelemetryGlobalAttributes(container);
258259

259260
const api = new Api(container);
260261
const mode = container.mode;
@@ -306,6 +307,23 @@ function setKeysForSync(context: ExtensionContext, ...keys: (SyncedStorageKeys |
306307
context.globalState?.setKeysForSync([...keys, SyncedStorageKeys.Version, SyncedStorageKeys.PreReleaseVersion]);
307308
}
308309

310+
async function setFeatureFlagTelemetryGlobalAttributes(container: Container): Promise<void> {
311+
try {
312+
const featureFlags = await container.featureFlags;
313+
if (featureFlags == null) return;
314+
315+
const flags = await featureFlags.getAllFlags();
316+
if (Object.keys(flags).length === 0) return;
317+
318+
container.telemetry.setGlobalAttribute(
319+
'featureFlags',
320+
JSON.stringify(Object.fromEntries(Object.entries(flags).sort(([a], [b]) => a.localeCompare(b)))),
321+
);
322+
} catch (ex) {
323+
Logger.error(ex, 'setFeatureFlagTelemetryGlobalAttributes');
324+
}
325+
}
326+
309327
function registerBuiltInActionRunners(container: Container): void {
310328
container.context.subscriptions.push(
311329
container.actionRunners.registerBuiltIn<CreatePullRequestActionContext>('createPullRequest', {

0 commit comments

Comments
 (0)