Skip to content

Commit

Permalink
chore: send telemetry on startup (#359)
Browse files Browse the repository at this point in the history
* chore: send telemetry on startup

I noticed that AI lab is doing this - send the extension version in on startup
so that we can see which version users have installed. This should also be in
the PD telemetry, but easier to track/correlate here.

Signed-off-by: Tim deBoer <[email protected]>

* chore: remove version

Remove version, since Podman Desktop already adds common.extensionVersion.

Signed-off-by: Tim deBoer <[email protected]>

---------

Signed-off-by: Tim deBoer <[email protected]>
  • Loading branch information
deboer-tim authored Apr 22, 2024
1 parent 8121e85 commit a2ed2c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/backend/src/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import os from 'node:os';
const originalConsoleLog = console.log;

const mocks = vi.hoisted(() => ({
logUsageMock: vi.fn(),
logErrorMock: vi.fn(),
consoleLogMock: vi.fn(),
consoleWarnMock: vi.fn(),
Expand All @@ -42,7 +43,7 @@ vi.mock('@podman-desktop/api', async () => {
version: '1.8.0',
env: {
createTelemetryLogger: () => ({
logUsage: vi.fn(),
logUsage: mocks.logUsageMock,
logError: mocks.logErrorMock,
}),
},
Expand Down Expand Up @@ -106,6 +107,7 @@ test('check activate', async () => {
await activate(fakeContext);

expect(mocks.consoleLogMock).toBeCalledWith('starting bootc extension');
expect(mocks.logUsageMock).toHaveBeenCalled();
});

describe('version checker', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export async function activate(extensionContext: ExtensionContext): Promise<void
);
}

telemetryLogger.logUsage('start');

const history = new History(extensionContext.storagePath);
await history.loadFile();

Expand Down

0 comments on commit a2ed2c7

Please sign in to comment.