Type to search.

Adding additional context

Serverless Observability

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Stack

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

APM Agent Ruby

The Elastic APM Ruby agent enables you to trace the execution of operations in your Ruby applications, sending performance metrics and errors to the Elastic APM Server.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

You can add your own custom, nested JSON-compatible data to the current transaction using ElasticAPM.set_custom_context(hash) eg.:

Ruby
class ThingsController < ApplicationController
  before_action do
    ElasticAPM.set_custom_context(company: current_user.company)
  end

  # ...
end

Labels are special in that they are indexed in your Elasticsearch database and therefore queryable.

Ruby
ElasticAPM.set_label(:company_name, 'Acme, Inc.')

Note that ., * and " in keys are converted to _.

You can provide ElasticAPM with info about the current user.

Ruby
class ApplicationController < ActionController::Base
  before_action do
    current_user && ElasticAPM.set_user(current_user)
  end
end