当 运行 Prometheus 时,我所有的端点都开始返回 404
When running Prometheus, all my endpoints start returning 404
我的 SpringBoot 应用程序运行良好,当我使用 Postman 访问我的 API 端点时,我的端点 return 正确响应。
与我的执行器相同。他们工作正常。
我还添加了 spring 依赖项 micrometer-core
和 micrometer-registry-prometheus
,它们添加到我的执行器新路径“/prometheus”中。这条路径也很好用 returns 指标。
因为我想看图表,所以我从官方网站(zip 文件)下载了独立的 Prometheus 应用程序(所以没有 docker 图片)并解压缩。
里面有prometheus.exe和prometheus.yaml个文件。
即使根本不修改这个 yaml 文件,只要我双击 prometheus.exe 启动它(正确启动它),我所有的端点都会停止 returning 200 OK 并且开始 returning 404 Not Found 响应。
然后我修改它以添加我的工作名称和路径,如
-job_name: 'spring-actuators'
metric_path: '/myappname/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
即使更改为现在从 'myappname' 抓取指标,每次我尝试使用 Postman 向我的 API 发送请求时,我仍然会在启动 prometheus 后立即收到 404 响应。
我注意到 postman.exe 控制台也在服务器准备好请求后立即显示错误:
level=info ts=2021-06-02T15:42:03.421Z caller=main.go:775 msg="Server is ready to receive web requests."
level=error ts=2021-06-02T15:42:10.374Z caller=db.go:780 component=tsdb msg="compaction failed" err="compact head: persist head block: rename block dir: rename data\01F76P79CQDPFVGZS5XNTDTK4P.tmp-for-creation data\01F76P79CQDPFVGZS5XNTDTK4P: Access is denied."
您的应用程序在 Prometheus 9090
的同一端口上公开端点。更改 spring 启动应用程序以在 8080
或除 9090
以外的任何其他端口公开端点。然后在该端口抓取您的应用程序。
-job_name: 'spring-actuators'
metric_path: '/myappname/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8080']
我的 SpringBoot 应用程序运行良好,当我使用 Postman 访问我的 API 端点时,我的端点 return 正确响应。
与我的执行器相同。他们工作正常。
我还添加了 spring 依赖项 micrometer-core
和 micrometer-registry-prometheus
,它们添加到我的执行器新路径“/prometheus”中。这条路径也很好用 returns 指标。
因为我想看图表,所以我从官方网站(zip 文件)下载了独立的 Prometheus 应用程序(所以没有 docker 图片)并解压缩。
里面有prometheus.exe和prometheus.yaml个文件。
即使根本不修改这个 yaml 文件,只要我双击 prometheus.exe 启动它(正确启动它),我所有的端点都会停止 returning 200 OK 并且开始 returning 404 Not Found 响应。
然后我修改它以添加我的工作名称和路径,如
-job_name: 'spring-actuators'
metric_path: '/myappname/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
即使更改为现在从 'myappname' 抓取指标,每次我尝试使用 Postman 向我的 API 发送请求时,我仍然会在启动 prometheus 后立即收到 404 响应。
我注意到 postman.exe 控制台也在服务器准备好请求后立即显示错误:
level=info ts=2021-06-02T15:42:03.421Z caller=main.go:775 msg="Server is ready to receive web requests."
level=error ts=2021-06-02T15:42:10.374Z caller=db.go:780 component=tsdb msg="compaction failed" err="compact head: persist head block: rename block dir: rename data\01F76P79CQDPFVGZS5XNTDTK4P.tmp-for-creation data\01F76P79CQDPFVGZS5XNTDTK4P: Access is denied."
您的应用程序在 Prometheus 9090
的同一端口上公开端点。更改 spring 启动应用程序以在 8080
或除 9090
以外的任何其他端口公开端点。然后在该端口抓取您的应用程序。
-job_name: 'spring-actuators'
metric_path: '/myappname/actuator/prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8080']