Tracing

GreptimeDB supports distributed tracing. GreptimeDB exports all collected spans using the gRPC-based OTLP protocol. Users can use Jaeger, Tempo and other OTLP protocol backends that support gRPC to collect the span instrument by GreptimeDB.

In the logging section in the configuration, there are descriptions of configuration items related to tracing, standalone.example.toml provide a reference configuration in the logging section.

Tutorial: Use Jaeger to trace GreptimeDB

Jaeger is an open source, end-to-end distributed tracing system, originally developed and open sourced by Uber. Its goal is to help developers monitor and debug the request flow in complex microservice architectures.

Jaeger supports gRPC-based OTLP protocol, so GreptimeDB can export trace data to Jaeger. The following tutorial shows you how to deploy and use Jaeger to track GreptimeDB.

Step 1: Deploy Jaeger

Start a Jaeger instance using the all-in-one docker image officially provided by jaeger:

bash

  1. docker run --rm -d --name jaeger \
  2. -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  3. -p 6831:6831/udp \
  4. -p 6832:6832/udp \
  5. -p 5778:5778 \
  6. -p 16686:16686 \
  7. -p 4317:4317 \
  8. -p 4318:4318 \
  9. -p 14250:14250 \
  10. -p 14268:14268 \
  11. -p 14269:14269 \
  12. -p 9411:9411 \
  13. jaegertracing/all-in-one:latest

Step 2: Deploy GreptimeDB

Write configuration files to allow GreptimeDB to perform tracing. Save the following configuration items as the file config.toml

Toml

  1. [logging]
  2. enable_otlp_tracing = true

Then start GreptimeDB using standalone mode

bash

  1. greptime standalone start -c config.toml

Refer to the chapter Mysql on how to connect to GreptimeDB. Run the following SQL statement in Mysql Client:

sql

  1. CREATE TABLE host (
  2. ts timestamp(3) time index,
  3. host STRING PRIMARY KEY,
  4. val BIGINT,
  5. );
  6. INSERT INTO TABLE host VALUES
  7. (0, 'host1', 0),
  8. (20000, 'host2', 5);
  9. SELECT * FROM host ORDER BY ts;
  10. DROP TABLE host;

Step 3: Obtain trace information in Jaeger

  1. Go to http://127.0.0.1:16686/ and select the Search tab.
  2. Select the greptime-standalone service in the service drop-down list.
  3. Click Find Traces to display trace information.

JaegerUI

Select-tracing