Skip to content

Commit

Permalink
Added: #runtime_engine and #runtime_platform to Flush.
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Sep 9, 2020
1 parent 818296e commit 183d2eb
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ddtrace/profiling/flush.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module Profiling
:version,
:host,
:language,
:runtime,
:runtime_engine,
:runtime_platform,
:runtime_version,
:profiler_version
) do
Expand All @@ -27,7 +28,8 @@ def initialize(*args)
self.version = version || Datadog.configuration.version
self.host = host || Datadog::Runtime::Socket.hostname
self.language = language || Datadog::Runtime::Identity.lang
self.runtime = runtime || Datadog::Runtime::Identity.lang_interpreter
self.runtime_engine = runtime_engine || Datadog::Runtime::Identity.lang_engine
self.runtime_platform = runtime_platform || Datadog::Runtime::Identity.lang_platform
self.runtime_version = runtime_version || Datadog::Runtime::Identity.lang_version
self.profiler_version = profiler_version || Datadog::Runtime::Identity.tracer_version
end
Expand Down
81 changes: 81 additions & 0 deletions spec/ddtrace/profiling/flush_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
RSpec.describe Datadog::Profiling::Flush do
describe '#new' do
context 'given no arguments' do
subject(:identifier) { described_class.new }

it do
is_expected.to have_attributes(
start: nil,
finish: nil,
event_groups: nil,
event_count: nil,
runtime_id: Datadog::Runtime::Identity.id,
service: Datadog.configuration.service,
env: Datadog.configuration.env,
version: Datadog.configuration.version,
host: Datadog::Runtime::Socket.hostname,
language: Datadog::Runtime::Identity.lang,
runtime_engine: Datadog::Runtime::Identity.lang_engine,
runtime_platform: Datadog::Runtime::Identity.lang_platform,
runtime_version: Datadog::Runtime::Identity.lang_version,
profiler_version: Datadog::Runtime::Identity.tracer_version
)
end
end

context 'given full arguments' do
subject(:identifier) do
described_class.new(
start,
finish,
event_groups,
event_count,
runtime_id,
service,
env,
version,
host,
language,
runtime_engine,
runtime_platform,
runtime_version,
profiler_version
)
end

let(:start) { double('start') }
let(:finish) { double('finish') }
let(:event_groups) { double('event_groups') }
let(:event_count) { double('event_count') }
let(:runtime_id) { double('runtime_id') }
let(:service) { double('service') }
let(:env) { double('env') }
let(:version) { double('version') }
let(:host) { double('host') }
let(:language) { double('language') }
let(:runtime_engine) { double('runtime_engine') }
let(:runtime_platform) { double('runtime_platform') }
let(:runtime_version) { double('runtime_version') }
let(:profiler_version) { double('profiler_version') }

it do
is_expected.to have_attributes(
start: start,
finish: finish,
event_groups: event_groups,
event_count: event_count,
runtime_id: runtime_id,
service: service,
env: env,
version: version,
host: host,
language: language,
runtime_engine: runtime_engine,
runtime_platform: runtime_platform,
runtime_version: runtime_version,
profiler_version: profiler_version
)
end
end
end
end

0 comments on commit 183d2eb

Please sign in to comment.