From a79087a68bfa178366b0101a5bb60b129f5d7b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 18:14:41 +0100 Subject: [PATCH 01/15] feat(grpc): write the client tracing instrumentation in the interceptor manner --- .../lib/opentelemetry/instrumentation/grpc.rb | 7 +---- .../instrumentation/grpc/instrumentation.rb | 5 ++-- .../{client.rb => client_tracer.rb} | 3 ++- .../grpc/patches/client_stub.rb | 27 +++++++++++++++++++ ...opentelemetry-instrumentation-grpc.gemspec | 17 +++++++++--- 5 files changed, 47 insertions(+), 12 deletions(-) rename instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/{client.rb => client_tracer.rb} (95%) create mode 100644 instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb index 582b53fe3..130bad423 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb @@ -13,12 +13,6 @@ module Instrumentation # Contains the OpenTelemetry instrumentation for the gRPC gem module Grpc class Error < StandardError; end - - module_function - - def client_interceptor - Interceptors::Client.new - end end end end @@ -26,3 +20,4 @@ def client_interceptor require_relative "grpc/instrumentation" require_relative "grpc/interceptors/client" require_relative "grpc/version" +require_relative 'grpc/interceptors/client_tracer' diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/instrumentation.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/instrumentation.rb index 5287f44b8..c098d0d99 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/instrumentation.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/instrumentation.rb @@ -24,11 +24,12 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base private def patch - ::GRPC::ClientInterceptor.prepend(Interceptors::Client) + ::GRPC::ClientStub.prepend(Patches::ClientStub) end def require_dependencies - require_relative "interceptors/client" + require_relative 'interceptors/client_tracer' + require_relative 'patches/client_stub' end end end diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client_tracer.rb similarity index 95% rename from instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client.rb rename to instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client_tracer.rb index 2cc03459d..d1ffeb3b6 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/interceptors/client_tracer.rb @@ -8,7 +8,8 @@ module OpenTelemetry module Instrumentation module Grpc module Interceptors - class Client + # ClientTracer is a gRPC client interceptor which instrument gRPC calls with OpenTelemetry tracing + class ClientTracer < ::GRPC::ClientInterceptor def request_response(request: nil, call: nil, method: nil, metadata: nil, &blk) call(type: "request_response", requests: [request], call: call, method: method, metadata: metadata, &blk) end diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb new file mode 100644 index 000000000..10da54220 --- /dev/null +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +module OpenTelemetry + module Instrumentation + module Grpc + module Patches + # Module to be prepended to force GRPC to use the client interceptor by + # default so the user doesn't have to manually add it when initializing a client. + module ClientStub + def initialize(host, creds, **args) + interceptors = args[:interceptors] || [] + interceptors.unshift(Interceptors::ClientTracer.new) unless interceptors.any? do |interceptor| + interceptor.is_a?(Interceptors::ClientTracer) + end + args[:interceptors] = interceptors + + super + end + end + end + end + end +end diff --git a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec index e2c18e6a3..3fc35d600 100644 --- a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec +++ b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec @@ -33,9 +33,20 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] # Uncomment to register a new dependency of your gem - spec.add_dependency "opentelemetry-instrumentation-base", "~> 0.22.4" - spec.add_dependency "opentelemetry-api", "~> 1.2" - spec.add_runtime_dependency "activesupport", ">= 4" + spec.add_dependency 'activesupport', '>= 4' + spec.add_dependency 'opentelemetry-api', '~> 1.2' + spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.22.4' + + spec.add_development_dependency 'appraisal', '~> 2.5' + spec.add_development_dependency 'bundler', '~> 2.4' + spec.add_development_dependency 'google-protobuf', '~> 4.29' + spec.add_development_dependency 'grpc-tools', '~> 1.64' + spec.add_development_dependency 'minitest', '~> 5.0' + spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1' + spec.add_development_dependency 'rubocop', '~> 1.69.1' + spec.add_development_dependency 'rubocop-performance', '~> 1.23.0' + spec.add_development_dependency 'simplecov', '~> 0.17.1' + spec.add_development_dependency 'yard', '~> 0.9' # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html From 031081e3ce6c01235f6871ff98a4981d5edd6e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 18:17:49 +0100 Subject: [PATCH 02/15] feat(grpc): migrate from rspec to minitest --- instrumentation/grpc/.rspec | 3 - instrumentation/grpc/Gemfile | 10 +-- instrumentation/grpc/README.md | 13 +-- instrumentation/grpc/Rakefile | 24 ++++-- instrumentation/grpc/spec/example/Gemfile | 14 ---- instrumentation/grpc/spec/example/base.rb | 13 --- .../controllers/example_api_controller.rb | 15 ---- .../grpc/spec/example/proto/example_api.proto | 16 ---- .../grpc/spec/example/proto/example_api_pb.rb | 25 ------ .../example/proto/example_api_services_pb.rb | 25 ------ .../grpc/spec/example/trace_demonstration.rb | 46 ----------- .../grpc/interceptors/client_spec.rb | 82 ------------------- .../instrumentation/grpc_spec.rb | 15 ---- instrumentation/grpc/spec/spec_helper.rb | 31 ------- .../instrumentation/grpc_test.rb | 42 ++++++++++ .../grpc/test/support/grpc_server_runner.rb | 36 ++++++++ .../grpc/test/support/ping_server_impl.rb | 13 +++ .../grpc/test/support/proto/ping.proto | 19 +++++ .../grpc/test/support/proto/ping_pb.rb | 18 ++++ .../test/support/proto/ping_services_pb.rb | 26 ++++++ instrumentation/grpc/test/test_helper.rb | 23 ++++++ 21 files changed, 204 insertions(+), 305 deletions(-) delete mode 100644 instrumentation/grpc/.rspec delete mode 100644 instrumentation/grpc/spec/example/Gemfile delete mode 100644 instrumentation/grpc/spec/example/base.rb delete mode 100644 instrumentation/grpc/spec/example/controllers/example_api_controller.rb delete mode 100644 instrumentation/grpc/spec/example/proto/example_api.proto delete mode 100644 instrumentation/grpc/spec/example/proto/example_api_pb.rb delete mode 100644 instrumentation/grpc/spec/example/proto/example_api_services_pb.rb delete mode 100644 instrumentation/grpc/spec/example/trace_demonstration.rb delete mode 100644 instrumentation/grpc/spec/opentelemetry/instrumentation/grpc/interceptors/client_spec.rb delete mode 100644 instrumentation/grpc/spec/opentelemetry/instrumentation/grpc_spec.rb delete mode 100644 instrumentation/grpc/spec/spec_helper.rb create mode 100644 instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb create mode 100644 instrumentation/grpc/test/support/grpc_server_runner.rb create mode 100644 instrumentation/grpc/test/support/ping_server_impl.rb create mode 100644 instrumentation/grpc/test/support/proto/ping.proto create mode 100644 instrumentation/grpc/test/support/proto/ping_pb.rb create mode 100644 instrumentation/grpc/test/support/proto/ping_services_pb.rb create mode 100644 instrumentation/grpc/test/test_helper.rb diff --git a/instrumentation/grpc/.rspec b/instrumentation/grpc/.rspec deleted file mode 100644 index 34c5164d9..000000000 --- a/instrumentation/grpc/.rspec +++ /dev/null @@ -1,3 +0,0 @@ ---format documentation ---color ---require spec_helper diff --git a/instrumentation/grpc/Gemfile b/instrumentation/grpc/Gemfile index 091fd2d84..2834fc34b 100644 --- a/instrumentation/grpc/Gemfile +++ b/instrumentation/grpc/Gemfile @@ -9,9 +9,7 @@ source "https://rubygems.org" # Specify your gem's dependencies in opentelemetry-instrumentation-grpc.gemspec gemspec -gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" -gem "standard", "~> 1.3" -gem "opentelemetry-sdk", "~> 1.0" -gem "opentelemetry-test-helpers" -gem "grpc" +group :test do + gem 'opentelemetry-instrumentation-base', path: '../base' + gem 'pry' +end diff --git a/instrumentation/grpc/README.md b/instrumentation/grpc/README.md index 8377b9d57..6a46d8178 100644 --- a/instrumentation/grpc/README.md +++ b/instrumentation/grpc/README.md @@ -46,18 +46,13 @@ instrumentation. end ``` -You *also* need to make sure your stubs are using the interceptor, e.g. - -```ruby - otel = OpenTelemetry::Instrumentation::Grpc.client_interceptor - SomeService::Stub.new(host, credentials, *args, **kwargs, interceptors: [otel]) -``` - ## 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. +Integration tests relay on a real gRPC server which is started by relevant tests. The proto definition is located in `test/support/proto/ping.proto`. Making changes to the proto definition requires re-creating grpc-generated code. To do this, run the following command: -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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +``` +bundle exec grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. test/support/proto/ping.proto +``` ## Contributing diff --git a/instrumentation/grpc/Rakefile b/instrumentation/grpc/Rakefile index 011031f8f..1a64ba842 100644 --- a/instrumentation/grpc/Rakefile +++ b/instrumentation/grpc/Rakefile @@ -4,11 +4,25 @@ # # SPDX-License-Identifier: Apache-2.0 -require "bundler/gem_tasks" -require "rspec/core/rake_task" +require 'bundler/gem_tasks' +require 'rake/testtask' +require 'yard' +require 'rubocop/rake_task' -RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new -require "standard/rake" +Rake::TestTask.new :test do |t| + t.libs << 'test' + t.libs << 'lib' + t.test_files = FileList['test/**/*_test.rb'] +end -task default: %i[spec standard] +YARD::Rake::YardocTask.new do |t| + t.stats_options = ['--list-undoc'] +end + +if RUBY_ENGINE == 'truffleruby' + task default: %i[test] +else + task default: %i[test rubocop yard] +end diff --git a/instrumentation/grpc/spec/example/Gemfile b/instrumentation/grpc/spec/example/Gemfile deleted file mode 100644 index fafb31a31..000000000 --- a/instrumentation/grpc/spec/example/Gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -source "https://rubygems.org" - -gem "opentelemetry-api" -gem "opentelemetry-common" -gem "opentelemetry-instrumentation-gruf", path: "../../gruf" -gem "opentelemetry-sdk" -gem "gruf" -gem "google-protobuf" diff --git a/instrumentation/grpc/spec/example/base.rb b/instrumentation/grpc/spec/example/base.rb deleted file mode 100644 index e66891270..000000000 --- a/instrumentation/grpc/spec/example/base.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require "rubygems" -require "bundler/setup" -require "json" -require_relative "proto/example_api_pb" -require_relative "proto/example_api_services_pb" - -Bundler.require diff --git a/instrumentation/grpc/spec/example/controllers/example_api_controller.rb b/instrumentation/grpc/spec/example/controllers/example_api_controller.rb deleted file mode 100644 index 7bf6f14be..000000000 --- a/instrumentation/grpc/spec/example/controllers/example_api_controller.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require_relative "../base" - -class ExampleApiController < Gruf::Controllers::Base - bind Proto::Example::ExampleAPI::Service - - def example - Proto::Example::ExampleResponse.new(response_name: "Done") - end -end diff --git a/instrumentation/grpc/spec/example/proto/example_api.proto b/instrumentation/grpc/spec/example/proto/example_api.proto deleted file mode 100644 index d28ba90f3..000000000 --- a/instrumentation/grpc/spec/example/proto/example_api.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package proto.example; - -service ExampleAPI { - rpc Example(ExampleRequest) returns (ExampleResponse); -} - -message ExampleRequest { - uint64 id = 1; - string name = 2; -} - -message ExampleResponse { - string response_name = 1; -} \ No newline at end of file diff --git a/instrumentation/grpc/spec/example/proto/example_api_pb.rb b/instrumentation/grpc/spec/example/proto/example_api_pb.rb deleted file mode 100644 index 4e4649924..000000000 --- a/instrumentation/grpc/spec/example/proto/example_api_pb.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: example/example_api.proto - -require "google/protobuf" - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("example/example_api.proto", syntax: :proto3) do - add_message "proto.example.ExampleRequest" do - optional :id, :uint64, 1 - optional :name, :string, 2 - end - add_message "proto.example.ExampleResponse" do - optional :response_name, :string, 1 - end - end -end - -module Proto - module Example - ExampleRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("proto.example.ExampleRequest").msgclass - ExampleResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("proto.example.ExampleResponse").msgclass - end -end diff --git a/instrumentation/grpc/spec/example/proto/example_api_services_pb.rb b/instrumentation/grpc/spec/example/proto/example_api_services_pb.rb deleted file mode 100644 index 8fb75965b..000000000 --- a/instrumentation/grpc/spec/example/proto/example_api_services_pb.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: example/example_api.proto for package 'proto.example' - -require "grpc" -require_relative "example_api_pb" - -module Proto - module Example - module ExampleAPI - class Service - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = "proto.example.ExampleAPI" - - rpc :Example, ::Proto::Example::ExampleRequest, ::Proto::Example::ExampleResponse - end - - Stub = Service.rpc_stub_class - end - end -end diff --git a/instrumentation/grpc/spec/example/trace_demonstration.rb b/instrumentation/grpc/spec/example/trace_demonstration.rb deleted file mode 100644 index 9e4c38a28..000000000 --- a/instrumentation/grpc/spec/example/trace_demonstration.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require_relative "base" - -# Export traces to console by default -ENV["OTEL_TRACES_EXPORTER"] = "console" -# Configure OpenTelemetry::Instrumentation::Gruf -OpenTelemetry::SDK.configure do |c| - c.use "OpenTelemetry::Instrumentation::Gruf", { - peer_service: "Example", - grpc_ignore_methods_on_client: [], # ["proto.example.example_api.example"] - grpc_ignore_methods_on_server: [], # ["proto.example.example_api.example"] - allowed_metadata_headers: [] - } -end - -# Configure Gruf::Server -Gruf.configure do |config| - config.controllers_path = ("./controllers") - config.interceptors.clear - config.interceptors.use(OpenTelemetry::Instrumentation::Gruf::Interceptors::Server) -end -Gruf.autoloaders.load!(controllers_path: Gruf.controllers_path) - -Thread.new do - # Configure Gruf::Client: send request after 5 seconds - sleep 5 - client_options = {interceptors: [OpenTelemetry::Instrumentation::Gruf::Interceptors::Client.new]} - client = Gruf::Client.new( - service: Proto::Example::ExampleAPI, options: {}, client_options: client_options - ) - metadata = {project_name: "Example project", authorization: "authorization_token"} - client.call(:Example, {id: 1, name: "Example"}, metadata) - - # Kill process after 3 seconds - sleep 3 - exit -end - -server = Gruf::Server.new -# Demonstrate tracing for client and server (span output to console): -server.start! diff --git a/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc/interceptors/client_spec.rb b/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc/interceptors/client_spec.rb deleted file mode 100644 index c536120e5..000000000 --- a/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc/interceptors/client_spec.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require "spec_helper" - -require "opentelemetry/instrumentation/grpc/interceptors/client" - -RSpec.describe OpenTelemetry::Instrumentation::Grpc::Interceptors::Client do - before do - instrumentation.install(config) - exporter.reset - end - - after do - instrumentation.instance_variable_set(:@installed, false) - end - - let(:config) { {} } - let(:exporter) { EXPORTER } - let(:instrumentation) { OpenTelemetry::Instrumentation::Grpc::Instrumentation.instance } - let(:span) { exporter.finished_spans.first } - let(:response) { Proto::Example::ExampleResponse.new(response_name: "Done") } - let(:block) { proc { response } } - let(:client_call) do - OpenTelemetry::Instrumentation::Grpc::Interceptors::Client - .new.request_response(request: Proto::Example::ExampleRequest.new, call: proc { true }, method: "/proto.example.ExampleAPI/Example", metadata: {foo: "bar"}, &block) - end - - describe "success request" do - it "gets response and finish span" do - expect(client_call).to eq(response) - expect(exporter.finished_spans.size).to eq(1) - expect(span.kind).to eq(:client) - expect(span.attributes["rpc.system"]).to eq("grpc") - expect(span.attributes["rpc.type"]).to eq("request_response") - expect(span.name).to eq("proto.example.ExampleAPI/Example") - end - - describe "with allowed_metadata_headers" do - let(:config) { {allowed_metadata_headers: [:foo]} } - - it do - client_call - - expect(exporter.finished_spans.size).to eq(1) - expect(span.attributes["rpc.request.metadata.foo"]).to eq("bar") - end - end - end - - describe "raise non-gRPC related error" do - let(:error_class) { Class.new(StandardError) } - let(:block) { proc { raise error_class } } - - it "gets response and finish span" do - expect { client_call }.to raise_error(error_class) - expect(exporter.finished_spans.size).to eq(1) - expect(span.kind).to eq(:client) - expect(span.attributes["rpc.system"]).to eq("grpc") - expect(span.attributes["rpc.type"]).to eq("request_response") - expect(span.events.size).to eq(1) - expect(span.events.first.name).to eq("exception") - end - end - - describe "raise gRPC related error" do - let(:block) { proc { raise ::GRPC::NotFound } } - - it "gets response and finish span, setting code correctly" do - expect { client_call }.to raise_error(::GRPC::NotFound) - expect(exporter.finished_spans.size).to eq(1) - expect(span.kind).to eq(:client) - expect(span.attributes["rpc.system"]).to eq("grpc") - expect(span.attributes["rpc.type"]).to eq("request_response") - expect(span.attributes["rpc.grpc.status_code"]).to eq(::GRPC::NotFound.new.code) - expect(span.events.size).to eq(1) - end - end -end diff --git a/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc_spec.rb b/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc_spec.rb deleted file mode 100644 index 0a805138c..000000000 --- a/instrumentation/grpc/spec/opentelemetry/instrumentation/grpc_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -RSpec.describe OpenTelemetry::Instrumentation::Grpc do - it "has a version number" do - expect(OpenTelemetry::Instrumentation::Grpc::VERSION).not_to be nil - end - - describe ".client_interceptor" do - it { expect(described_class.client_interceptor).to be_a(OpenTelemetry::Instrumentation::Grpc::Interceptors::Client) } - end -end diff --git a/instrumentation/grpc/spec/spec_helper.rb b/instrumentation/grpc/spec/spec_helper.rb deleted file mode 100644 index 7a082ee74..000000000 --- a/instrumentation/grpc/spec/spec_helper.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require "opentelemetry/sdk" -require "grpc" - -require "opentelemetry/instrumentation/grpc" -require "example/proto/example_api_pb" -require "example/proto/example_api_services_pb" - -RSpec.configure do |config| - # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" - - # Disable RSpec exposing methods globally on `Module` and `main` - config.disable_monkey_patching! - - config.expect_with :rspec do |c| - c.syntax = :expect - end -end - -EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new -span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(EXPORTER) - -OpenTelemetry::SDK.configure do |c| - c.add_span_processor span_processor -end diff --git a/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb b/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb new file mode 100644 index 000000000..d99452f3f --- /dev/null +++ b/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require_relative '../../test_helper' +require_relative '../../support/proto/ping_services_pb' +require_relative '../../support/grpc_server_runner' + +describe OpenTelemetry::Instrumentation::Grpc do + let(:instrumentation) { OpenTelemetry::Instrumentation::Grpc::Instrumentation.instance } + let(:exporter) { EXPORTER } + let(:server_runner) { Support::GrpcServerRunner.new } + + before do + instrumentation.install + exporter.reset + + server_port = server_runner.start + @stub = Support::Proto::PingServer::Stub.new( + "localhost:#{server_port}", + :this_channel_is_insecure, + ) + end + after do + server_runner.stop + end + + describe 'tracing' do + it 'before request' do + _(exporter.finished_spans.size).must_equal 0 + end + + it 'after request' do + request = Support::Proto::PingRequest.new(value: 'Ping!') + @stub.request_response_ping(request) + + _(exporter.finished_spans.size).must_equal 1 + end + end +end diff --git a/instrumentation/grpc/test/support/grpc_server_runner.rb b/instrumentation/grpc/test/support/grpc_server_runner.rb new file mode 100644 index 000000000..0659b294e --- /dev/null +++ b/instrumentation/grpc/test/support/grpc_server_runner.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +# inspired by https://github.com/grpc/grpc/blob/master/src/ruby/spec/support/helpers.rb + +require_relative './ping_server_impl' + +module Support + class GrpcServerRunner + def initialize(service: PingServerImpl, server_opts: {}) + @service = service + @server_opts = server_opts + end + + def start + @server_opts[:pool_size] ||= 1 + @server_opts[:poll_period] ||= 1 + @server = GRPC::RpcServer.new(**@server_opts) + @server_port = @server.add_http2_port( + 'localhost:0', :this_port_is_insecure + ) + @server.handle(@service) + @server_thread = Thread.new { @server.run } + @server.wait_till_running + @server_port + end + + def stop + @server.stop + @server_thread.join + end + end +end diff --git a/instrumentation/grpc/test/support/ping_server_impl.rb b/instrumentation/grpc/test/support/ping_server_impl.rb new file mode 100644 index 000000000..6a9e08339 --- /dev/null +++ b/instrumentation/grpc/test/support/ping_server_impl.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require_relative 'proto/ping_services_pb' + +class PingServerImpl < Support::Proto::PingServer::Service + def request_response_ping(ping_request, _call) + Support::Proto::PingResponse.new(value: 'Pong!') + end +end diff --git a/instrumentation/grpc/test/support/proto/ping.proto b/instrumentation/grpc/test/support/proto/ping.proto new file mode 100644 index 000000000..ecfcf49ab --- /dev/null +++ b/instrumentation/grpc/test/support/proto/ping.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package support.proto; + +service PingServer { + rpc RequestResponsePing(PingRequest) returns (PingResponse) {} + rpc ClientStreamerPing(stream PingRequest) returns (PingResponse) {} + rpc ServerStreamerPing(PingRequest) returns (stream PingResponse) {} + rpc BidiStreamerPing(stream PingRequest) returns (stream PingResponse) {} +} + +message PingRequest { + string value = 1; + uint32 error_code = 2; +} + +message PingResponse { + string value = 1; +} diff --git a/instrumentation/grpc/test/support/proto/ping_pb.rb b/instrumentation/grpc/test/support/proto/ping_pb.rb new file mode 100644 index 000000000..f570dfb6c --- /dev/null +++ b/instrumentation/grpc/test/support/proto/ping_pb.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: test/support/proto/ping.proto + +require 'google/protobuf' + + +descriptor_data = "\n\x1dtest/support/proto/ping.proto\x12\rsupport.proto\"0\n\x0bPingRequest\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nerror_code\x18\x02 \x01(\r\"\x1d\n\x0cPingResponse\x12\r\n\x05value\x18\x01 \x01(\t2\xd7\x02\n\nPingServer\x12P\n\x13RequestResponsePing\x12\x1a.support.proto.PingRequest\x1a\x1b.support.proto.PingResponse\"\x00\x12Q\n\x12\x43lientStreamerPing\x12\x1a.support.proto.PingRequest\x1a\x1b.support.proto.PingResponse\"\x00(\x01\x12Q\n\x12ServerStreamerPing\x12\x1a.support.proto.PingRequest\x1a\x1b.support.proto.PingResponse\"\x00\x30\x01\x12Q\n\x10\x42idiStreamerPing\x12\x1a.support.proto.PingRequest\x1a\x1b.support.proto.PingResponse\"\x00(\x01\x30\x01\x62\x06proto3" + +pool = Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Support + module Proto + PingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("support.proto.PingRequest").msgclass + PingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("support.proto.PingResponse").msgclass + end +end diff --git a/instrumentation/grpc/test/support/proto/ping_services_pb.rb b/instrumentation/grpc/test/support/proto/ping_services_pb.rb new file mode 100644 index 000000000..0a6062c26 --- /dev/null +++ b/instrumentation/grpc/test/support/proto/ping_services_pb.rb @@ -0,0 +1,26 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: test/support/proto/ping.proto for package 'support.proto' + +require 'grpc' +require_relative 'ping_pb' + +module Support + module Proto + module PingServer + class Service + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'support.proto.PingServer' + + rpc :RequestResponsePing, ::Support::Proto::PingRequest, ::Support::Proto::PingResponse + rpc :ClientStreamerPing, stream(::Support::Proto::PingRequest), ::Support::Proto::PingResponse + rpc :ServerStreamerPing, ::Support::Proto::PingRequest, stream(::Support::Proto::PingResponse) + rpc :BidiStreamerPing, stream(::Support::Proto::PingRequest), stream(::Support::Proto::PingResponse) + end + + Stub = Service.rpc_stub_class + end + end +end diff --git a/instrumentation/grpc/test/test_helper.rb b/instrumentation/grpc/test/test_helper.rb new file mode 100644 index 000000000..f36f9afbe --- /dev/null +++ b/instrumentation/grpc/test/test_helper.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require 'bundler/setup' +Bundler.require(:default, :development, :test) + +require 'minitest/autorun' +# require 'webmock/minitest' + +require 'opentelemetry-instrumentation-grpc' + +# global opentelemetry-sdk setup: +EXPORTER = OpenTelemetry::SDK::Trace::Export::InMemorySpanExporter.new +span_processor = OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(EXPORTER) + +OpenTelemetry::SDK.configure do |c| + c.error_handler = ->(exception:, message:) { raise(exception || message) } + c.logger = Logger.new($stderr, level: ENV.fetch('OTEL_LOG_LEVEL', 'fatal').to_sym) + c.add_span_processor span_processor +end From cfbbeb7c4df0632e56bd54a7498e26947f2d555a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 18:18:34 +0100 Subject: [PATCH 03/15] feat(grpc): introduce Appraisals --- instrumentation/grpc/Appraisals | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 instrumentation/grpc/Appraisals diff --git a/instrumentation/grpc/Appraisals b/instrumentation/grpc/Appraisals new file mode 100644 index 000000000..d08f08ee7 --- /dev/null +++ b/instrumentation/grpc/Appraisals @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +appraise 'grpc-1.68' do + gem 'grpc', '~> 1.68.0' +end From 738602222a8303568ab6116f4550b4fb350f187b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 18:21:20 +0100 Subject: [PATCH 04/15] fix(grpc): remove active_support dependency --- instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb | 1 - instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec | 1 - 2 files changed, 2 deletions(-) diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb index 130bad423..816d97f13 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb @@ -6,7 +6,6 @@ require "opentelemetry" require "opentelemetry-instrumentation-base" -require "active_support/inflector" module OpenTelemetry module Instrumentation diff --git a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec index 3fc35d600..69fb1d0f4 100644 --- a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec +++ b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec @@ -33,7 +33,6 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] # Uncomment to register a new dependency of your gem - spec.add_dependency 'activesupport', '>= 4' spec.add_dependency 'opentelemetry-api', '~> 1.2' spec.add_dependency 'opentelemetry-instrumentation-base', '~> 0.22.4' From 74bbba60a3d6a28c0df14860e8e5105438c0b12e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 18:22:18 +0100 Subject: [PATCH 05/15] Update grpc.rb --- instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb index 816d97f13..ed7f5afe9 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc.rb @@ -17,6 +17,5 @@ class Error < StandardError; end end require_relative "grpc/instrumentation" -require_relative "grpc/interceptors/client" require_relative "grpc/version" require_relative 'grpc/interceptors/client_tracer' From 55f49f297b05323b04ac04f1b8c3e2e3224114a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 22:50:48 +0100 Subject: [PATCH 06/15] Update README.md --- instrumentation/grpc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/grpc/README.md b/instrumentation/grpc/README.md index 6a46d8178..d28436035 100644 --- a/instrumentation/grpc/README.md +++ b/instrumentation/grpc/README.md @@ -50,7 +50,7 @@ instrumentation. Integration tests relay on a real gRPC server which is started by relevant tests. The proto definition is located in `test/support/proto/ping.proto`. Making changes to the proto definition requires re-creating grpc-generated code. To do this, run the following command: -``` +```sh bundle exec grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. test/support/proto/ping.proto ``` From 7ed2c4635241b0d7df8bc376f3398542a8e6c22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 23:11:45 +0100 Subject: [PATCH 07/15] ci: add (probably) missing grpc gem in the ci-instrumentation --- .github/workflows/ci-instrumentation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-instrumentation.yml b/.github/workflows/ci-instrumentation.yml index cf938e48f..49b649c37 100644 --- a/.github/workflows/ci-instrumentation.yml +++ b/.github/workflows/ci-instrumentation.yml @@ -39,6 +39,7 @@ jobs: - faraday - grape - graphql + - grpc - gruf - http - http_client From 60c02df02f5006bad11d5b84e586639f9957fe8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 23:32:35 +0100 Subject: [PATCH 08/15] cI: grpc is not included in the all gem yet --- instrumentation/all/Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/all/Gemfile b/instrumentation/all/Gemfile index 554672bec..30808d503 100644 --- a/instrumentation/all/Gemfile +++ b/instrumentation/all/Gemfile @@ -15,9 +15,10 @@ group :test do .sort .each { |dir| gem "opentelemetry-helpers-#{dir}", path: "../../helpers/#{dir}" } + excluded_instrumentations = %w[. .. all grpc] Dir.entries('../') .select { |entry| File.directory?(File.join('../', entry)) } - .reject { |entry| %w[. .. all].include?(entry) } # rubocop:disable Performance/CollectionLiteralInLoop + .reject { |entry| excluded_instrumentations.include?(entry) } .sort .each { |dir| gem "opentelemetry-instrumentation-#{dir}", path: "../#{dir}" } end From fda0183212ae91ea7d51be7a31d7aa27d44642db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Fri, 13 Dec 2024 23:45:37 +0100 Subject: [PATCH 09/15] ci: skip grpc from the CI for now --- .github/workflows/ci-instrumentation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-instrumentation.yml b/.github/workflows/ci-instrumentation.yml index 49b649c37..cf938e48f 100644 --- a/.github/workflows/ci-instrumentation.yml +++ b/.github/workflows/ci-instrumentation.yml @@ -39,7 +39,6 @@ jobs: - faraday - grape - graphql - - grpc - gruf - http - http_client From 50a6358abfcd416cc44a6f98be6f00b1d7b8b3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 17:04:09 +0100 Subject: [PATCH 10/15] a better approach towards client testing --- .../grpc/interceptors/client_tracer_test.rb | 73 +++++++++++++++++++ .../instrumentation/grpc_test.rb | 42 ----------- 2 files changed, 73 insertions(+), 42 deletions(-) create mode 100644 instrumentation/grpc/test/opentelemetry/instrumentation/grpc/interceptors/client_tracer_test.rb delete mode 100644 instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb diff --git a/instrumentation/grpc/test/opentelemetry/instrumentation/grpc/interceptors/client_tracer_test.rb b/instrumentation/grpc/test/opentelemetry/instrumentation/grpc/interceptors/client_tracer_test.rb new file mode 100644 index 000000000..537c5e38f --- /dev/null +++ b/instrumentation/grpc/test/opentelemetry/instrumentation/grpc/interceptors/client_tracer_test.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# Copyright The OpenTelemetry Authors +# +# SPDX-License-Identifier: Apache-2.0 + +require_relative '../../../../test_helper' +require_relative '../../../../support/grpc_server_runner' + +describe OpenTelemetry::Instrumentation::Grpc::Interceptors::ClientTracer do + let(:instrumentation) { OpenTelemetry::Instrumentation::Grpc::Instrumentation.instance } + let(:exporter) { EXPORTER } + let(:request) { Support::Proto::PingRequest.new(value: 'Ping!') } + let(:server_runner) { Support::GrpcServerRunner.new } + + before do + instrumentation.install + exporter.reset + + # use a real gRPC server to avoid non-trivial mocks + server_port = server_runner.start + # create a client stub to interact with the server + @stub = Support::Proto::PingServer::Stub.new( + "localhost:#{server_port}", + :this_channel_is_insecure + ) + end + after do + server_runner.stop + end + + describe '#request_response' do + it 'registers a span' do + _(exporter.finished_spans.size).must_equal 0 + + @stub.request_response_ping(request) + + _(exporter.finished_spans.size).must_equal 1 + end + + it 'sets expected kind' do + @stub.request_response_ping(request) + + span = exporter.finished_spans.first + + _(span).wont_be_nil + _(span.kind).must_equal(:client) + end + + it 'sets expected name' do + @stub.request_response_ping(request) + + span = exporter.finished_spans.first + + _(span).wont_be_nil + _(span.name).must_equal('support.proto.PingServer/RequestResponsePing') + end + + it 'sets expected attributes' do + @stub.request_response_ping(request) + + span = exporter.finished_spans.first + + _(span).wont_be_nil + _(span.attributes['rpc.system']).must_equal('grpc') + _(span.attributes['rpc.service']).must_equal('support.proto.PingServer') + _(span.attributes['rpc.method']).must_equal('RequestResponsePing') + _(span.attributes['rpc.type']).must_equal('request_response') + _(span.attributes['net.sock.peer.addr']).wont_be_empty + _(span.attributes['rpc.grpc.status_code']).must_equal(0) + end + end +end diff --git a/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb b/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb deleted file mode 100644 index d99452f3f..000000000 --- a/instrumentation/grpc/test/opentelemetry/instrumentation/grpc_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -require_relative '../../test_helper' -require_relative '../../support/proto/ping_services_pb' -require_relative '../../support/grpc_server_runner' - -describe OpenTelemetry::Instrumentation::Grpc do - let(:instrumentation) { OpenTelemetry::Instrumentation::Grpc::Instrumentation.instance } - let(:exporter) { EXPORTER } - let(:server_runner) { Support::GrpcServerRunner.new } - - before do - instrumentation.install - exporter.reset - - server_port = server_runner.start - @stub = Support::Proto::PingServer::Stub.new( - "localhost:#{server_port}", - :this_channel_is_insecure, - ) - end - after do - server_runner.stop - end - - describe 'tracing' do - it 'before request' do - _(exporter.finished_spans.size).must_equal 0 - end - - it 'after request' do - request = Support::Proto::PingRequest.new(value: 'Ping!') - @stub.request_response_ping(request) - - _(exporter.finished_spans.size).must_equal 1 - end - end -end From 85e71485ce647ab90799b3eac7cd3794eec03314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 22:59:24 +0100 Subject: [PATCH 11/15] add an unversioned Appraisal Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> --- instrumentation/grpc/Appraisals | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/instrumentation/grpc/Appraisals b/instrumentation/grpc/Appraisals index d08f08ee7..b4258703c 100644 --- a/instrumentation/grpc/Appraisals +++ b/instrumentation/grpc/Appraisals @@ -7,3 +7,7 @@ appraise 'grpc-1.68' do gem 'grpc', '~> 1.68.0' end + +appraise 'grpc-latest' do + gem 'grpc' +end From 9e7b51fcc9f9e49b4c8fd7bb46012b993482516b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 23:01:24 +0100 Subject: [PATCH 12/15] Update instrumentation/grpc/README.md Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> --- instrumentation/grpc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/grpc/README.md b/instrumentation/grpc/README.md index d28436035..788c1866d 100644 --- a/instrumentation/grpc/README.md +++ b/instrumentation/grpc/README.md @@ -48,7 +48,7 @@ instrumentation. ## Development -Integration tests relay on a real gRPC server which is started by relevant tests. The proto definition is located in `test/support/proto/ping.proto`. Making changes to the proto definition requires re-creating grpc-generated code. To do this, run the following command: +Integration tests rely on a real gRPC server that is started by relevant tests. The proto definition is located in `test/support/proto/ping.proto`. Making changes to the proto definition requires re-creating gRPC-generated code. To do this, run the following command: ```sh bundle exec grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. test/support/proto/ping.proto From 6c655134ab7820a1551f804dff720096563d5d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 23:01:39 +0100 Subject: [PATCH 13/15] Update instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> --- .../opentelemetry/instrumentation/grpc/patches/client_stub.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb index 10da54220..5d9367eaf 100644 --- a/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb +++ b/instrumentation/grpc/lib/opentelemetry/instrumentation/grpc/patches/client_stub.rb @@ -8,7 +8,7 @@ module OpenTelemetry module Instrumentation module Grpc module Patches - # Module to be prepended to force GRPC to use the client interceptor by + # Module to be prepended to force gRPC to use the client interceptor by # default so the user doesn't have to manually add it when initializing a client. module ClientStub def initialize(host, creds, **args) From 7bf266b95f3d8d2b071013ee5c95903ed90f857b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 23:02:01 +0100 Subject: [PATCH 14/15] Update instrumentation/grpc/test/test_helper.rb Co-authored-by: Kayla Reopelle <87386821+kaylareopelle@users.noreply.github.com> --- instrumentation/grpc/test/test_helper.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/instrumentation/grpc/test/test_helper.rb b/instrumentation/grpc/test/test_helper.rb index f36f9afbe..19330e92a 100644 --- a/instrumentation/grpc/test/test_helper.rb +++ b/instrumentation/grpc/test/test_helper.rb @@ -8,7 +8,6 @@ Bundler.require(:default, :development, :test) require 'minitest/autorun' -# require 'webmock/minitest' require 'opentelemetry-instrumentation-grpc' From 4953c4638c5dc3de3be7a38798a4358693441263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 17 Dec 2024 23:08:52 +0100 Subject: [PATCH 15/15] add opentelemetry-test-helpers and rake as development dependencies --- instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec index 69fb1d0f4..9cb74cf8a 100644 --- a/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec +++ b/instrumentation/grpc/opentelemetry-instrumentation-grpc.gemspec @@ -42,6 +42,8 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'grpc-tools', '~> 1.64' spec.add_development_dependency 'minitest', '~> 5.0' spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1' + spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.4' + spec.add_development_dependency 'rake', '~> 13.2' spec.add_development_dependency 'rubocop', '~> 1.69.1' spec.add_development_dependency 'rubocop-performance', '~> 1.23.0' spec.add_development_dependency 'simplecov', '~> 0.17.1'