lhc 9.1.0 → 9.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 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f7fc2900acc370686fd4e81991eba4fa9cab42f9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b0e58a468ab2d7aebb40f19c7dd9b95be98d0bc3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: '089c956a35151c69a06dd0129e23c839e171a466f6142584f19eef0887b996e7741f416875c0082bac238079c901954f7049d77bf859090ee1b420d97bfb26a0'
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5504b40f3fd71c6f51c1c51b11052d216ba706dffff2ae9dfc1d67cad2e370399972afa5da6a2c7f1144ed462135479a4c379a80fd7360c318b8ae364ab10384
         
     | 
| 
         @@ -11,13 +11,16 @@ class LHC::Zipkin < LHC::Interceptor 
     | 
|
| 
       11 
11 
     | 
    
         
             
              def before_request
         
     | 
| 
       12 
12 
     | 
    
         
             
                return unless dependencies?
         
     | 
| 
       13 
13 
     | 
    
         
             
                ZipkinTracer::TraceContainer.with_trace_id(trace_id) do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # add headers even if the current trace_id should not be sampled
         
     | 
| 
       14 
15 
     | 
    
         
             
                  B3_HEADERS.each { |method, header| request.headers[header] = trace_id.send(method).to_s }
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # only sample the current call if we're instructed to do so
         
     | 
| 
       15 
17 
     | 
    
         
             
                  start_trace! if ::Trace.tracer && trace_id.sampled?
         
     | 
| 
       16 
18 
     | 
    
         
             
                end
         
     | 
| 
       17 
19 
     | 
    
         
             
              end
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
              def after_response
         
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
      
 22 
     | 
    
         
            +
                # only sample the current call if we're instructed to do so
         
     | 
| 
      
 23 
     | 
    
         
            +
                return unless dependencies? && trace_id.sampled?
         
     | 
| 
       21 
24 
     | 
    
         
             
                end_trace!
         
     | 
| 
       22 
25 
     | 
    
         
             
              end
         
     | 
| 
       23 
26 
     | 
    
         | 
| 
         @@ -39,6 +42,7 @@ class LHC::Zipkin < LHC::Interceptor 
     | 
|
| 
       39 
42 
     | 
    
         
             
                @trace_id ||= ZipkinTracer::TraceGenerator.new.next_trace_id
         
     | 
| 
       40 
43 
     | 
    
         
             
              end
         
     | 
| 
       41 
44 
     | 
    
         | 
| 
      
 45 
     | 
    
         
            +
              # register a new span with zipkin tracer
         
     | 
| 
       42 
46 
     | 
    
         
             
              def span
         
     | 
| 
       43 
47 
     | 
    
         
             
                @span ||= ::Trace.tracer.start_span(trace_id, url.path)
         
     | 
| 
       44 
48 
     | 
    
         
             
              end
         
     | 
    
        data/lib/lhc/version.rb
    CHANGED
    
    
| 
         @@ -13,7 +13,7 @@ describe LHC::Zipkin do 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    trace_id: 'trace_id',
         
     | 
| 
       14 
14 
     | 
    
         
             
                    parent_id: 'parent_id',
         
     | 
| 
       15 
15 
     | 
    
         
             
                    span_id: 'span_id',
         
     | 
| 
       16 
     | 
    
         
            -
                    sampled:  
     | 
| 
      
 16 
     | 
    
         
            +
                    sampled: true,
         
     | 
| 
       17 
17 
     | 
    
         
             
                    flags: 'flags'
         
     | 
| 
       18 
18 
     | 
    
         
             
                  )
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
         @@ -23,7 +23,7 @@ describe LHC::Zipkin do 
     | 
|
| 
       23 
23 
     | 
    
         
             
                  expect(headers['X-B3-TraceId']).to eq('trace_id')
         
     | 
| 
       24 
24 
     | 
    
         
             
                  expect(headers['X-B3-ParentSpanId']).to eq('parent_id')
         
     | 
| 
       25 
25 
     | 
    
         
             
                  expect(headers['X-B3-SpanId']).to eq('span_id')
         
     | 
