ca464b6033
This change allows the GitLab rails and sidekiq components to receive tracing spans from upstream services such as Workhorse and pass these spans on to downstream services including Gitaly and Sidekiq. This change will also emit traces for incoming and outgoing requests using the propagated trace information. This will allow operators and engineers to view traces across the Workhorse, GitLab Rails, Sidekiq and Gitaly components. Additional intra-service instrumentation will be added in future changes.
47 lines
1.4 KiB
Ruby
47 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'fast_spec_helper'
|
|
|
|
describe Gitlab::Tracing::GRPCInterceptor do
|
|
subject { described_class.instance }
|
|
|
|
shared_examples_for "a grpc interceptor method" do
|
|
let(:custom_error) { Class.new(StandardError) }
|
|
|
|
it 'yields' do
|
|
expect { |b| method.call(kwargs, &b) }.to yield_control
|
|
end
|
|
|
|
it 'propagates exceptions' do
|
|
expect { method.call(kwargs) { raise custom_error } }.to raise_error(custom_error)
|
|
end
|
|
end
|
|
|
|
describe '#request_response' do
|
|
let(:method) { subject.method(:request_response) }
|
|
let(:kwargs) { { request: {}, call: {}, method: 'grc_method', metadata: {} } }
|
|
|
|
it_behaves_like 'a grpc interceptor method'
|
|
end
|
|
|
|
describe '#client_streamer' do
|
|
let(:method) { subject.method(:client_streamer) }
|
|
let(:kwargs) { { requests: [], call: {}, method: 'grc_method', metadata: {} } }
|
|
|
|
it_behaves_like 'a grpc interceptor method'
|
|
end
|
|
|
|
describe '#server_streamer' do
|
|
let(:method) { subject.method(:server_streamer) }
|
|
let(:kwargs) { { request: {}, call: {}, method: 'grc_method', metadata: {} } }
|
|
|
|
it_behaves_like 'a grpc interceptor method'
|
|
end
|
|
|
|
describe '#bidi_streamer' do
|
|
let(:method) { subject.method(:bidi_streamer) }
|
|
let(:kwargs) { { requests: [], call: {}, method: 'grc_method', metadata: {} } }
|
|
|
|
it_behaves_like 'a grpc interceptor method'
|
|
end
|
|
end
|