Sha256: 4cc2dbab2dca6106ce3bd84d0aaaab5c18882eee9c864a057fdcdddba94a2751

Contents?: true

Size: 1.87 KB

Versions: 24

Compression:

Stored size: 1.87 KB

Contents

# Stackdriver Trace Instrumentation

Then google-cloud-trace gem provides a Rack Middleware class that integrates
with Rack-based application frameworks, such as Rails and Sinatra. When
installed, the middleware collects performance traces of requests and, subject
to sampling constraints, submits them to the Stackdriver Trace service.

Additionally, the google-cloud-trace gem provides a Railtie class that
automatically enables the Rack Middleware in Rails applications when used.

## Configuration

The default configuration enables Stackdriver instrumentation features to run on
Google Cloud Platform. You can easily configure the instrumentation library  if
you want to run on a non Google Cloud environment or you want to customize  the
default behavior.

See the [Configuration
Guide](https://googleapis.dev/ruby/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION.html)
for full configuration parameters.

## Rails Integration

To use the Stackdriver Logging Railtie for Ruby on Rails applications, simply
add this line to `config/application.rb`:

```ruby
require "google/cloud/trace/rails"
```

Alternatively, check out the
[stackdriver](https://googleapis.dev/ruby/stackdriver/latest)
gem, which enables this Railtie by default.

## Rack Integration

Other Rack base frameworks can also directly leverage the built-in Middleware.

```ruby
require "google/cloud/trace"
use Google::Cloud::Trace::Middleware
```

## Faraday Middleware

On top of the Rack Middleware, you can also trace outbound Faraday requests by
using the Faraday Middleware provided with this gem:

```ruby
require "google/cloud/trace/faraday_middleware"

conn = Faraday.new "https://www.google.com"
conn.use Google::Cloud::Trace::FaradayMiddleware

result = conn.get
```

A child span will be create for each outbound Faraday request, and will be
submitted together with the overall application request trace by the Rack
Middleware.

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
google-cloud-trace-0.45.0 INSTRUMENTATION.md
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/google-cloud-trace-0.42.2/INSTRUMENTATION.md
google-cloud-trace-0.44.1 INSTRUMENTATION.md
google-cloud-trace-0.44.0 INSTRUMENTATION.md
google-cloud-trace-0.43.0 INSTRUMENTATION.md
google-cloud-trace-0.42.2 INSTRUMENTATION.md
google-cloud-trace-0.42.1 INSTRUMENTATION.md
google-cloud-trace-0.42.0 INSTRUMENTATION.md
google-cloud-trace-0.41.4 INSTRUMENTATION.md
google-cloud-trace-0.41.3 INSTRUMENTATION.md
google-cloud-trace-0.41.2 INSTRUMENTATION.md
google-cloud-trace-0.41.1 INSTRUMENTATION.md
google-cloud-trace-0.41.0 INSTRUMENTATION.md
google-cloud-trace-0.40.0 INSTRUMENTATION.md
google-cloud-trace-0.39.0 INSTRUMENTATION.md
google-cloud-trace-0.38.3 INSTRUMENTATION.md
google-cloud-trace-0.38.2 INSTRUMENTATION.md
google-cloud-trace-0.38.1 INSTRUMENTATION.md
google-cloud-trace-0.38.0 INSTRUMENTATION.md
google-cloud-trace-0.37.1 INSTRUMENTATION.md