All Projects → salemove → Jaeger Client Ruby

salemove / Jaeger Client Ruby

Licence: mit
OpenTracing Tracer implementation for Jaeger in Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Jaeger Client Ruby

Zipkin Go Opentracing
OpenTracing Bridge for Zipkin Go
Stars: ✭ 472 (+700%)
Mutual labels:  distributed-tracing, trace, opentracing
Jaeger Ui
Web UI for Jaeger
Stars: ✭ 639 (+983.05%)
Mutual labels:  distributed-tracing, trace, opentracing
go-sensor
🚀 Go Distributed Tracing & Metrics Sensor for Instana
Stars: ✭ 90 (+52.54%)
Mutual labels:  trace, opentracing, distributed-tracing
post-kafka-opentracing
Post: Tracing Kafka Applications
Stars: ✭ 18 (-69.49%)
Mutual labels:  opentracing, distributed-tracing
zipkin-cpp-opentracing
OpenTracing Tracer implementation for Zipkin in C++
Stars: ✭ 46 (-22.03%)
Mutual labels:  trace, opentracing
ctrace-go
Canonical OpenTracing for GoLang
Stars: ✭ 12 (-79.66%)
Mutual labels:  trace, opentracing
Haystack
Top level repository for Haystack, containing documentation and deployment scripts
Stars: ✭ 261 (+342.37%)
Mutual labels:  distributed-tracing, opentracing
Opentracing Php
OpenTracing API for PHP
Stars: ✭ 407 (+589.83%)
Mutual labels:  distributed-tracing, opentracing
Zipkin Go
Zipkin tracer library for go
Stars: ✭ 435 (+637.29%)
Mutual labels:  distributed-tracing, trace
Inspectit
inspectIT is the leading Open Source APM (Application Performance Management) tool for analyzing your Java (EE) applications.
Stars: ✭ 513 (+769.49%)
Mutual labels:  trace, opentracing
Core
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.
Stars: ✭ 34 (-42.37%)
Mutual labels:  distributed-tracing, opentracing
Molten
php probe for zipkin and opentracing
Stars: ✭ 740 (+1154.24%)
Mutual labels:  trace, opentracing
ruby-sensor
💎 Ruby Distributed Tracing & Metrics Sensor for Instana
Stars: ✭ 23 (-61.02%)
Mutual labels:  opentracing, distributed-tracing
opentracing-utils
Convenient utilities for adding OpenTracing support in your python projects
Stars: ✭ 20 (-66.1%)
Mutual labels:  opentracing, distributed-tracing
zipkin-ruby-opentracing
OpenTracing Tracer implementation for Zipkin in Ruby
Stars: ✭ 15 (-74.58%)
Mutual labels:  trace, opentracing
easeagent
An agent component for the Java system
Stars: ✭ 437 (+640.68%)
Mutual labels:  opentracing, distributed-tracing
nodejs
Node.js in-process collectors for Instana
Stars: ✭ 66 (+11.86%)
Mutual labels:  opentracing, distributed-tracing
smallrye-opentracing
An MicroProfile-OpenTracing implementation
Stars: ✭ 17 (-71.19%)
Mutual labels:  opentracing, distributed-tracing
Jaeger Client Node
Jaeger Bindings for OpenTracing API for Node.js
Stars: ✭ 485 (+722.03%)
Mutual labels:  distributed-tracing, opentracing
Opencensus Java
A stats collection and distributed tracing framework
Stars: ✭ 640 (+984.75%)
Mutual labels:  distributed-tracing, trace

Jaeger::Client

Gem Version Build Status

OpenTracing Tracer implementation for Jaeger in Ruby

Installation

Add this line to your application's Gemfile:

gem 'jaeger-client'

Usage

require 'jaeger/client'
OpenTracing.global_tracer = Jaeger::Client.build(host: 'localhost', port: 6831, service_name: 'echo')

OpenTracing.start_active_span('span name') do
  # do something

  OpenTracing.start_active_span('inner span name') do
    # do something else
  end
end

# don't kill the program too soon, allow time for the background reporter to send the traces
sleep 2

See opentracing-ruby for more examples.

Reporters

RemoteReporter (default)

RemoteReporter buffers spans in memory and sends them out of process using Sender.

There are two senders: UdpSender (default) and HttpSender.

To use HttpSender:

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  reporter: Jaeger::Reporters::RemoteReporter.new(
    sender: Jaeger::HttpSender.new(
      url: 'http://localhost:14268/api/traces',
      headers: { 'key' => 'value' }, # headers key is optional
      encoder: Jaeger::Encoders::ThriftEncoder.new(service_name: 'service_name')
    ),
    flush_interval: 10
  )
)

NullReporter

NullReporter ignores all spans.

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  reporter: Jaeger::Reporters::NullReporter.new
)

