How to enable JVM metrics on Heroku hosted app deployed via "heroku deploy:jar …" command

huangapple 未分类评论50阅读模式
英文:

How to enable JVM metrics on Heroku hosted app deployed via "heroku deploy:jar ..." command

问题

我在Heroku上部署了一个应用程序。

我使用了以下命令 heroku deploy:jar 来部署它:

heroku deploy:jar my-heroku-app-name.jar --team=my-team --app=my-heroku-app-name

该应用已经部署并成功运行。

我现在想要启用 Heroku JVM Runtime Metrics说明文档 告诉我运行以下命令:

git commit --allow-empty -m "Enable Heroku Metrics"
git push heroku master

我认为这些说明是基于这样一个假设:我有一个本地的 Git 存储库来代表我的部署应用程序,且我的 shell 当前工作目录位于该存储库内。但实际情况是我没有这样的存储库(因为我是通过 deploy:jar 部署的),所以我认为我应该从 Heroku 的 Git 存储库中克隆一个本地的 Git 存储库。

我尝试使用这个技术 从 Heroku 主存储库克隆一个本地的 Git 存储库。然而当我尝试时,我得到了如下结果:

$ heroku git:clone -a my-heroku-app-name
Cloning into 'my-heroku-app-name'...
warning: You appear to have cloned an empty repository.

我猜这是预期的,因为:

如果你除了使用 git push 以外的任何方法部署应用,你将无法从 Heroku 克隆应用的源代码。其他部署方法不会更新应用的 Heroku Git 存储库,导致 heroku git:clone 返回一个空的存储库。这些其他部署方法包括:

直接从 GitHub 部署
Heroku 容器注册表
Heroku 按钮

我还尝试遵循说明,尽管我在中途得到了 "You appear to have cloned an empty repository" 警告,以下是命令和输出:

$ heroku git:clone -a my-heroku-app-name
Cloning into 'my-heroku-app-name'...
warning: You appear to have cloned an empty repository.

$ cd my-heroku-app-name/

$ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

$ git commit --allow-empty -m "Enable Heroku Metrics"
[master (root-commit) 34534df] Enable Heroku Metrics

$ git push heroku master
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 179 bytes | 179.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
remote: error: pathspec '.' did not match any file(s) known to git.
remote:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote: ! and provide the Request ID zzzzzzzzzzzzz
remote:
To https://git.heroku.com/my-heroku-app-name.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-heroku-app-name.git'

我还尝试了下面这个,但似乎也没有帮助:

$ heroku labs:enable "runtime-heroku-metrics" -a "my-heroku-app-name"
Enabling runtime-heroku-metrics for my-heroku-app-name... done

我在 Heroku 控制台的 Metrics 选项卡中看到了这个信息:

未接收到 JVM 指标:我们目前未从您的应用程序接收 JVM 运行时指标数据。

我该怎么办?

英文:

I have an app deployed on Heroku.

I used the following command heroku deploy:jar to deploy it::

heroku deploy:jar my-heroku-app-name.jar --team=my-team --app=my-heroku-app-name

The app is deployed and running successfully.

I now want to enable Heroku JVM Runtime Metrics. The instructions tell me to run the following commands:

git commit --allow-empty -m "Enable Heroku Metrics"
git push heroku master

I think these instructions are based on the assumption that I have a local git repository representing my deployed application AND my shell current working directory is within that repository. I have no such repository (as I deployed via deploy:jar), so I thought I should clone a local git repository from the Heroku git respository.

I tried to use this technique to clone a local git repo from the Heroku master. However I when I try this I get:

$ heroku git:clone -a my-heroku-app-name
Cloning into 'my-heroku-app-name'...
warning: You appear to have cloned an empty repository.

Which I guess is expected because:
>You cannot clone your app’s source from Heroku if you deploy your app with any method besides git push. Other deployment methods do not update your app’s Heroku Git repo, causing heroku git:clone to return an empty repository. These other deployment methods include:

>Deploying directly from GitHub
>Heroku Container Registry
>The Heroku Button

I also tried following the instructions, even though I got the "You appear to have cloned an empty repository" warning in the middle, this is the commands and output:

$ heroku git:clone -a my-heroku-app-name
Cloning into 'my-heroku-app-name'...
warning: You appear to have cloned an empty repository.

$ cd my-heroku-app-name/

$ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

$ git commit --allow-empty -m "Enable Heroku Metrics"
[master (root-commit) 34534df] Enable Heroku Metrics

$ git push heroku master
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 179 bytes | 179.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
remote: error: pathspec '.' did not match any file(s) known to git.
remote: 
remote: !	Heroku Git error, please try again shortly.
remote: !	See http://status.heroku.com for current Heroku platform status.
remote: !	If the problem persists, please open a ticket
remote: !	on https://help.heroku.com/tickets/new
remote: !	and provide the Request ID zzzzzzzzzzzzz
remote: 
To https://git.heroku.com/my-heroku-app-name.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-heroku-app-name.git'

I also tried this but that did not seem to help either:

$ heroku labs:enable "runtime-heroku-metrics" -a "my-heroku-app-name"
Enabling runtime-heroku-metrics for my-heroku-app-name... done

I see this in the Heroku Console Metrics tab:
>Not Receiving JVM Metrics: We are not currently receiving JVM Runtime Metrics data from your application.

What should I do?

huangapple
  • 本文由 发表于 2020年4月9日 14:19:39
  • 转载请务必保留本文链接:https://java.coder-hub.com/61115072.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定