Skip to content

Commit

Permalink
Merge pull request #748 from DataDog/fix/no_method_runtime_metrics_wi…
Browse files Browse the repository at this point in the history
…th_sync_writer

Fix SyncWriter raising NoMethodError for #runtime_metrics
  • Loading branch information
delner authored May 2, 2019
2 parents 252af41 + 3417aa5 commit 81306c5
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 81306c5

Please sign in to comment.