rails_distributed_tracing 1.0 → 1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abe92b91367b21afe0d77aec53d6da1ee5e9603dfdff83d3e688cb88a838ede1
4
- data.tar.gz: 6eefcd8908103da02b797d49fd9e6111ad370b12d7c6e40ac924614873c80d5a
3
+ metadata.gz: 7c03c3da36fae25984aad08f2dc583d18fe84f7f35baedc9cc7bc984a81bb1b8
4
+ data.tar.gz: dd040f49222c180f46c22237d9aadb7f4a09297cf82037572f6f9f5492d52cad
5
5
  SHA512:
6
- metadata.gz: 335b44ade75fdd58e21b463bb7414f05944de229bb1feed0f94e92e1aa32c72b512de08cbcf22e2e6a72c606c07a83d42ff2c88c679d588998efbe77a20fa37a
7
- data.tar.gz: f2f949f706b90c500f8ac7b20d604fc6bd4a558f1ea0c2607023b60b6a836e279cda5767c5cfe179190ba7b87d9e9352dc67f1b3368b1de58ed82f5da78cebaa
6
+ metadata.gz: 2bbefef2c8826bb340e7abddc2f329979e4e0f07c20260b18e5a531732d9e5d880e2e874e9e4779a312deab5d27976eaf33792bac957137b807907d919394640
7
+ data.tar.gz: 6ecbe55d6295e67a33c6e084d306f587863a30f37bed8caee6aa6b82124561ad2b10727e51674f72405a63c515224f323f07d547eea42600fb5282b5570a598b
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # rails_distributed_tracing
2
2
  Distributed tracing for rails microservices
3
3
 
4
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/ajitsing/rails_distributed_tracing/graphs/commit-activity)
4
5
  [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://opensource.org/licenses/MIT)
5
6
  [![Gem Version](https://badge.fury.io/rb/rails_distributed_tracing.svg)](https://badge.fury.io/rb/rails_distributed_tracing)
7
+ [![HitCount](http://hits.dwyl.io/ajitsing/rails_distributed_tracing.svg)](http://hits.dwyl.io/ajitsing/rails_distributed_tracing)
6
8
  ![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/rails_distributed_tracing?type=total)
7
9
  [![Build Status](https://travis-ci.org/ajitsing/rails_distributed_tracing.svg?branch=master)](https://travis-ci.org/ajitsing/rails_distributed_tracing)
8
10
  [![Twitter Follow](https://img.shields.io/twitter/follow/Ajit5ingh.svg?style=social)](https://twitter.com/Ajit5ingh)
@@ -21,7 +23,7 @@ If the service is origin service, `DistributedTracing.request_id_tag` will creat
21
23
  require 'rails_distributed_tracing'
22
24
 
23
25
  class Application < Rails::Application
24
- config.log_tags = [DistributedTracing.request_id_tag]
26
+ config.log_tags = [DistributedTracing.log_tag]
25
27
  end
26
28
  ```
27
29
 
@@ -41,20 +43,41 @@ source service should always pass the request id to the destination service.
41
43
  When a request id is generated `rails_distributed_tracing` holds that request id till the request returns the response. You can access that request_id anywhere in your application code with the help of below APIs.
42
44
 
43
45
  ```ruby
44
- DistributedTracing.current_request_id
46
+ DistributedTracing.trace_id
47
+ #=> '8ed7e37b-94e8-4875-afb4-6b4cf1783817'
45
48
  ```
46
49
 
47
- or you can directly get it as a request header
50
+ ## Sidekiq
51
+ ```ruby
52
+ Sidekiq.configure_server do |config|
53
+ config.server_middleware do |chain|
54
+ chain.add DistributedTracing::SidekiqMiddleware::Server
55
+ end
56
+ end
57
+
58
+ Sidekiq.configure_client do |config|
59
+ config.client_middleware do |chain|
60
+ chain.add DistributedTracing::SidekiqMiddleware::Client
61
+ end
62
+ end
63
+ ```
48
64
 
65
+ ## Faraday
49
66
  ```ruby
50
- DistributedTracing.request_id_header
51
- #=> {'Request-ID' => '8ed7e37b-94e8-4875-afb4-6b4cf1783817'}
67
+ connection = Faraday.new("http://google.com/") do |conn|
68
+ conn.use DistributedTracing::FaradayMiddleware
69
+ end
52
70
  ```
53
71
 
54
- The gem will automatically pick the `Request-ID` header from your request and use it as log tag.
72
+ Make sure that faraday and sidekiq gems are loaded before `rails_distributed_tracing`. Otherwise rails_distributed_tracing will not load the faraday and sidekiq related classes.
55
73
 
56
- Note: Make sure that you always pass the current request id and not the stale one.
74
+ To ensure that `sidekiq` and `faraday` are loaded before `rails_distributed_tracing`, add sidekiq and faraday gem before rails_distributed_tracing in Gemfile. So that when rails load the Gemfile, sidekiq and faraday loaded before rails_distributed_tracing gem.
57
75
 
76
+ ## Other
77
+ Add below headers to the outgoing request headers.
78
+ ```ruby
79
+ {DistributedTracing::TRACE_ID => DistributedTracing.trace_id}
80
+ ```
58
81
 
59
82
  ## Contributing
60
83
 
@@ -1,7 +1,7 @@
1
1
  require 'rails_distributed_tracing/trace_id_store'
2
2
 
3
3
  module DistributedTracing
4
- TRACE_ID = 'Request-ID'.freeze
4
+ TRACE_ID = 'X-Request-Id'.freeze
5
5
 
6
6
  def self.log_tag
7
7
  lambda do |request|
@@ -1,3 +1,3 @@
1
1
  module DistributedTracing
2
- VERSION = '1.0'
2
+ VERSION = '1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_distributed_tracing
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajit Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-18 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler