The Java Pyroscope agent does not use `pyroscope.application.name ` when profiling Gradle assemblies
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
从 gradle.properties 配置以及 Gradle 将 org.gradle.jvmargs 传递给其 daemon 时 Java Pyroscope agent 的行为开始。使用 gradle clean build --no-daemon 复现,并在 Pyroscope UI 中检查生成的应用程序。完成的标准是构建报告 my-application,并带有 env=prod 和 version=1.0 标签,而不是自动生成的名称。
由索引模型根据 Issue 内容生成。
描述
Problem description
When trying to profile a Gradle project build using the Java Pyroscope agent, the application name that is set in the gradle.properties file via the system property -Dpyroscope.application.name , is not recognized and is not applied. Instead of the custom name specified in the configuration, the automatically generated default name is displayed in the Pyroscope user interface.
Expected behavior:
It is expected that after the Gradle build is completed with the java agent configured, an application with the name my-application and the corresponding tags {env=prod,version=1.0}, as it was specified in `gradle.properties'.
Current (actual) behavior:
In the Pyroscope user interface, instead of the expected name my-application, an automatically generated name is displayed, in this case javaspy.WeChRaEsRvWcEjq93mpGGg. This indicates that the agent is running and sending data, but it cannot correctly determine or apply the application name from the JVM arguments passed to the Gradle daemon.
As you can see in the attached screenshot, there is no my-application in the list of applications.
Steps to reproduce
To reproduce the problem, follow these steps::
- Installing and configuring the Gradle environment:
- Downloading the Gradle distribution:
wget https://services.gradle.org/distributions/gradle-8.14.2-bin.zip
- Creating a directory and unpacking an archive:
mkdir /opt/gradle
unzip -d /opt/gradle gradle-8.14.2-bin.zip
- Setting up the environment variable
PATH:
export PATH=$PATH:/opt/gradle/gradle-8.14.2/bin
- Creating a Gradle test project:
mkdir gradle-profiling-example
cd gradle-profiling-example
gradle init --type java-application --dsl kotlin --test-framework junit-jupiter --project-name simple-app --package com.example
- Loading the Java Pyroscope agent:
- The agent is loaded into the Gradle daemon cache directory to be accessible to the daemon JVM.
wget -O /home/user/.gradle/daemon/8.14.2/pyroscope.jar https://github.com/grafana/pyroscope-java/releases/download/v2.1.2/pyroscope.jar
- Note: The path is
/home/user/.gradle/daemon/8.14.2/may vary depending on the user and the version of Gradle.
- Launching the Pyroscope server:
- A
docker-compose' file is created.ymlin the root of the project with the following contents:
version: '3.8'
services:
pyroscope:
image: grafana/pyroscope:main-8c89229
ports:
- "4040:4040"
command:
- "server"
- The container starts:
docker-compose up -d
- Gradle configuration for profiling:
- The
gradle.propertiesfile is created or edited in the root of the project with the following content, where the JVM arguments for the Gradle daemon are specified:
# JVM arguments for Gradle Daemon
org.gradle.jvmargs=-javaagent:pyroscope.jar -Dpyroscope.application.name=my-application{env=prod,version=1.0} -Dpyroscope.server.address=http://localhost:4040 -Dpyroscope.profile=cpu,alloc,lock,network,wall
- Important:
pyroscope.jarmust be in a path accessible by the Gradle daemon. In this case, it was placed in his cache.
- Launching the profiled build:
- The project is being built. The '--no-daemon
flag is used to ensure that a new Gradle daemon is started that picks up arguments fromgradle.properties'.
gradle clean build --no-daemon
After completing these steps, when going to the Pyroscope web interface (http://localhost:4040 ) the problem described above is observed.
- 主要语言
- Java
- 星标
- 125
- 派生
- 48
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
grafana/pyroscope-java 的其他 Issue
-
Clean up dead publishing repository config and credentials in subproject build files可能已有人在做 @arnabnandy7 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
grafana/pyroscope-java#294 ·
-
难度 4/5 3-5 天 新手友好度 54/100
grafana/pyroscope-java#371 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 45/100
grafana/pyroscope-java#368 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
grafana/pyroscope-java#283 ·
-
libasyncProfiler-linux-x64.so dump in /tmp可能重新可做 @korniltsev-grafanista 于 262 天前认领,目前没有进行中的 PR。 未关闭
grafana/pyroscope-java#250 · 1 条评论 · 已指派 1 人 ·
查看 grafana/pyroscope-java 的全部 Issue
相似的 Issue
-
approved bug
难度 2/5 1-3 小时 新手友好度 70/100
checkstyle/checkstyle#21981 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
beehive-lab/TornadoVM#1248 ·
维护者通常 1 天内回复
-
bug jdbc-v2
难度 2/5 1-3 小时 新手友好度 70/100
ClickHouse/clickhouse-java#3214 ·
维护者通常 1 天内回复
-
area: detector eco: java help wanted lane: free-agent roadmap size: S type: parser
难度 2/5 1-3 小时 新手友好度 62/100
arminazimi/evergreen#355 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
micronaut-projects/micronaut-data#4134 ·
维护者通常 1 天内回复