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

Fix SyncWriter raising NoMethodError for #runtime_metrics #748

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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