Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gRPC trace demonstration #1376

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

michal-kazmierczak
Copy link
Contributor

This PR adds trace demonstration of the gRPC instrumentation.

An example output:

❯ ruby trace_demonstration.rb
I, [2025-01-29T18:32:51.474157 #88063]  INFO -- : Instrumentation: OpenTelemetry::Instrumentation::Grpc was successfully installed with the following options {:allowed_metadata_headers=>[], :peer_service=>nil}
#<struct OpenTelemetry::SDK::Trace::SpanData
 name="proto.example.ExampleAPI/Example",
 kind=:client,
 status=
  #<OpenTelemetry::Trace::Status:0x0000000120f88678
   @code=1,
   @description="">,
 parent_span_id="\x00\x00\x00\x00\x00\x00\x00\x00",
 total_recorded_attributes=6,
 total_recorded_events=0,
 total_recorded_links=0,
 start_timestamp=1738171971478189000,
 end_timestamp=1738171971480708000,
 attributes=
  {"rpc.system"=>"grpc",
   "rpc.service"=>"proto.example.ExampleAPI",
   "rpc.method"=>"Example",
   "rpc.type"=>"request_response",
   "net.sock.peer.addr"=>"dns:///localhost:59320",
   "rpc.grpc.status_code"=>0},
 links=nil,
 events=nil,
 resource=
  #<OpenTelemetry::SDK::Resources::Resource:0x0000000120f830b0
   @attributes=
    {"service.name"=>"unknown_service",
     "process.pid"=>88063,
     "process.command"=>"trace_demonstration.rb",
     "process.runtime.name"=>"ruby",
     "process.runtime.version"=>"3.3.5",
     "process.runtime.description"=>
      "ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin24]",
     "telemetry.sdk.name"=>"opentelemetry",
     "telemetry.sdk.language"=>"ruby",
     "telemetry.sdk.version"=>"1.6.0"}>,
 instrumentation_scope=
  #<struct OpenTelemetry::SDK::InstrumentationScope
   name="OpenTelemetry::Instrumentation::Grpc",
   version="0.2.0">,
 span_id="J\x1A\x04]\xC6`),",
 trace_id="\xCB\xAAza\x8A4,8s^\xF8$\xBB\x17\xBA\t",
 trace_flags=
  #<OpenTelemetry::Trace::TraceFlags:0x00000001201f13c0 @flags=1>,
 tracestate=
  #<OpenTelemetry::Trace::Tracestate:0x00000001051562f0 @hash={}>>

@michal-kazmierczak michal-kazmierczak force-pushed the feat-grpc-instrument-trace-demonstration branch 3 times, most recently from 0a08cc9 to 827b247 Compare January 30, 2025 20:49
@michal-kazmierczak michal-kazmierczak force-pushed the feat-grpc-instrument-trace-demonstration branch from 827b247 to aa8f565 Compare January 31, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants