ubuntu-insights

module
v0.0.0-...-fc1008d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: GPL-3.0

README

Welcome to Ubuntu Insights

Code quality License Code coverage Go Report Card

This is the code repository for Ubuntu Insights, a transparent, user-friendly, open, platform-agnostic, and cross-application solution for reporting hardware information and other collected metrics.

Ubuntu Insights is designed to show you exactly what is being sent, and allow you to acknowledge and control your own data. The code in this repository is designed to mainly be invoked by a controlling application, but a command-line tool is also provided.

This is designed to be a full replacement for Ubuntu Report.

About

Ubuntu Insights caches all collected data locally, and will only attempt to upload insights reports following a minimum period (1 week by default). It checks for consent both at the time of collection and at the time of upload. If consent was not given at either of those two points, then the information is not sent to the server. Once a report has been uploaded, it is removed from the local cache folder, and the data that was sent is written to the uploaded folder.

By default, Ubuntu Insights will only collect once per collection period.

To execute the interactive command-line interface manually, use ubuntu-insights.

Default Paths

Linux

Consent Files: ~/.config/ubuntu-insights

Reports Cache: ~/.cache/ubuntu-insights

Command-Line Interface Usage

ubuntu-insights

ubuntu-insights [command]

Options
Available Commands:
  collect     Collect system information
  completion  Generate the autocompletion script for the specified shell
  consent     Manage or get user consent state
  help        Help about any command
  upload      Upload metrics to the Ubuntu Insights server

Flags:
      --config string         use a specific configuration file
      --consent-dir string    the base directory of the consent state files
  -h, --help                  help for ubuntu-insights
      --insights-dir string   the base directory of the insights report cache
  -v, --verbose count         issue INFO (-v), DEBUG (-vv)
      --version               version for ubuntu-insights

Manage or get user consent state for data collection and upload

ubuntu-insights consent [sources](optional arguments) [flags]

Options
Flags:
  -h, --help           help for consent
  -s, --state string   the consent state to set (true or false)

Global Flags:
      --config string        use a specific configuration file
      --consent-dir string   the base directory of the consent state files
  -v, --verbose count        issue INFO (-v), DEBUG (-vv)
Examples

To get the global consent state using the default consent directory:

foo@bar:~$ ubuntu-insights consent
Global: false

To set the consent state for the source linux:

foo@bar:~$ ubuntu-insights consent linux -s true
linux: true
ubuntu-insights collect

Collect system information and metrics and store it locally.

If source is not provided, then the source is assumed to be the currently detected platform. Additionally, there should be no source-metrics-path provided. If source is provided, then the source-metrics-path should be provided as well.

ubuntu-insights collect [source] [source-metrics-path](required if source provided) [flags]

Options
Flags:
  -d, --dry-run       perform a dry-run where a report is collected, but not written to disk
  -f, --force         force a collection, override the report if there are any conflicts (consent is still respected)
  -h, --help          help for collect
  -p, --period uint   the minimum period between 2 collection periods for validation purposes in seconds (default 1)

Global Flags:
      --config string         use a specific configuration file
      --consent-dir string    the base directory of the consent state files
      --insights-dir string   the base directory of the insights report cache
  -v, --verbose count         issue INFO (-v), DEBUG (-vv)
ubuntu-insights upload

Upload metrics to the Ubuntu Insights server.

If no sources are provided, all detected sources at the configured reports directory will be uploaded. If consent is not given for a source, an opt-out notification will be sent regardless of the locally cached insights report's contents.

ubuntu-insights upload [sources](optional arguments) [flags]