LoggingReporter

LoggingReporter prints some details about the span using logger. This is meant only for debugging. Do not parse and use this information for anything critical. The implemenation can change at any time.

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  reporter: Jaeger::Reporters::LoggingReporter.new
)

LoggingReporter can also use a custom logger. For this provide logger using logger keyword argument.

Samplers

Const sampler

Const sampler always makes the same decision for new traces depending on the initialization value. Set sampler to: Jaeger::Samplers::Const.new(true) to mark all new traces as sampled.

Probabilistic sampler

Probabilistic sampler samples traces with probability equal to rate (must be between 0.0 and 1.0). This can be enabled by setting Jaeger::Samplers::Probabilistic.new(rate: 0.1)

RateLimiting sampler

RateLimiting sampler samples at most max_traces_per_second. The distribution of sampled traces follows burstiness of the service, i.e. a service with uniformly distributed requests will have those requests sampled uniformly as well, but if requests are bursty, especially sub-second, then a number of sequential requests can be sampled each second.

Set sampler to Jaeger::Samplers::RateLimiting.new(max_traces_per_second: 100)

GuaranteedThroughputProbabilistic sampler

GuaranteedThroughputProbabilistic is a sampler that guarantees a throughput by using a Probabilistic sampler and RateLimiting sampler The RateLimiting sampler is used to establish a lower_bound so that every operation is sampled at least once in the time interval defined by the lower_bound.

Set sampler to Jaeger::Samplers::GuaranteedThroughputProbabilistic.new(lower_bound: 10, rate: 0.001)

PerOperation sampler

PerOperation sampler leverages both Probabilistic sampler and RateLimiting sampler via the GuaranteedThroughputProbabilistic sampler. This sampler keeps track of all operations and delegates calls the the respective GuaranteedThroughputProbabilistic sampler.

Set sampler to

  Jaeger::Samplers::PerOperation.new(
    strategies: {
      per_operation_strategies: [
        { operation: 'GET /articles', probabilistic_sampling: { sampling_rate: 0.5 } },
        { operation: 'POST /articles', probabilistic_sampling: { sampling_rate: 1.0 } }
      ],
      default_sampling_probability: 0.001,
      default_lower_bound_traces_per_second: 1.0 / (10.0 * 60.0)
    },
    max_operations: 1000
  )

RemoteControlled sampler

RemoteControlled sampler is a sampler that is controller by jaeger agent. It starts out with Probabilistic sampler. It polls the jaeger-agent and changes sampling strategy accordingly. Set sampler to Jaeger::Client::Samplers::RemoteControlled.new(service_name: 'service_name').

RemoteControlled sampler options:

Param Required Description
service_name x name of the current service / application, same as given to Tracer
sampler initial sampler to use prior to retrieving strategies from Agent
refresh_interval interval in seconds before sampling strategy refreshes (0 to not refresh, defaults to 60)
host host for jaeger-agent (defaults to 'localhost')
port port for jaeger-agent for SamplingManager endpoint (defaults to 5778)
logger logger for communication between jaeger-agent (default to $stdout logger)

TraceContext compatible header propagation

It is possible to use W3C Trace Context headers to propagate the tracing information.

To set it up you need to change FORMAT_RACK injector and extractor.

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  injectors: {
    OpenTracing::FORMAT_RACK => [Jaeger::Injectors::TraceContextRackCodec]
  },
  extractors: {
    OpenTracing::FORMAT_RACK => [Jaeger::Extractors::TraceContextRackCodec]
  }
)

Zipkin HTTP B3 compatible header propagation

Jaeger Tracer supports Zipkin B3 Propagation HTTP headers, which are used by a lot of Zipkin tracers. This means that you can use Jaeger in conjunction with OpenZipkin tracers.

To set it up you need to change FORMAT_RACK injector and extractor.

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  injectors: {
    OpenTracing::FORMAT_RACK => [Jaeger::Injectors::B3RackCodec]
  },
  extractors: {
    OpenTracing::FORMAT_RACK => [Jaeger::Extractors::B3RackCodec]
  }
)

It's also possible to set up multiple injectors and extractors. Each injector will be called in sequence. Note that if multiple injectors are using the same keys then the values will be overwritten.

If multiple extractors is used then the span context from the first match will be returned.

Process Tags

Jaeger Tracer allows you to define process level tags. By default the tracer provides jaeger.version, ip and hostname. You may want to overwrite ip or hostname if the tracer cannot auto-detect them.

OpenTracing.global_tracer = Jaeger::Client.build(
  service_name: 'service_name',
  tags: {
    'hostname' => 'custom-hostname',
    'custom_tag' => 'custom-tag-value'
  }
)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/salemove/jaeger-client-ruby

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].