> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AppSignal Ruby Collector Configuration

This documentation explains how to configure AppSignal for Ruby to use the [AppSignal Collector](/collector) to send data to AppSignal. This documentation assumes that you have already followed [the installation instructions](/ruby/installation).

**This is an experimental feature.** [Distributed tracing](/distributed-tracing) **is only available** when using the AppSignal hosted collector.

## Requirements

Collector mode ships in a pre-release version of the `appsignal` gem.

Collector mode requires **Ruby 3.1 or newer**. On older Ruby versions the `collector_endpoint` option is ignored.

Collector mode does not support **JRuby**. It depends on how Ruby handles forking, which JRuby does something different with.

## Installing the OpenTelemetry gems

Collector mode sends data using OpenTelemetry. The `appsignal` gem does not install the OpenTelemetry gems, so add `appsignal-opentelemetry` next to the `gem "appsignal"` line already in your `Gemfile`:

<CodeGroup>
  ```ruby title="Gemfile" theme={null}
  gem "appsignal", ">= 5.0.0.rc1", "< 6"
  gem "appsignal-opentelemetry", ">= 5.0.0.rc1", "< 6"
  ```
</CodeGroup>

Then run `bundle install`.

The `appsignal-opentelemetry` gem does nothing on its own. It only installs the OpenTelemetry gem versions that collector mode supports, so you do not have to track them yourself. Its version matches the `appsignal` gem, so `appsignal-opentelemetry` 5.0.0 pairs with `appsignal` 5.0.0.

If those gems are missing or their versions are unsupported, AppSignal logs a warning at startup and does not enter collector mode.

## Deploying a collector

You can have AppSignal host a collector for you using the ["Hosted Collector"](https://appsignal.com/redirect-to/organization?to=admin/hosted_collectors) page in your organization's settings.

## Configuring the collector

Set [the `collector_endpoint` configuration option](/ruby/configuration/options#option-collector_endpoint) to the address of your collector. When using a hosted collector, this address can be found under "Collector URL" in the "Hosted Collector" settings page.

Set [the `service_name` option](/ruby/configuration/options#option-service_name) as well. It names this application among the services reporting to your collector, so a trace that crosses several of them shows which service did what.

<CodeGroup>
  ```ruby title="config/appsignal.rb" theme={null}
  Appsignal.configure do |config|
    # ... other settings ...
    config.collector_endpoint = "https://collector.example"
    config.service_name = "web-server"
  end
  ```

  ```sh title="Environment variables" theme={null}
  APPSIGNAL_COLLECTOR_ENDPOINT="https://collector.example"
  APPSIGNAL_SERVICE_NAME="web-server"
  ```
</CodeGroup>

AppSignal for Ruby now sends its traces, metrics, and logs to the configured collector.

AppSignal builds its traces out of OpenTelemetry spans when it reports to a collector. Read [AppSignal for Ruby and OpenTelemetry](/ruby/instrumentation/opentelemetry) for how to describe those spans yourself, and how AppSignal works together with instrumentation you write with the OpenTelemetry SDK.