Options
Flags:
  -d, --dry-run        go through the motions of doing an upload, but do not communicate with the server, send the payload, or modify local files
  -f, --force          force an upload, ignoring min age and clashes between the collected file and a file in the uploaded folder, replacing the clashing uploaded report if it exists (doesn't ignore consent)
  -h, --help           help for upload
      --min-age uint   the minimum age (in seconds) of a report before the uploader will attempt to upload it (default 604800)
  -r, --retry          enable a limited number of retries for failed uploads

Global Flags:
      --config string         use a specific configuration file
      --consent-dir string    the base directory of the consent state files
      --insights-dir string   the base directory of the insights report cache
  -v, --verbose count         issue INFO (-v), DEBUG (-vv)

Example Insights Reports

Ubuntu Desktop
{
  "insightsVersion": "Dev",
  "collectionTime": 1748013676,
  "systemInfo": {
    "hardware": {
      "product": {
        "family": "My Product Family",
        "name": "My Product Name",
        "vendor": "My Product Vendor"
      },
      "cpu": {
        "name": "9 1200SX",
        "vendor": "Authentic",
        "architecture": "x86_64",
        "cpus": 16,
        "sockets": 1,
        "coresPerSocket": 8,
        "threadsPerCore": 2
      },
      "gpus": [
        {
          "device": "0x0294",
          "vendor": "0x10df",
          "driver": "gpu"
        },
        {
          "device": "0x03ec",
          "vendor": "0x1003",
          "driver": "gpu"
        }
      ],
      "memory": {
        "size": 23247
      },
      "disks": [
        {
          "size": 1887436,
          "type": "disk",
          "children": [
            {
              "size": 750,
              "type": "part"
            },
            {
              "size": 260,
              "type": "part"
            },
            {
              "size": 16,
              "type": "part"
            },
            {
              "size": 1887436,
              "type": "part"
            },
            {
              "size": 869,
              "type": "part"
            },
            {
              "size": 54988,
              "type": "part"
            }
          ]
        }
      ],
      "screens": [
        {
          "physicalResolution": "2560x1440",
          "size": "600mm x 340mm",
          "refreshRate": "143.85"
        },
        {
          "physicalResolution": "2560x1600",
          "size": "300mm x 190mm",
          "refreshRate": "120.00"
        }
      ]
    },
    "software": {
      "os": {
        "family": "linux",
        "distribution": "Ubuntu",
        "version": "25.04"
      },
      "timezone": "EDT",
      "language": "en_US",
      "bios": {
        "vendor": "Bios Vendor",
        "version": "Bios Version"
      }
    },
    "platform": {
      "desktop": {
        "desktopEnvironment": "ubuntu:GNOME",
        "sessionName": "ubuntu",
        "sessionType": "wayland"
      },
      "proAttached": true
    }
  }
}
WSL
{
  "insightsVersion": "Dev",
  "collectionTime": 1748012492,
  "systemInfo": {
    "hardware": {
      "cpu": {
        "name": "AM Cirus 1200XK Processor",
        "vendor": "Authentic",
        "architecture": "x86_64",
        "cpus": 256,
        "sockets": 1,
        "coresPerSocket": 128,
        "threadsPerCore": 2
      },
      "memory": {
        "size": 15904
      },
      "disks": [
        {
          "size": 388,
          "type": "disk"
        },
        {
          "size": 185,
          "type": "disk"
        },
        {
          "size": 4096,
          "type": "disk"
        },
        {
          "size": 1048576,
          "type": "disk"
        },
        {
          "size": 1048576,
          "type": "disk"
        }
      ]
    },
    "software": {
      "os": {
        "family": "linux",
        "distribution": "Ubuntu",
        "version": "25.04"
      },
      "timezone": "EDT",
      "language": "en_GB"
    },
    "platform": {
      "wsl": {
        "subsystemVersion": 2,
        "systemd": "used",
        "interop": "enabled",
        "version": "2.5.7.0",
        "kernelVersion": "6.6.87.1-microsoft-standard-WSL2"
      },
      "proAttached": true
    }
  }
}
{
  "OptOut": true
}

Get involved

This is an open source project, and we warmly welcome community contributions, suggestions, and constructive feedback. If you're interested in contributing, please take a look at our Contribution guidelines first.

  • To report an issue, please file a bug report against our repository, using a bug template.
  • For suggestions and constructive feedback, open a feature request issue using the proposed template.

Get in touch

We're friendly! We have a community forum at https://discourse.ubuntu.com where we discuss feature plans, development news, issues, updates and troubleshooting.

For news and updates, follow the Ubuntu Twitter account and on Facebook.

Directories

Path Synopsis
cmd
ingest-service
Package main is the entry point for the ingest-service application.
Package main is the entry point for the ingest-service application.
ingest-service/daemon
Package daemon provides the ingest service daemon for Ubuntu Insights.
Package daemon provides the ingest service daemon for Ubuntu Insights.
insights
Main package for the insights command line tool.
Main package for the insights command line tool.
insights/commands
Package commands contains the commands for the Ubuntu Insights CLI.
Package commands contains the commands for the Ubuntu Insights CLI.
web-service
Package main is the entry point for the web service application.
Package main is the entry point for the web service application.
web-service/daemon
Package daemon provides the web service daemon for Ubuntu Insights.
Package daemon provides the web service daemon for Ubuntu Insights.
common module
internal
cli
Package cli provides utility functions for command line interface applications.
Package cli provides utility functions for command line interface applications.
cmdutils
Package cmdutils provides utility functions for running commands.
Package cmdutils provides utility functions for running commands.
collector
Package collector is the implementation of the collector component.
Package collector is the implementation of the collector component.
collector/sysinfo
Package sysinfo allows collecting "common" system information for all insight reports.
Package sysinfo allows collecting "common" system information for all insight reports.
collector/sysinfo/hardware
Package hardware handles collecting "common" hardware information for all insight reports.
Package hardware handles collecting "common" hardware information for all insight reports.
collector/sysinfo/platform
Package platform provides a way to collect information specific to a platform.
Package platform provides a way to collect information specific to a platform.
collector/sysinfo/software
Package software handles collecting "common" software information for all insight reports.
Package software handles collecting "common" software information for all insight reports.
consent
Package consent is the implementation of the consent manager component.
Package consent is the implementation of the consent manager component.
constants
Package constants is responsible for defining the constants used in the application.
Package constants is responsible for defining the constants used in the application.
fileutils
Package fileutils provides utility functions for handling files.
Package fileutils provides utility functions for handling files.
report
Package report provides utility functions for handling reports.
Package report provides utility functions for handling reports.
server/ingest
Package ingest is responsible for running the ingest-service in the background.
Package ingest is responsible for running the ingest-service in the background.
server/ingest/database
Package database provides the database connection and upload functionality for the ingest service.
Package database provides the database connection and upload functionality for the ingest service.
server/ingest/models
Package models provides the data structures for payloads used in the ingest service.
Package models provides the data structures for payloads used in the ingest service.
server/ingest/processor
Package processor provides the functionality to process JSON files.
Package processor provides the functionality to process JSON files.
server/shared/config
Package config provides a configuration manager that loads and watches a JSON configuration file.
Package config provides a configuration manager that loads and watches a JSON configuration file.
server/webservice
Package webservice provides an HTTP server that handles incoming requests for uploading data and retrieving version information.
Package webservice provides an HTTP server that handles incoming requests for uploading data and retrieving version information.
server/webservice/handlers
Package handlers provides HTTP handlers for the server.
Package handlers provides HTTP handlers for the server.
testsdetection
Package testsdetection helps in deciding if we are currently running under integration or tests.
Package testsdetection helps in deciding if we are currently running under integration or tests.
testutils
Package testutils provides helper functions for testing
Package testutils provides helper functions for testing
uploader
Package uploader implements the uploader component.
Package uploader implements the uploader component.
pkg
insights
Package insights Golang bindings: collect and upload system metrics.
Package insights Golang bindings: collect and upload system metrics.
insights/C
main is the package for the C API.
main is the package for the C API.
shared module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL