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

# Java

> Java setup and configuration for ClickHouse Observability and self-managed deployments.

Use the OpenTelemetry Java agent or SDK to send logs, metrics, and traces to ClickHouse Observability.

This guide integrates:

## Set up OpenTelemetry

Follow the official [OpenTelemetry Java agent setup instructions](https://opentelemetry.io/docs/zero-code/java/agent/getting-started/) to install instrumentation and configure your application. For manual instrumentation, use the [Java SDK documentation](https://opentelemetry.io/docs/languages/java/instrumentation/).

Configure [OTLP export](https://opentelemetry.io/docs/languages/java/configuration/#properties-exporters) for the signals you want to send, using the connection settings below. Replace any example destinations from the upstream instructions, including signal-specific endpoint overrides.

## Configure your destination

> [tab] Fully managed
>
> [Beta offering](https://clickhouse.com/docs/reference/settings/beta-and-experimental-features.md#beta-features)
>
> Open **Team Settings → Data → Managed Telemetry** in your service and copy the **OTLP HTTP endpoint** and **API key**. Use the complete HTTPS endpoint, including its port:
>
> ```shell theme={null}
> export OTEL_EXPORTER_OTLP_ENDPOINT='https://YOUR_OTEL_ENDPOINT:4318'
> export OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer%20YOUR_INGESTION_API_KEY'
> export OTEL_EXPORTER_OTLP_PROTOCOL='http/protobuf'
> ```

> [tab] Self-managed
>
> Use your collector's OTLP HTTP endpoint and ingestion key. Use `http://` instead of `https://` if your collector does not have TLS configured. For collector setup, see [Ingesting with OpenTelemetry](https://clickhouse.com/docs/clickstack/observability/ingesting-data/opentelemetry.md#sending-otel-data-self-configured).
>
> ```shell theme={null}
> export OTEL_EXPORTER_OTLP_ENDPOINT='https://YOUR_COLLECTOR_HOST:4318'
> export OTEL_EXPORTER_OTLP_HEADERS='authorization=YOUR_INGESTION_API_KEY'
> export OTEL_EXPORTER_OTLP_PROTOCOL='http/protobuf'
> ```

## Verify ingestion

Start your instrumented application and generate activity. In ClickHouse Observability, select a recent time range and find your application's service name in Logs or Traces. If your application emits metrics, check Metrics after allowing time for export.

For instrumentation and exporter troubleshooting, see the [OpenTelemetry Java agent troubleshooting guidance](https://opentelemetry.io/docs/zero-code/java/agent/getting-started/#troubleshooting).
