Changesets · Branches · Tags · Compare
| Changeset | 10d1431e9a2f108b48896c6ece74c49f438e76363f92e0c76a95a5d2c9264bc5 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-09-08 21:31 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-08 21:31 -07:00 |
| Parents | f64709e50f50, 3231c10ab9d1 |
2 files changed
modified extensions/cli/src/slashCommands.ts +4 −0
| @@ -11,6 +11,7 @@ | ||
| 11 | 11 | import { reloadService, SERVICE_NAMES, services } from "./services/index.js"; |
| 12 | 12 | import { getCurrentSession } from "./session.js"; |
| 13 | 13 | import { posthogService } from "./telemetry/posthogService.js"; |
| 14 | +import { telemetryService } from "./telemetry/telemetryService.js"; | |
| 14 | 15 | import { SlashCommandResult } from "./ui/hooks/useChat.types.js"; |
| 15 | 16 | |
| 16 | 17 | type CommandHandler = ( |
| @@ -198,6 +199,9 @@ | ||
| 198 | 199 | |
| 199 | 200 | const [command, ...args] = input.slice(1).split(" "); |
| 200 | 201 | |
| 202 | + telemetryService.recordSlashCommand(command); | |
| 203 | + posthogService.capture("useSlashCommand", { name: command }); | |
| 204 | + | |
| 201 | 205 | const handler = commandHandlers[command]; |
| 202 | 206 | if (handler) { |
| 203 | 207 | return await handler(args, assistant); |
modified extensions/cli/src/telemetry/telemetryService.ts +22 −0
| @@ -10,8 +10,10 @@ | ||
| 10 | 10 | } from "@opentelemetry/sdk-metrics"; |
| 11 | 11 | import { |
| 12 | 12 | SEMRESATTRS_DEPLOYMENT_ENVIRONMENT, |
| 13 | + SEMRESATTRS_HOST_NAME, | |
| 13 | 14 | SEMRESATTRS_OS_TYPE, |
| 14 | 15 | SEMRESATTRS_PROCESS_PID, |
| 16 | + SEMRESATTRS_SERVICE_INSTANCE_ID, | |
| 15 | 17 | SEMRESATTRS_SERVICE_NAME, |
| 16 | 18 | SEMRESATTRS_SERVICE_VERSION, |
| 17 | 19 | } from "@opentelemetry/semantic-conventions"; |
| @@ -52,6 +54,7 @@ | ||
| 52 | 54 | private mcpConnectionsGauge: any = null; |
| 53 | 55 | private startupTimeHistogram: any = null; |
| 54 | 56 | private responseTimeHistogram: any = null; |
| 57 | + private slashCommandCounter: any = null; | |
| 55 | 58 | |
| 56 | 59 | constructor() { |
| 57 | 60 | this.config = this.loadConfig(); |
| @@ -88,6 +91,8 @@ | ||
| 88 | 91 | const resource = resourceFromAttributes({ |
| 89 | 92 | [SEMRESATTRS_SERVICE_NAME]: "continue-cli", |
| 90 | 93 | [SEMRESATTRS_SERVICE_VERSION]: getVersion(), |
| 94 | + [SEMRESATTRS_SERVICE_INSTANCE_ID]: uuidv4(), | |
| 95 | + [SEMRESATTRS_HOST_NAME]: os.hostname(), | |
| 91 | 96 | [SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: |
| 92 | 97 | process.env.NODE_ENV || "development", |
| 93 | 98 | [SEMRESATTRS_OS_TYPE]: os.type(), |
| @@ -281,6 +286,14 @@ | ||
| 281 | 286 | unit: "ms", |
| 282 | 287 | }, |
| 283 | 288 | ); |
| 289 | + | |
| 290 | + this.slashCommandCounter = this.meter.createCounter( | |
| 291 | + "continue_cli_slash_command_usage", | |
| 292 | + { | |
| 293 | + description: "Count of slash commands used", | |
| 294 | + unit: "count", | |
| 295 | + }, | |
| 296 | + ); | |
| 284 | 297 | } |
| 285 | 298 | |
| 286 | 299 | // Check if telemetry is enabled - this is the single point of checking |
| @@ -567,6 +580,15 @@ | ||
| 567 | 580 | return this.config.sessionId; |
| 568 | 581 | } |
| 569 | 582 | |
| 583 | + public recordSlashCommand(commandName: string) { | |
| 584 | + if (!this.isEnabled()) return; | |
| 585 | + | |
| 586 | + this.slashCommandCounter.add( | |
| 587 | + 1, | |
| 588 | + this.getStandardAttributes({ command: commandName }), | |
| 589 | + ); | |
| 590 | + } | |
| 591 | + | |
| 570 | 592 | /** |
| 571 | 593 | * Shutdown telemetry service and ensure all metrics are flushed |
| 572 | 594 | */ |