Skip to content

Commit

Permalink
Expose context methods for current trace and span (#46)
Browse files Browse the repository at this point in the history
Expose the current trace and current span in the top level scope. These properties are useful for doing custom instrumentation.
  • Loading branch information
polotek authored and martin308 committed Jan 21, 2020
1 parent c9a3ce1 commit 4713124
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/honeycomb-beeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class << self
extend Forwardable
attr_reader :client

def_delegators :@client, :start_span, :add_field, :add_field_to_trace
def_delegators :@client, :start_span, :add_field, :add_field_to_trace,
:current_span, :current_trace

def configure
Configuration.new.tap do |config|
Expand Down
5 changes: 5 additions & 0 deletions lib/honeycomb/client.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# frozen_string_literal: true

require "forwardable"
require "honeycomb/beeline/version"
require "honeycomb/configuration"
require "honeycomb/context"

module Honeycomb
# The Honeycomb Beeline client
class Client
extend Forwardable

def_delegators :@context, :current_span, :current_trace

def initialize(configuration:)
@client = configuration.client
# attempt to set the user_agent_addition, this will only work if the
Expand Down

0 comments on commit 4713124

Please sign in to comment.