Skip to content

current_transaction always returns nil #1569

@sivagollapalli

Description

@sivagollapalli
require 'elastic_apm'
require 'pry'
require 'pry-nav'

app = lambda do |env|
  [200, {'Content-Type' => 'text/plain'}, ['ok']]
end

# Wraps all requests in transactions and reports exceptions
use ElasticAPM::Middleware

# Start an instance of the Agent
ElasticAPM.start(service_name: 'NothingButRack')

ElasticAPM.with_transaction do |tra|
  p tra.trace_id
end

run app

# Gracefully stop the agent when process exits.
# Makes sure any pending transactions are sent.
at_exit { ElasticAPM.stop }

ElasticAPM.running? returns true. But for some reason current_transaction always returns nil even if I call start_transaction explicitly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions