No release in over 3 years
Low commit activity in last 3 years
Plugin for Stackdirver trace for bigcommerce/gruf
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
~> 3.0

Runtime

 Project Readme

Gruf::StackdriverTrace

Add Stackdriver trace support for gruf.

Installation

Add this line to your application's Gemfile:

gem 'gruf-stackdriver-trace'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gruf-stackdriver-trace

Usage

ServerInterceptor

Configure and use interceptor in gruf's initializer.

require 'gruf/stackdriver_trace'

Gruf.configure do |c|
  # optional
  Gruf::StackdriverTrace.configure do |config|
  end
  
  c.interceptors.use(Gruf::StackdriverTrace::ServerInterceptor)
end

ClientInterceptor

Specify Gruf::StackdriverTrace::ClientInterceptor instance to client_options[:interceptors].

client = Gruf::Client.new(
    service: Rpc::Products,
    client_options: {
        interceptors: [
            Gruf::StackdriverTrace::ClientInterceptor.new
        ]
    }
)
resp = client.call(:GetProduct)

NOTE: Gruf::StackdriverTrace::ClientInterceptor will not be enabled if the tracing context of Gruf::StackdriverTrace::ServerInterceptor or Stackdriver Trace(ex. use with Rails middleware) cannot be obtained.

Configuration

You can configure with Gruf::StackdriverTrace.configure { |config| ... }.

REF: https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver/INSTRUMENTATION_CONFIGURATION.md#trace

Without GCP environment

If you are running the application locally, in self-hosted VMs, or a third party hosting service, you will need to provide the project ID and credentials (keyfile) to the Google Cloud client library. See this section for details.

ex.

Google::Cloud.configure do |config|
  config.project_id = "your-project-id"
  config.keyfile = "path/to/service-account.json"
end

Development

TODO

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/atman-inc/gruf-stackdriver-trace. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

Code of Conduct

Everyone interacting in the Gruf::StackdriverTrace project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.