Skip to content

Commit 7dcda3f

Browse files
author
colinmcneil
committed
Implement simple telemetry (no additional context beyond event type)
- prompt run - prompt finished - new prompt added - new local prompt added
1 parent 3ce7090 commit 7dcda3f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/extension/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LABEL org.opencontainers.image.title="Labs: AI Tools for Devs" \
2727
org.opencontainers.image.description="Agentic workflows with Dockerized tools" \
2828
org.opencontainers.image.vendor="Docker Inc" \
2929
com.docker.desktop.extension.api.version="0.3.4" \
30-
com.docker.extension.screenshots='[{"alt":"screenshot of the extension UI", "url":"https://raw.githubusercontent.com/docker/labs-ai-tools-for-devs/main/src/extension/Screenshot1.png"}, {"alt":"screenshot of the extension output", "url":"https://raw.githubusercontent.com/docker/labs-ai-tools-for-devs/main/src/extension/screenshot2.png"}]' \
30+
com.docker.extension.screenshots='[{"alt":"screenshot of the extension UI", "url":"https://raw.githubusercontent.com/docker/labs-ai-tools-for-devs/main/src/extension/Screenshot1.png"}, {"alt":"screenshot of the extension output", "url":"https://raw.githubusercontent.com/docker/labs-ai-tools-for-devs/main/src/extension/Screenshot2.png"}]' \
3131
com.docker.desktop.extension.icon="https://raw.githubusercontent.com/docker/labs-ai-tools-for-devs/main/src/extension/docker.svg" \
3232
com.docker.extension.detailed-description="Run AI-powered workflows with Dockerized tools in Docker Desktop." \
3333
com.docker.extension.publisher-url="https://www.docker.com/" \

src/extension/ui/src/App.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ type RPCMessage = {
1818
// If you're running this React app in a browser, it won't work properly.
1919
const client = createDockerDesktopClient();
2020

21+
const track = (event: string) =>
22+
client.extension.vm?.service?.post('/analytics/track', { event });
23+
2124
const debounce = (fn: Function, ms: number) => {
2225
let timeout: NodeJS.Timeout;
2326
return function (...args: any) {
@@ -97,6 +100,7 @@ export function App() {
97100
const delim = client.host.platform === 'win32' ? '\\' : '/';
98101

99102
const startPrompt = async () => {
103+
track('start-prompt');
100104
let output: RPCMessage[] = []
101105
const updateOutput = (line: RPCMessage) => {
102106
if (line.method === 'functions') {
@@ -182,6 +186,7 @@ export function App() {
182186
},
183187
}
184188
});
189+
track('end-prompt');
185190
}
186191

187192
return (
@@ -249,6 +254,7 @@ export function App() {
249254
<Button onClick={() => {
250255
setPrompts([...prompts, promptInput]);
251256
setPromptInput('');
257+
track('add-prompt');
252258
}}>Add prompt</Button>
253259
)}
254260
<Button onClick={() => {
@@ -258,6 +264,7 @@ export function App() {
258264
if (result.canceled) {
259265
return;
260266
}
267+
track('add-local-prompt');
261268
setPrompts([...prompts, ...result.filePaths.map(p => `local://${p}`)]);
262269
});
263270
}}>Add local prompt</Button>

0 commit comments

Comments
 (0)