From c40e4a7eb4bb2a9d8c8773b7a4d719827b049b9d Mon Sep 17 00:00:00 2001 From: cheatfate Date: Wed, 2 Aug 2023 03:39:32 +0300 Subject: [PATCH] Fix compilation issue. --- presto/client.nim | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/presto/client.nim b/presto/client.nim index 7fe0481..33bfed4 100644 --- a/presto/client.nim +++ b/presto/client.nim @@ -532,21 +532,22 @@ template closeObjects(o1, o2, o3, o4: untyped): untyped = await o4.closeWait() o4 = nil -proc processStatusMetrics(ep: string, status: int) = - let sts = Base10.toString(uint64(status)) - case status - of 100 .. 199: - presto_client_1xx_response_count.inc(1, @[ep, sts]) - of 200 .. 299: - presto_client_2xx_response_count.inc(1, @[ep, sts]) - of 300 .. 399: - presto_client_3xx_response_count.inc(1, @[ep, sts]) - of 400 .. 499: - presto_client_4xx_response_count.inc(1, @[ep, sts]) - of 500 .. 599: - presto_client_5xx_response_count.inc(1, @[ep, sts]) - else: - presto_client_xxx_response_count.inc(1, @[ep, sts]) +when defined(metrics): + proc processStatusMetrics(ep: string, status: int) = + let sts = Base10.toString(uint64(status)) + case status + of 100 .. 199: + presto_client_1xx_response_count.inc(1, @[ep, sts]) + of 200 .. 299: + presto_client_2xx_response_count.inc(1, @[ep, sts]) + of 300 .. 399: + presto_client_3xx_response_count.inc(1, @[ep, sts]) + of 400 .. 499: + presto_client_4xx_response_count.inc(1, @[ep, sts]) + of 500 .. 599: + presto_client_5xx_response_count.inc(1, @[ep, sts]) + else: + presto_client_xxx_response_count.inc(1, @[ep, sts]) proc processHttpResponseMetrics(response: HttpClientResponseRef, endpoint: Opt[string],