Skip to content

Request queue time not tracked in rails #2873

@davekaro

Description

@davekaro

Issue Description

In #2838, queue time is captured for Rack apps. I am using the newest gem version, but noticed I couldn't find any data for the request queue time. Looking at the code, I think it's because the capture is done in

def start_transaction(env, scope)
options = {
name: scope.transaction_name,
source: scope.transaction_source,
op: transaction_op,
origin: SPAN_ORIGIN
}
transaction = Sentry.continue_trace(env, **options)
transaction = Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options)
# attach queue time if available
if transaction && (queue_time = extract_queue_time(env))
transaction.set_data(Span::DataConventions::HTTP_QUEUE_TIME_MS, queue_time)
end
transaction
end
, but since I'm running a Rails app, my rack app uses the subclass that overrides that method here
def start_transaction(env, scope)
options = {
name: scope.transaction_name,
source: scope.transaction_source,
op: transaction_op,
origin: SPAN_ORIGIN
}
if @assets_regexp && scope.transaction_name.match?(@assets_regexp)
options.merge!(sampled: false)
end
transaction = Sentry.continue_trace(env, **options)
Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options)
end
and never captures the queue time.

Reproduction Steps

Install the latest sentry-ruby gem, configured in a Rails app, look for http.server.request.time_in_queue in the tracing.

Expected Behavior

I should see http.server.request.time_in_queue in the tracing.

Actual Behavior

I can't find http.server.request.time_in_queue in the tracing.

Ruby Version

4.0.1

SDK Version

6.4.0

Integration and Its Version

No response

Sentry Config

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions