From ec3954efe208a33772b40d50b6d0d8225f9acb59 Mon Sep 17 00:00:00 2001 From: Marco Rogers Date: Tue, 26 Nov 2019 15:06:52 -0800 Subject: [PATCH 1/3] Expose context methods for current trace and span --- lib/honeycomb-beeline.rb | 3 ++- lib/honeycomb/client.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/honeycomb-beeline.rb b/lib/honeycomb-beeline.rb index 18e876f3..b365e91c 100644 --- a/lib/honeycomb-beeline.rb +++ b/lib/honeycomb-beeline.rb @@ -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| diff --git a/lib/honeycomb/client.rb b/lib/honeycomb/client.rb index 5fbee50a..559fc9fd 100644 --- a/lib/honeycomb/client.rb +++ b/lib/honeycomb/client.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "forwardable" require "honeycomb/beeline/version" require "honeycomb/configuration" require "honeycomb/context" @@ -7,6 +8,10 @@ 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 From 0a70d1e9275aa60220829f0293e9f75dc3685d0e Mon Sep 17 00:00:00 2001 From: Marco Rogers Date: Tue, 26 Nov 2019 15:52:48 -0800 Subject: [PATCH 2/3] Expose basic config properties --- lib/honeycomb/client.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/honeycomb/client.rb b/lib/honeycomb/client.rb index 559fc9fd..d4174928 100644 --- a/lib/honeycomb/client.rb +++ b/lib/honeycomb/client.rb @@ -11,6 +11,7 @@ class Client extend Forwardable def_delegators :@context, :current_span, :current_trace + def_delegators :@client, :dataset, :service_name def initialize(configuration:) @client = configuration.client @@ -81,6 +82,10 @@ def add_field_to_trace(key, value) context.current_span.trace.add_field("app.#{key}", value) end + def debug? + client.debug ? true : false + end + private attr_reader :client, :context From 284d2bc9b1f07f4e06e31dceebdfdd73695d4c3c Mon Sep 17 00:00:00 2001 From: Marco Rogers Date: Thu, 16 Jan 2020 22:29:46 -0800 Subject: [PATCH 3/3] Revert "Expose basic config properties" This reverts commit 0a70d1e9275aa60220829f0293e9f75dc3685d0e. --- lib/honeycomb/client.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/honeycomb/client.rb b/lib/honeycomb/client.rb index d4174928..559fc9fd 100644 --- a/lib/honeycomb/client.rb +++ b/lib/honeycomb/client.rb @@ -11,7 +11,6 @@ class Client extend Forwardable def_delegators :@context, :current_span, :current_trace - def_delegators :@client, :dataset, :service_name def initialize(configuration:) @client = configuration.client @@ -82,10 +81,6 @@ def add_field_to_trace(key, value) context.current_span.trace.add_field("app.#{key}", value) end - def debug? - client.debug ? true : false - end - private attr_reader :client, :context