Getting started with Uptrace and OpenTelemetry

UptraceGetting started - 图1open in new window is a distributed tracing tool that uses OpenTelemetry to collect data and ClickHouse database to store it. It is a self-hosted version of Uptrace CloudGetting started - 图2open in new window.

Uptrace

To get started with Uptrace, you need to:

  1. Create ClickHouse database.
  2. Install Uptrace binary.
  3. Start sending data using OpenTelemetry distro for Uptrace.

ClickHouse

Uptrace requires ClickHouse database to store telemetry data. After installingGetting started - 图4open in new window ClickHouse, you can create uptrace database like this:

  1. clickhouse-client -q "CREATE DATABASE uptrace"

When started, Uptrace will connect to the ClickHouse database specified in uptrace.yml config and will automatically create required tables and views.

Installation

Packages

Uptrace provides DEB and RPM packages for Linux amd64/arm64 systems. After installing an approriate package, you will have:

  • Uptrace binary at /usr/bin/uptrace.
  • Uptrace config at /etc/uptrace/uptrace.yml.
  • Systemd service at /lib/systemd/system/uptrace.service.
  • Environment file used by the systemd service at /etc/uptrace/uptrace.conf.

To check the status of Uptrace service:

  1. sudo systemctl status uptrace

To restart Uptrace:

  1. sudo systemctl restart uptrace

To view Uptrace logs:

  1. sudo journalctl -u uptrace -f

DEB

To install Debian package, run the following command replacing 0.2.13 with the desired version and amd64 with the desired architecture:

  1. wget https://github.com/uptrace/uptrace/releases/download/v0.2.13/uptrace_0.2.13_amd64.deb
  2. sudo dpkg -i uptrace_0.2.13_amd64.deb

RPM

To install Debian package, run the following command replacing 0.2.13 with the desired version and x86_64 with the desired architecture:

  1. wget https://github.com/uptrace/uptrace/releases/download/v0.2.13/uptrace-0.2.13-1.x86_64.rpm
  2. sudo rpm -ivh uptrace-0.2.13-1.x86_64.rpm

Binaries

Alternatively, instead of installing DEB or RPM packages, you can downloadGetting started - 图5open in new window a pre-compiled binary and install Uptrace manually.

Linux

Download Linux binary:

  1. wget -O ./uptrace https://github.com/uptrace/uptrace/releases/download/v0.2.13/uptrace_linux_amd64
  2. chmod +x ./uptrace

Download Uptrace config:

  1. wget https://raw.githubusercontent.com/uptrace/uptrace/master/config/uptrace.yml

Start Uptrace:

  1. ./uptrace --config=uptrace.yml serve

MacOS

Download MacOS binary:

  1. wget -O uptrace https://github.com/uptrace/uptrace/releases/download/v0.2.13/uptrace_darwin_amd64
  2. chmod +x uptrace

Download Uptrace config:

  1. wget https://raw.githubusercontent.com/uptrace/uptrace/master/config/uptrace.yml

Start Uptrace:

  1. ./uptrace --config=uptrace.yml serve

You may need to update ClickHouse connection string in uptrace.yml using ch.dsn option.

Other

Check GitHub ReleasesGetting started - 图6open in new window for pre-compiled binaries for other platforms.

Start sending data

To start receiving data, you need to install OpenTelemetry distroGetting started - 图7open in new window configured to work with Uptrace. Uptrace uses OpenTelemetry protocol (OTLP) to receive telemetry data, for example, spansGetting started - 图8open in new window, errors, and logs. As a transport protocol, OTLP can use gRPC (OTLP/gRPC) or HTTP (OTLP/HTTP).

Uptrace supports OTLP/gRPC on the port 14317 and OTLP/HTTP on the port 14318. The port is specified in the Uptrace DSN that you will receive after installing Uptrace, for example:

  1. # OTLP/gRPC
  2. UPTRACE_DSN=http://project2_secret_token@localhost:14317/2
  3. # OTLP/HTTP
  4. UPTRACE_DSN=http://project2_secret_token@localhost:14318/2
ClientProtocolPort
uptrace-goGetting started - 图9open in new windowOTLP/gRPC14317
uptrace-dotnetGetting started - 图10open in new windowOTLP/gRPC14317
uptrace-pythonGetting started - 图11open in new windowOTLP/gRPC14317
uptrace-nodeGetting started - 图12open in new windowOTLP/HTTP14318
uptrace-rubyGetting started - 图13open in new windowOTLP/HTTP14318

For example, to run basic Go exampleGetting started - 图14open in new window, you need to use OTLP/gRPC and port 14317:

  1. UPTRACE_DSN=http://<project_token>:localhost:14317/<project_id> go run .

But to run basic Node.js exampleGetting started - 图15open in new window, you need to use OTLP/HTTP and port 14318:

  1. UPTRACE_DSN=http://<project_token>:localhost:14318/<project_id> node main.js

You can also try tutorials for the most popular frameworks:

Getting started - 图16

Gin and GORM

Getting started - 图17

Django

Getting started - 图18

Flask and SQLAlchemy

Getting started - 图19

Rails

OpenTelemetry Collector

If you are already using OpenTelemetry CollectorGetting started - 图20open in new window, you can configure it to send data to Uptrace:

  • gRPC
  • HTTP
  1. exporters:
  2. otlp:
  3. endpoint: http://localhost:14317
  4. tls:
  5. insecure: true
  6. headers:
  7. uptrace-dsn: 'http://<project_token>:localhost:14317/<project_id>'
  1. exporters:
  2. otlphttp:
  3. endpoint: http://localhost:14318
  4. tls:
  5. insecure: true
  6. headers:
  7. uptrace-dsn: 'http://<project_token>:localhost:14318/<project_id>'

GitHub notifications

You can enable GitHub notificationsGetting started - 图21open in new window to receive an email when a new Uptrace version is released.

You can also consider subscribing to the newsletterGetting started - 图22open in new window to receive latest updates about OpenTelemetry and Uptrace.

What’s next?

Next, you can browse instrumentationsGetting started - 图23open in new window to find examples for your framework and libraries or learn about OpenTelemetry API to create your own instrumentations.

Getting started - 图24

Go

Getting started - 图25

Python

Getting started - 图26

Ruby

Getting started - 图27

JavaScript

Getting started - 图28

.NET