IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Adding additional context
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Adding additional context
editAdding custom context
editYou can add your own custom, nested JSON-compatible data to the current
transaction using ElasticAPM.set_custom_context(hash) eg.:
class ThingsController < ApplicationController
before_action do
ElasticAPM.set_custom_context(company: current_user.company)
end
# ...
end
Adding labels
editLabels are special in that they are indexed in your Elasticsearch database and therefore queryable.
ElasticAPM.set_label(:company_name, 'Acme, Inc.')
Note that ., * and " in keys are converted to _.
Providing info about the user
editYou can provide ElasticAPM with info about the current user.
class ApplicationController < ActionController::Base
before_action do
current_user && ElasticAPM.set_user(current_user)
end
end