jaegercat

Crates.iojaegercat
lib.rsjaegercat
version0.2.1
sourcesrc
created_at2018-01-31 05:49:51.029173
updated_at2024-06-11 23:55:12.607742
descriptionA handy command line tool showing traces emitted by Jaeger clients
homepagehttps://github.com/sile/jaegercat
repositoryhttps://github.com/sile/jaegercat
max_upload_size
id48978
size41,352
Takeru Ohta (sile)

documentation

README

jaegercat

jaegercat Documentation License: MIT

A handy command line tool showing traces emitted by Jaeger clients.

Install

Precompiled binaries

A precompiled binary for Linux environment is available in the releases page.

$ curl -L https://github.com/sile/jaegercat/releases/download/0.1.1/jaegercat-0.1.1.linux -o jaegercat
$ chmod +x jaegercat
$ ./jaegercat -h
jaegercat 0.1.1

USAGE:
    jaegercat [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --binary-thrift-port <BINARY_THRIFT_PORT>       [default: 6832]
        --compact-thrift-port <COMPACT_THRIFT_PORT>     [default: 6831]
    -f, --format <FORMAT>                               [default: json]  [values: raw, json, json-pretty]
        --log-level <LOG_LEVEL>                         [default: info]  [values: debug, info, error]
    -b, --udp-buffer-size <UDP_BUFFER_SIZE>             [default: 65000]

Using Cargo

If you have already installed Cargo, you can install jaegercat easily in the following command:

$ cargo install jaegercat

Examples

Basic Usage

Starts jaegercat in a terminal:

$ jaegercat
Jan 31 14:18:06.989 INFO UDP server started, port: 6831
Jan 31 14:18:06.990 INFO UDP server started, port: 6832

Emits a trace in another terminal:

$ git clone https://github.com/sile/rustracing_jaeger.git
$ cd rustracing_jaeger
$ cargo run --example report

jaegercat will output a JSON like the following:

$ jaegercat
{"emit_batch":{"process":{"service_name":"example","tags":{"hello":"world","hostname":"DESKTOP-FJQCKIF","jaeger.version":"rustracing_jaeger-0.1.3"}},"spans":[{"trace_id":"0x154050ce43d48b612ae64ad7cd070e8e","span_id":"0x4c123d1fd41219d5","parent_span_id":"0x87a5fd207c065420","operation_name":"sub","references":[{"ChildOf":{"trace_id":"0x154050ce43d48b612ae64ad7cd070e8e","span_id":"0x87a5fd207c065420"}}],"flags":1,"start_datetime":"2018-01-31 14:24:18","start_unixtime":1517376258.665418,"duration":0.010196,"tags":{"foo":"bar"},"logs":[{"datetime":"2018-01-31 14:24:18","unixtime":1517376258.665475,"fields":{"event":"error","message":"something wrong"}}]},{"trace_id":"0x154050ce43d48b612ae64ad7cd070e8e","span_id":"0x87a5fd207c065420","operation_name":"main","flags":1,"start_datetime":"2018-01-31 14:24:18","start_unixtime":1517376258.654844,"duration":0.020779}]}}

Using jq command

It is convenient to use jq command for processing the resulting JSON.

// Filter only spans whose operation name is "main".
$ jaegercat | jq '.emit_batch.spans[] | select(.operation_name == "main")'
{
  "trace_id": "0x3dfcffdfe5b53b1d1fb792d1fbea9f8b",
  "span_id": "0xeba0e30f2f2d6e51",
  "operation_name": "main",
  "flags": 1,
  "start_datetime": "2018-01-31 14:36:01",
  "start_unixtime": 1517376961.354905,
  "duration": 0.020933
}

References

Jaeger Data Model(IDL):

Commit count: 33

cargo fmt