# Set up Relia in Go, Rust, Java, .NET and other languages

> Connect an app in any language to Relia through OpenTelemetry, the open standard, with seven settings and your language's official OpenTelemetry setup.

Section: Set up your stack · Page: https://tryrelia.com/docs/opentelemetry-setup · Last checked against the product: 2026-11-01
Video walkthrough: https://youtu.be/wg69A_5LhaU

Node.js, Python and PHP have Relia's one-command setup. Every other language connects through **OpenTelemetry**, the open standard most languages and monitoring tools support. Your app uses the official OpenTelemetry libraries, so nothing in your code is tied to Relia. Incidents, the **APIs** page, database queries and fix plans work the same.

## Before you start

- A Relia account ([Create your account](https://tryrelia.com/docs/create-account.md)).
- Access to where your app is started: your host's settings, a Dockerfile or docker-compose file, a systemd unit, or a start script.

## Steps

1. **Open the settings card.** In Relia, open your project and click **Setup Guide & SDK**. Under **Or set it up yourself**, pick the tile **Go, Rust, Java…**. The card's settings are already filled in with your project's values.

2. **Copy the seven settings.** They look like this:

   ```bash
   OTEL_EXPORTER_OTLP_ENDPOINT=https://devotel.tryrelia.com
   OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
   OTEL_EXPORTER_OTLP_HEADERS=x-relia-key=<your project key>
   OTEL_RESOURCE_ATTRIBUTES=relia.project_id=<your project id>,deployment.environment.name=production
   OTEL_SERVICE_NAME=api
   OTEL_METRICS_EXPORTER=none
   OTEL_LOGS_EXPORTER=none
   ```

   The first line says where your data goes. The headers line holds your project key, and the next line your project id.

3. **Paste them where your app starts**, as environment variables. Go, Rust, Java and .NET don't read a `.env` file by themselves.

4. **On your laptop**, change `production` to `development` so test traffic stays apart from production.

5. **Add your language's OpenTelemetry setup** (below). Already using OpenTelemetry, for example with Datadog, Honeycomb or Grafana? Skip this step: the settings are all you change.

   > **Tip:** your AI assistant knows these steps for Go, Rust, Java and others. Watch [Set up production monitoring with one sentence to your AI assistant](https://youtu.be/_e0n2r1ZCq4) (2 min).

6. **Restart your app and use it once**: open a page or call an endpoint. Data arrives within a minute.

## Go

Tested with `net/http`. Install:

```bash
go get go.opentelemetry.io/otel go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp github.com/XSAM/otelsql
```

Pick **Go** on the card and add the file `relia.go` it shows as it is, then run `go mod tidy`. In `main`:

- call `setupRelia` first, and wrap your server with `otelhttp.NewHandler(mux, "server")`;
- register routes with the card's `handle` helper, so each request carries its route template (`/orders/{id}`) and Relia shows one row per route, not one per order. With Gin, Echo or Chi, use their OpenTelemetry middleware (`otelgin`, `otelecho`, `otelchi`) instead;
- open databases with `otelsql.Open` plus `otelsql.WithAttributes(attribute.String("db.system", "postgresql"))` (or `mysql`, `sqlite`) so they show on the **Database** page;
- stop the server cleanly on a signal so the last requests are sent. `log.Fatal` skips that.

## Rust

Tested with `axum`. Install:

```bash
cargo add opentelemetry@0.33 opentelemetry_sdk@0.33 opentelemetry-http@0.33 tracing-opentelemetry@0.34 tracing tracing-subscriber
cargo add opentelemetry-otlp@0.33 --no-default-features --features http-proto,reqwest-blocking-client,trace
```

The versions are pinned on purpose: the Rust OpenTelemetry libraries change between minor versions. Pick **Rust** on the card, add the `src/relia.rs` it shows as it is, and add `mod relia;` to `main.rs`. Call `relia::init()` first, add `.layer(axum::middleware::from_fn(relia::trace_requests))` after your routes, serve with `.with_graceful_shutdown(relia::shutdown_signal())`, then call `provider.shutdown()` so the last requests are sent.

## Java and Kotlin

Spring Boot, Quarkus, Micronaut or plain Java, with no code change. Download the official agent and start your app with it:

```bash
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.33.1/opentelemetry-javaagent.jar
java -javaagent:opentelemetry-javaagent.jar -jar your-app.jar
```

Requests, database calls, outgoing calls and exceptions are recorded. Don't commit the jar (it's over 20 MB): download it in your Dockerfile or start script.

## .NET, Ruby and others

Use your language's official OpenTelemetry setup with the OTLP exporter over HTTP, and the same settings:

- **.NET**: the OpenTelemetry .NET automatic instrumentation.
- **Ruby**: `opentelemetry-sdk`, `opentelemetry-exporter-otlp` and `opentelemetry-instrumentation-all`.

## Good to know

- **One name per app:** give each app its own `OTEL_SERVICE_NAME`. Two apps under one name are mixed together.
- **Route templates matter:** a request should carry `http.route` (like `/orders/{id}`).
- **Who made a request:** set the span attributes `relia.user_id` and `relia.user_plan` (never an e-mail). See [Identify your users](https://tryrelia.com/docs/identify-users.md).
- **Database values:** Relia's own SDKs remove values from queries. With OpenTelemetry that depends on your library; placeholders (`$1`, `?`) keep values out.

## Check it worked

Open your project in Relia and go to the **Setup** tab. **Requests from your server** changes from *Not yet* to *Arriving*. Your requests and errors appear under **APIs**.

## If something's wrong

- **Nothing arrives:** the variables must be set in the environment of the running process, not in a `.env` file the app never reads.
- **The last requests before a stop are missing:** shut the tracer down when the app stops.
- **One row per id instead of per route:** the request spans don't carry `http.route`. In Go, use the `handle` helper.
- **Still "Not yet":** see [Relia shows no data](https://tryrelia.com/docs/no-data.md).

## Next

- [Set up Relia with your AI assistant](https://tryrelia.com/docs/setup-with-ai-assistant.md), which knows these steps too
- [Identify your users](https://tryrelia.com/docs/identify-users.md)
- [Monitor API requests and errors](https://tryrelia.com/docs/apis.md)

---
All Relia docs for AI assistants: https://tryrelia.com/llms.txt (index) · https://tryrelia.com/llms-full.txt (everything in one file)
