Skip to content

Add CLI commands usage to telemetry #6476

@nicholaspcr

Description

@nicholaspcr

Summary

Add command usage to the telemetry data collected.

Example of how the new message would look like:

{
  "message": {
    "uid": "...",
    "os": {
      "operating_system": "linux",
      "arch": "amd64",
      "binary_version": "3.27.0-dev",
      "golang_version": " go1.20.7"
    },
    "cli": {
      "feature_usage": {
        "login": 10,
        "application.create": 55
      }
    },
  }
}

Current Situation

We currently send an empty telemetry message from the CLI.

Why do we need this? Who uses it, and when?

By having the data on what commands are most frequently used we can have a better idea of how our customers use the CLI.

Proposed Implementation

Add to the root command's PostRun a function that increments a counter based on the full name of the command, for example root.application.create. The counter would be saved on the $CACHE_PATH/ttn-lw-cli/telemetry.yml and the information would be send alongside the already existent telemetry message.

The following is the list of items that need to be done if using this approach:

  • PostRun command counter
  • Add counter to the TelemetryMessage'CLI field
  • Modify lambda to store new information
    • Add timestream table for Console data. Modify the .tf file
    • Add logic to lambda to take information in the telemetry message and
      store in the database
  • Update grafana dashboard to show Console's information

Contributing

  • I can help by doing more research.
  • I can help by implementing the feature after the proposal above is approved.
  • I can help by testing the feature before it's released.

Code of Conduct

Metadata

Metadata

Assignees

Labels

goPull requests that update Go codetechnical debtNot necessarily broken, but could be done better/cleanerui/cliThis is related to ttn-lw-cli

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions