Quarkus千分尺中的非200个响应代码没有HTTP客户端指标

发布于 2025-01-28 03:11:31 字数 1359 浏览 2 评论 0原文

我有以下Quarkus REST客户端代码(基于此doc https://quarkus.io/guides/guides/rest/rest -client

@RegisterRestClient(baseUri = "https://pesho3.free.beeceptor.com")
interface TokenService {

    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_JSON)
    @ClientHeaderParam(
        name = "Authorization",
        value = ["Basic asdasd"]
    )
    fun getToken(
        @FormParam("grant_type") grantType: String = "client_credentials",
        @FormParam("scope") scope: String = "IIG-HIP-NP/Read"
    ): JSONObject
}

当我调用我的getToken()方法并获取http 200时,我会在localhost中自动生成的指标:8080/q/量表(如此doc https://quarkus.io/guides/guides/micrometer#review-autopitiort-generatory-generatory-generatory-generatory-generational-generated-Metrics

EG

http_client_requests_seconds_count{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 2.0
http_client_requests_seconds_sum{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 1.116203

我没有得到有200条代码的任何指标。我如何揭露它们?

I have the following Quarkus Rest client code (based on this doc https://quarkus.io/guides/rest-client)

@RegisterRestClient(baseUri = "https://pesho3.free.beeceptor.com")
interface TokenService {

    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_JSON)
    @ClientHeaderParam(
        name = "Authorization",
        value = ["Basic asdasd"]
    )
    fun getToken(
        @FormParam("grant_type") grantType: String = "client_credentials",
        @FormParam("scope") scope: String = "IIG-HIP-NP/Read"
    ): JSONObject
}

When I call my getToken() method and get http 200 I get automatically generated metrics in localhost:8080/q/metrics (as stated in this doc https://quarkus.io/guides/micrometer#review-automatically-generated-metrics)

e.g

http_client_requests_seconds_count{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 2.0
http_client_requests_seconds_sum{clientName="pesho3.free.beeceptor.com",method="POST",outcome="SUCCESS",status="200",uri="root",} 1.116203

I don't get any metrics for non 200 codes.. How can I expose them ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2025-02-04 03:11:31

我找到了解决方案。它的此属性(Quarkus doc中未提及)

microprofile.rest.client.disable.default.mapper=true

答案是在此文档中:

 https://download.eclipse.org/microprofile/microprofile-rest-client-1.3/microprofile-rest-client-1.3.html#_default_responseexceptionmapper

I found the solution.. Its this property (not mentioned in Quarkus doc)

microprofile.rest.client.disable.default.mapper=true

The answer was in this doc:

 https://download.eclipse.org/microprofile/microprofile-rest-client-1.3/microprofile-rest-client-1.3.html#_default_responseexceptionmapper
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文