From 104942486bb6e182fd2063ef5a055339ba17139d Mon Sep 17 00:00:00 2001 From: David Elner Date: Tue, 8 Sep 2020 15:59:04 -0400 Subject: [PATCH] Added: runtime_engine and runtime_platform tags to profiling HTTP request. --- lib/ddtrace/ext/profiling.rb | 2 ++ lib/ddtrace/profiling/transport/http/api/endpoint.rb | 7 +++++-- .../transport/http/adapters/net_integration_spec.rb | 6 ++++-- spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb | 6 ++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/ddtrace/ext/profiling.rb b/lib/ddtrace/ext/profiling.rb index 7b1bb5c176e..bfa734e912d 100644 --- a/lib/ddtrace/ext/profiling.rb +++ b/lib/ddtrace/ext/profiling.rb @@ -28,6 +28,8 @@ module HTTP FORM_FIELD_TAG_LANGUAGE = 'language'.freeze FORM_FIELD_TAG_PROFILER_VERSION = 'profiler_version'.freeze FORM_FIELD_TAG_RUNTIME = 'runtime'.freeze + FORM_FIELD_TAG_RUNTIME_ENGINE = 'runtime_engine'.freeze + FORM_FIELD_TAG_RUNTIME_PLATFORM = 'runtime_platform'.freeze FORM_FIELD_TAG_RUNTIME_VERSION = 'runtime_version'.freeze FORM_FIELD_TAG_SERVICE = 'service'.freeze FORM_FIELD_TAG_VERSION = 'version'.freeze diff --git a/lib/ddtrace/profiling/transport/http/api/endpoint.rb b/lib/ddtrace/profiling/transport/http/api/endpoint.rb index aa78c8f850f..28def19103f 100644 --- a/lib/ddtrace/profiling/transport/http/api/endpoint.rb +++ b/lib/ddtrace/profiling/transport/http/api/endpoint.rb @@ -42,14 +42,17 @@ def build_form(env) FORM_FIELD_RECORDING_START => flush.start.utc.iso8601, FORM_FIELD_RECORDING_END => flush.finish.utc.iso8601, FORM_FIELD_TAGS => [ - "#{FORM_FIELD_TAG_RUNTIME}:#{flush.runtime}", + "#{FORM_FIELD_TAG_RUNTIME}:#{flush.language}", + "#{FORM_FIELD_TAG_RUNTIME_ENGINE}:#{flush.runtime_engine}", + "#{FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{flush.runtime_platform}", "#{FORM_FIELD_TAG_RUNTIME_VERSION}:#{flush.runtime_version}", "#{FORM_FIELD_TAG_PROFILER_VERSION}:#{flush.profiler_version}", + # NOTE: Redundant w/ 'runtime'; may want to remove this later. "#{FORM_FIELD_TAG_LANGUAGE}:#{flush.language}", "#{FORM_FIELD_TAG_HOST}:#{flush.host}" ], FORM_FIELD_DATA => pprof_file, - FORM_FIELD_RUNTIME => flush.runtime, + FORM_FIELD_RUNTIME => flush.language, FORM_FIELD_FORMAT => FORM_FIELD_FORMAT_PPROF } diff --git a/spec/ddtrace/profiling/transport/http/adapters/net_integration_spec.rb b/spec/ddtrace/profiling/transport/http/adapters/net_integration_spec.rb index edab57948da..f54ecd5c939 100644 --- a/spec/ddtrace/profiling/transport/http/adapters/net_integration_spec.rb +++ b/spec/ddtrace/profiling/transport/http/adapters/net_integration_spec.rb @@ -88,7 +88,7 @@ 'recording-end' => kind_of(String), 'data[0]' => kind_of(String), 'types[0]' => /auto/, - 'runtime' => Datadog::Ext::Runtime::LANG_INTERPRETER, + 'runtime' => Datadog::Ext::Runtime::LANG, 'format' => Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT_PPROF ) @@ -96,7 +96,9 @@ tags = body["#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAGS}[]"].list expect(tags).to be_a_kind_of(Array) expect(tags).to include( - /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{Datadog::Ext::Runtime::LANG_INTERPRETER}/, + /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{Datadog::Ext::Runtime::LANG}/, + /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_ENGINE}:#{Datadog::Ext::Runtime::LANG_ENGINE}/, + /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{Datadog::Ext::Runtime::LANG_PLATFORM}/, /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_VERSION}:#{Datadog::Ext::Runtime::LANG_VERSION}/, /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION}:#{Datadog::Ext::Runtime::TRACER_VERSION}/, /#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{Datadog::Ext::Runtime::LANG}/ diff --git a/spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb b/spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb index c3a842fae0f..772d07bf73d 100644 --- a/spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb +++ b/spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb @@ -62,10 +62,12 @@ Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT => Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT_PPROF, Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RECORDING_START => flush.start.utc.iso8601, Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RECORDING_END => flush.finish.utc.iso8601, - Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME => flush.runtime, + Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME => flush.language, Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME_ID => flush.runtime_id, Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAGS => array_including( - "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{flush.runtime}", + "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{flush.language}", + "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_ENGINE}:#{flush.runtime_engine}", + "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{flush.runtime_platform}", "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_VERSION}:#{flush.runtime_version}", "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION}:#{flush.profiler_version}", "#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",