feat(native): Add counter to track http client connection reuse#26822
Merged
kewang1024 merged 1 commit intoprestodb:masterfrom Jan 12, 2026
Merged
feat(native): Add counter to track http client connection reuse#26822kewang1024 merged 1 commit intoprestodb:masterfrom
kewang1024 merged 1 commit intoprestodb:masterfrom
Conversation
Collaborator
kewang1024
commented
Dec 17, 2025
Contributor
Reviewer's GuideAdds HTTP client metrics to distinguish first-use versus reused connections using transaction sequence numbers, and registers the corresponding counters in the metrics system. Sequence diagram for HTTP client connection reuse metricssequenceDiagram
participant Client
participant HttpClient
participant HTTPTransaction
participant ResponseHandler
participant MetricsSystem
Client->>HttpClient: sendRequest()
HttpClient->>HTTPTransaction: createOrReuseTransaction()
HTTPTransaction->>ResponseHandler: setTransaction(this)
ResponseHandler->>HTTPTransaction: getSequenceNumber()
HTTPTransaction-->>ResponseHandler: seqNo
alt seqNo == 0 (first use)
ResponseHandler->>MetricsSystem: RECORD_METRIC_VALUE(kCounterHttpClientConnectionFirstUse)
else seqNo > 0 (reused connection)
ResponseHandler->>MetricsSystem: RECORD_METRIC_VALUE(kCounterHttpClientConnectionReuse)
end
ResponseHandler-->>HTTPTransaction: transactionHandlerReady()
HTTPTransaction-->>HttpClient: transactionReady()
HttpClient-->>Client: responseProcessed
Flow diagram for HTTP client connection reuse counters definition and usageflowchart TD
A[Headers in Counters_h<br/>kCounterHttpClientConnectionFirstUse<br/>kCounterHttpClientConnectionReuse] --> B[Metrics registration in Counters_cpp<br/>registerPrestoMetrics<br/>DEFINE_METRIC for both counters]
B --> C[Metrics system<br/>stores SUM counters]
C --> D[HttpClient ResponseHandler_setTransaction<br/>txn_.getSequenceNumber]
D -->|seqNo == 0| E[RECORD_METRIC_VALUE<br/>kCounterHttpClientConnectionFirstUse]
D -->|seqNo > 0| F[RECORD_METRIC_VALUE<br/>kCounterHttpClientConnectionReuse]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
20887f0 to
924a77e
Compare
arhimondr
approved these changes
Dec 18, 2025
924a77e to
09e1e82
Compare
This was referenced Mar 31, 2026
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.