Build analytics

Quarkus 团队从 Maven 下载次数中获知 Quarkus 有了显著增长,而报告问题/疑虑的用户数量也已经了解。不过,我们需要更深入地了解平台、操作系统、Java 组合以及用户使用的构建工具。构建分析工具旨在为我们提供这些信息。

The Quarkus team has limited knowledge, from Maven download numbers, of the remarkable growth of Quarkus and the number of users reporting issues/concerns. Still, we need more insight into the platforms, operating system, Java combinations, and build tools our users employ. The build analytics tool aims to provide us with this information.

How it works

*Collection happens only at build-time*是在编译时收集,并非运行时。集合是使用 Quarkus 构建工具(Maven、Gradle)进行的。您的构建应用程序不包含任何数据集合代码。

Collection happens only at build-time and not at runtime. Collection occurs during usage of Quarkus build tooling (Maven, Gradle). Your built application does not contain any data collection code.

*All data collected is anonymous*无法将此数据关联回个人或组织。目的是了解一般模式和趋势;因此,只需要匿名数据。

All data collected is anonymous. There is no way to link this data back to an individual or organization. The intent is to learn about general patterns and trends; therefore, only anonymous data is needed.

*Collection is disabled by default*在首次使用开发人员模式时,系统会询问您是否希望选择加入数据收集。控制台会等待几秒钟以获取您的输入。

Collection is disabled by default You will be asked if you want to opt in to data collection the first time you use dev mode. The console will wait for a few seconds for your input.

This is the data being collected

  • Anonymous application name. SHA-256 hash of the Group Id + Artifact Id.

  • Anonymous application version. SHA-256 hash of the Artifact Id + Version.

  • Anonymous user id. During the 1st build, this is generated locally at random, and subsequently reused.

  • Quarkus version

  • Java version

  • GraalVM version

  • Operating system details: OS name, OS version and architecture

  • Build system details, such as Maven, Gradle, and so on.

  • If a CI system was detected

  • Country and timezone

  • Extensions enabled. Only extensions whose groupIds start with io.quarkus, io.quarkiverse or are included in the quarkus platform are collected.

以下示例演示了发送的数据有效负载:

And here is an example of the data payload being sent:

Example analytics payload
{
  "context": {
    "app": {
      "name": "ZzOlt3q0VgNK0oyUd6NDAhPqJjTSxNOAnqHb5dHfS7M=",
      "version": "FUDdh16tTKtuJkcoY2Wp57IKKwxZ/Hx42tTvi3Izpmc="
    },
    "build": {
      "gradle_version": "N/A",
      "maven_version": "3.8.7"
    },
    "ci": {
      "name": "unknown"
    },
    "graalvm": {
      "java_version": "N/A",
      "vendor": "N/A",
      "version": "N/A"
    },
    "ip": "0.0.0.0",
    "java": {
      "vendor": "Eclipse Adoptium",
      "version": "17.0.4.1"
    },
    "kubernetes": {
      "detected": "false"
    },
    "library": {
      "name": "unknown",
      "version": "unknown"
    },
    "location": {
      "country": "PT"
    },
    "os": {
      "name": "Mac OS X",
      "os_arch": "aarch64",
      "version": "13.3.1"
    },
    "quarkus": {
      "version": "999-SNAPSHOT"
    },
    "timezone": "Europe/Lisbon"
  },
  "event": "BUILD",
  "integrations": {},
  "messageId": "api-2PCI9LWQM8oRyHIS6fCQMIQ0dlR",
  "originalTimestamp": "2023-05-01T15:21:22.266033Z",
  "properties": {
    "app_extensions": [
      {
        "artifact_id": "quarkus-resteasy-jackson",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      },
      {
        "artifact_id": "quarkus-smallrye-openapi",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      },
      {
        "artifact_id": "quarkus-hibernate-orm",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      },
      {
        "artifact_id": "quarkus-opentelemetry",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      },
      {
        "artifact_id": "quarkus-jdbc-postgresql",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      },
      {
        "artifact_id": "quarkus-arc",
        "group_id": "io.quarkus",
        "version": "999-SNAPSHOT"
      }
    ]
  },
  "receivedAt": "2023-05-01T15:21:23.184Z",
  "timestamp": "2023-05-01T15:21:22.266Z",
  "type": "track",
  "userId": "872332b4-4b21-42ee-854b-d86c8629e78b"
}

Where are the config files?

分析配置存储在用户主目录的 `.redhat`文件夹中:

Analytics configurations are stored at the .redhat folder in the user’s home directory:

`anonymousId`是本地生成的匿名用户 ID。

anonymousId is the locally generated anonymous user id.

`io.quarkus.analytics.localconfig`持有的内容是用户同意发送分析数据还是不同意。

io.quarkus.analytics.localconfig holds if the user has agreed to send analytics data or not.

`io.quarkus.analytics.remoteconfig`是远程配置的缓存,可以全局禁用分析。

io.quarkus.analytics.remoteconfig cache of the remote configuration that allows to disable analytics globally.

Show me the code!

大部分代码是在 `analytics-common`模块中实现的。数据通过 Maven 和 Gradle 插件调用的 `io.quarkus.analytics.AnalyticsService.sendAnalytics(…​)`进行发送。

The bulk of the code is implemented in the analytics-common module. Data is sent using calls to io.quarkus.analytics.AnalyticsService.sendAnalytics(…​) from the Maven and Gradle plugins.

上传的事件存储在项目的 /target`文件夹下,名称为 `build-analytics-event.json

The uploaded events are stored under the project’s /target folder with the name build-analytics-event.json.

How to disable analytics?

Build time analytics is not active by default.

如果您已经选择加入并希望禁用构建时间分析,则可以使用两种方式:

If you have opted in and would like to disable build time analytics, you can do so in two ways:

  • Globally, by editing the io.quarkus.analytics.localconfig file in the '.redhat' folder of your user’s home directory. Update the file as follows:

{"disabled":true}
  • Per project, by using the system property quarkus.analytics.disabled=true when building the project.

Example using maven
mvn clean install -Dquarkus.analytics.disabled=true

Configuration

Configuration property Type Default

[id="build-analytics-quarkus-analytics-disabled"]quarkus.analytics.disabled

Values can be true or false.

Setting this property to true will disable the collection of analytics data on that specific project regardless of any other configuration.

boolean

false

[id="build-analytics-quarkus-analytics-uri-base"]quarkus.analytics.uri.base

Base URL of the analytics service. This is were all the data is sent to.

String

"https://api.segment.io/"

[id="build-analytics-quarkus-analytics-timeout"]quarkus.analytics.timeout

Value in milliseconds for the timeout of the HTTP request to submit the analytics service.

int

3000