Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions instrumentation/gruf/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
inherit_from: ../../.rubocop.yml

Style/Documentation:
Enabled: false
15 changes: 14 additions & 1 deletion instrumentation/gruf/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# OpenTelemetry Gruf Instrumentation

Todo: Add a description.
The OpenTelemetry Gruf Ruby gem is a community-maintained instrumentation for Gruf, a gRPC framework for Ruby. It enables automatic tracing of RPC requests handled by Gruf services.

## Overview

This instrumentation integrates OpenTelemetry with Gruf to create spans for incoming gRPC requests. It helps in observing request flow, latency and errors in distributed systems.

## How it works

The Gruf instrumentation hooks into the request lifecycle of Gruf-based gRPC services and automatically creates spans for each incoming RPC request.

It captures useful metadata such as:
- RPC method name
- Request lifecycle events
- Errors, if any

## How do I get started?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative '../base'

# Sample Gruf service used to demonstrate the OpenTelemetry instrumentation.
class ExampleApiController < Gruf::Controllers::Base
bind Proto::Example::ExampleAPI::Service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
module OpenTelemetry
module Instrumentation
module Gruf
# Interceptors contains the gRPC interceptors used by the Gruf instrumentation
module Interceptors
# Client is a Gruf client interceptor that creates an OpenTelemetry span
# for each outbound gRPC call, injecting trace context into request metadata
class Client < ::Gruf::Interceptors::ClientInterceptor
def call(request_context:)
return yield unless Gruf::Instrumentation.instance.installed?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
module OpenTelemetry
module Instrumentation
module Gruf
# Interceptors contains the gRPC interceptors used by the Gruf instrumentation
module Interceptors
# Server is a Gruf server interceptor that creates an OpenTelemetry span
# for each inbound gRPC call, extracting trace context from request metadata
class Server < ::Gruf::Interceptors::ServerInterceptor
def call
return yield unless Gruf::Instrumentation.instance.installed?
Expand Down
Loading