Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArthasBootstrap.getInstance(instrumentation, "") 如何禁止调用/api/latest_version #2973

Open
1 task
243300852 opened this issue Dec 12, 2024 · 0 comments

Comments

@243300852
Copy link

  • 我已经在 issues 里搜索,没有重复的issue。

环境信息

  • arthas-boot.jar 或者 as.sh 的版本: xxx
  • Arthas 版本: 4.0.1
  • 操作系统版本: centos
  • 目标进程的JVM版本: jdk8
  • 执行arthas-boot的版本: 4.0.1

初始化调用ArthasBootstrap.getInstance(instrumentation, "") 时,会自动调用[/api/latest_version](https://arthas.aliyun.com/api/latest_version接口,就为了打印一行日志?我看代码里没办法关掉这个调用么

public static String welcome(Map<String, String> infos) {
    logger.info("Current arthas version: {}, recommend latest version: {}", version(), latestVersion());
    TableElement table = (new TableElement()).rightCellPadding(1).row(new String[]{"wiki", wiki()}).row(new String[]{"tutorials", tutorials()}).row(new String[]{"version", version()}).row(new String[]{"main_class", PidUtils.mainClass()}).row(new String[]{"pid", PidUtils.currentPid()}).row(new String[]{"time", DateUtils.getCurrentDate()});
    Iterator var2 = infos.entrySet().iterator();

    while(var2.hasNext()) {
        Map.Entry<String, String> entry = (Map.Entry)var2.next();
        table.row(new String[]{(String)entry.getKey(), (String)entry.getValue()});
    }

    return logo() + "\n" + RenderUtil.render(table);
}

static String latestVersion() {
    try {
        URLConnection urlConnection = openURLConnection("https://arthas.aliyun.com/api/latest_version");
        InputStream inputStream = urlConnection.getInputStream();
        return IOUtils.toString(inputStream).trim();
    } catch (Throwable var2) {
        return "";
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant