Skip to content

Commit

Permalink
Fixed: SyncWriter raising NoMethodError for #runtime_metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed May 1, 2019
1 parent 252af41 commit 3417aa5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/ddtrace/sync_writer.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
require 'ddtrace/runtime/metrics'

module Datadog
# SyncWriter flushes both services and traces synchronously
class SyncWriter
attr_reader :transport
attr_reader \
:runtime_metrics,
:transport

def initialize(options = {})
@transport = options.fetch(:transport) do
transport_options = options.fetch(:transport_options, {})
HTTPTransport.new(transport_options)
end

# Runtime metrics
@runtime_metrics = options.fetch(:runtime_metrics) do
Runtime::Metrics.new
end
end

def write(trace, services = nil)
Expand Down
13 changes: 13 additions & 0 deletions spec/ddtrace/sync_writer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

require 'ddtrace'
require 'ddtrace/sync_writer'

RSpec.describe Datadog::SyncWriter do
subject(:sync_writer) { described_class.new }

describe '#runtime_metrics' do
subject(:runtime_metrics) { sync_writer.runtime_metrics }
it { is_expected.to be_a_kind_of(Datadog::Runtime::Metrics) }
end
end

0 comments on commit 3417aa5

Please sign in to comment.