Skip to content

Commit fa26208

Browse files
move ReportLatencyCounters to ReplyWithError
1 parent 35977c7 commit fa26208

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ydb/core/http_proxy/http_req.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,23 @@ namespace NKikimr::NHttpProxy {
409409

410410
HttpContext.ResponseData.Status = status;
411411
HttpContext.ResponseData.ErrorText = errorText;
412-
HttpContext.DoReply(ctx, issueCode);
412+
ReplyToHttpContext(ctx, issueCode);
413413

414414
ctx.Send(AuthActor, new TEvents::TEvPoisonPill());
415415

416416
TBase::Die(ctx);
417417
}
418418

419+
void ReplyToHttpContext(const TActorContext& ctx, std::optional<size_t> issueCode) {
420+
ReportLatencyCounters(ctx);
421+
422+
if (issueCode.has_value()) {
423+
HttpContext.DoReply(ctx, issueCode.value());
424+
} else {
425+
HttpContext.DoReply(ctx);
426+
}
427+
}
428+
419429
void ReportInputCounters(const TActorContext& ctx) {
420430

421431
if (InputCountersReported) {
@@ -478,7 +488,6 @@ namespace NKikimr::NHttpProxy {
478488
HttpContext.ContentType == MIME_CBOR);
479489
FillOutputCustomMetrics<TProtoResult>(
480490
*(dynamic_cast<TProtoResult*>(ev->Get()->Message.Get())), HttpContext, ctx);
481-
ReportLatencyCounters(ctx);
482491
/* deprecated metric: */ ctx.Send(MakeMetricsServiceID(),
483492
new TEvServerlessProxy::TEvCounter{1, true, true,
484493
BuildLabels(Method, HttpContext, "api.http.success_per_second", setStreamPrefix)
@@ -495,7 +504,7 @@ namespace NKikimr::NHttpProxy {
495504
{"code", "200"},
496505
{"name", "api.http.data_streams.response.count"}}
497506
});
498-
HttpContext.DoReply(ctx);
507+
ReplyToHttpContext(ctx);
499508
} else {
500509
auto retryClass =
501510
NYdb::NPersQueue::GetRetryErrorClass(ev->Get()->Status->GetStatus());

0 commit comments

Comments
 (0)