第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在非 Spring Boot 應(yīng)用程序中設(shè)置普羅米修斯端點(diǎn)

如何在非 Spring Boot 應(yīng)用程序中設(shè)置普羅米修斯端點(diǎn)

喵喵時(shí)光機(jī) 2021-09-12 15:32:00
我想向我的應(yīng)用程序添加一個(gè)路徑“l(fā)ocalhost:8080/metrics”,以便Counter使用 Prometheus查看我的變量。我讀到了一個(gè) spring 啟動(dòng)應(yīng)用程序,我需要主類上的唯一注釋。package hello;import io.prometheus.client.spring.boot.EnablePrometheusEndpoint;import io.prometheus.client.spring.boot.EnableSpringBootMetricsCollector;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@EnablePrometheusEndpoint@EnableSpringBootMetricsCollectorpublic class Application {    public static void main(String[] args) {        SpringApplication.run(Application.class, args);    }}如何在沒有@SpringBootApplication.可以通過注冊(cè)多個(gè)servlet來實(shí)現(xiàn)嗎?
查看完整描述

1 回答

?
慕仙森

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊

您可能希望將 Prometheus servlet 添加到您的應(yīng)用程序中。


我將給出文檔中引用的 Jetty 服務(wù)器的示例:


Server server = new Server(1234);

ServletContextHandler context = new ServletContextHandler();

context.setContextPath("/");

server.setHandler(context);


context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics");

依賴項(xiàng)io.prometheus.simpleclient_spring_boot是 Spring Boot 集成。相反,您應(yīng)該查看核心庫io.prometheus.simpleclient。


查看完整回答
反對(duì) 回復(fù) 2021-09-12
  • 1 回答
  • 0 關(guān)注
  • 134 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)