| 
       26 
     | 
    
         
            -
                  expect(headers['X-B3-Sampled']).to eq(' 
     | 
| 
      
 26 
     | 
    
         
            +
                  expect(headers['X-B3-Sampled']).to eq('true')
         
     | 
| 
       27 
27 
     | 
    
         
             
                  expect(headers['X-B3-Flags']).to eq('flags')
         
     | 
| 
       28 
28 
     | 
    
         
             
                end
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
         @@ -49,4 +49,60 @@ describe LHC::Zipkin do 
     | 
|
| 
       49 
49 
     | 
    
         
             
                  expect(headers['X-B3-Flags']).to be_nil
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         
             
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              describe 'creating new spans' do
         
     | 
| 
      
 54 
     | 
    
         
            +
                context 'sampled? is false' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  before(:all) do
         
     | 
| 
      
 56 
     | 
    
         
            +
                    ::ZipkinTracer::TraceContainer.setup_mock(
         
     | 
| 
      
 57 
     | 
    
         
            +
                      trace_id: 'trace_id',
         
     | 
| 
      
 58 
     | 
    
         
            +
                      parent_id: 'parent_id',
         
     | 
| 
      
 59 
     | 
    
         
            +
                      span_id: 'span_id',
         
     | 
| 
      
 60 
     | 
    
         
            +
                      sampled: false,
         
     | 
| 
      
 61 
     | 
    
         
            +
                      flags: 'flags'
         
     | 
| 
      
 62 
     | 
    
         
            +
                    )
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  it 'adds the proper X-B3 headers' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    headers = LHC.get(:local).request.headers
         
     | 
| 
      
 67 
     | 
    
         
            +
                    expect(headers['X-B3-TraceId']).to eq('trace_id')
         
     | 
| 
      
 68 
     | 
    
         
            +
                    expect(headers['X-B3-ParentSpanId']).to eq('parent_id')
         
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(headers['X-B3-SpanId']).to eq('span_id')
         
     | 
| 
      
 70 
     | 
    
         
            +
                    expect(headers['X-B3-Sampled']).to eq('false')
         
     | 
| 
      
 71 
     | 
    
         
            +
                    expect(headers['X-B3-Flags']).to eq('flags')
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                  it 'does not register a new span' do
         
     | 
| 
      
 75 
     | 
    
         
            +
                    # ensure no span was registered, by checking no call on span
         
     | 
| 
      
 76 
     | 
    
         
            +
                    expect_any_instance_of(described_class).not_to receive(:span).and_call_original
         
     | 
| 
      
 77 
     | 
    
         
            +
                    LHC.get(:local)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                context 'sampled? is true' do
         
     | 
| 
      
 82 
     | 
    
         
            +
                  before(:all) do
         
     | 
| 
      
 83 
     | 
    
         
            +
                    ::ZipkinTracer::TraceContainer.setup_mock(
         
     | 
| 
      
 84 
     | 
    
         
            +
                      trace_id: 'trace_id',
         
     | 
| 
      
 85 
     | 
    
         
            +
                      parent_id: 'parent_id',
         
     | 
| 
      
 86 
     | 
    
         
            +
                      span_id: 'span_id',
         
     | 
| 
      
 87 
     | 
    
         
            +
                      sampled: true,
         
     | 
| 
      
 88 
     | 
    
         
            +
                      flags: 'flags'
         
     | 
| 
      
 89 
     | 
    
         
            +
                    )
         
     | 
| 
      
 90 
     | 
    
         
            +
                  end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                  it 'adds the proper X-B3 headers' do
         
     | 
| 
      
 93 
     | 
    
         
            +
                    headers = LHC.get(:local).request.headers
         
     | 
| 
      
 94 
     | 
    
         
            +
                    expect(headers['X-B3-TraceId']).to eq('trace_id')
         
     | 
| 
      
 95 
     | 
    
         
            +
                    expect(headers['X-B3-ParentSpanId']).to eq('parent_id')
         
     | 
| 
      
 96 
     | 
    
         
            +
                    expect(headers['X-B3-SpanId']).to eq('span_id')
         
     | 
| 
      
 97 
     | 
    
         
            +
                    expect(headers['X-B3-Sampled']).to eq('true')
         
     | 
| 
      
 98 
     | 
    
         
            +
                    expect(headers['X-B3-Flags']).to eq('flags')
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  it 'does register a new span' do
         
     | 
| 
      
 102 
     | 
    
         
            +
                    # ensure a span was registered, by checking call on span
         
     | 
| 
      
 103 
     | 
    
         
            +
                    expect_any_instance_of(described_class).to receive(:span).at_least(1).times.and_call_original
         
     | 
| 
      
 104 
     | 
    
         
            +
                    LHC.get(:local)
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
      
 106 
     | 
    
         
            +
                end
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
       52 
108 
     | 
    
         
             
            end
         
     | 
    
        data/spec/support/zipkin_mock.rb
    CHANGED
    
    | 
         @@ -42,7 +42,7 @@ module ZipkinTracer 
     | 
|
| 
       42 
42 
     | 
    
         
             
                end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                def sampled
         
     | 
| 
       45 
     | 
    
         
            -
                   
     | 
| 
      
 45 
     | 
    
         
            +
                  ZipkinTracer::TraceContainer.current.sampled
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                def flags
         
     | 
| 
         @@ -50,7 +50,7 @@ module ZipkinTracer 
     | 
|
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                def sampled?
         
     | 
| 
       53 
     | 
    
         
            -
                   
     | 
| 
      
 53 
     | 
    
         
            +
                  ZipkinTracer::TraceContainer.current.sampled
         
     | 
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         
             
              end
         
     | 
| 
       56 
56 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: lhc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 9.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 9.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - https://github.com/local-ch/lhc/contributors
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-03-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: typhoeus
         
     | 
| 
         @@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       368 
368 
     | 
    
         
             
            requirements:
         
     | 
| 
       369 
369 
     | 
    
         
             
            - Ruby >= 2.0.0
         
     | 
| 
       370 
370 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       371 
     | 
    
         
            -
            rubygems_version: 2.6. 
     | 
| 
      
 371 
     | 
    
         
            +
            rubygems_version: 2.6.14
         
     | 
| 
       372 
372 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       373 
373 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       374 
374 
     | 
    
         
             
            summary: LocalHttpClient
         
     |