From 59a4e65165933e1074534be70e769b7561941c4d Mon Sep 17 00:00:00 2001 From: David Elner Date: Mon, 18 Mar 2024 15:47:42 -0400 Subject: [PATCH] Changed: TRACER_VERSION to GEM_DATADOG_VERSION --- lib/datadog/core/environment/ext.rb | 2 +- lib/datadog/core/environment/identity.rb | 4 ++-- lib/datadog/core/metrics/options.rb | 2 ++ lib/datadog/core/remote/transport/http.rb | 2 +- lib/datadog/tracing/transport/http.rb | 2 +- sig/datadog/core/environment/ext.rbs | 2 +- spec/datadog/core/environment/identity_spec.rb | 2 +- spec/datadog/core/telemetry/collector_spec.rb | 6 +++--- .../tracing/transport/http/adapters/net_integration_spec.rb | 2 +- .../transport/http/adapters/unix_socket_integration_spec.rb | 2 +- spec/datadog/tracing/transport/http_spec.rb | 3 ++- 11 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/datadog/core/environment/ext.rb b/lib/datadog/core/environment/ext.rb index 74808eeb828..d3c3a5d2992 100644 --- a/lib/datadog/core/environment/ext.rb +++ b/lib/datadog/core/environment/ext.rb @@ -38,7 +38,7 @@ module Ext TAG_SERVICE = 'service' TAG_VERSION = 'version' - TRACER_VERSION = Datadog::VERSION::STRING + GEM_DATADOG_VERSION = Datadog::VERSION::STRING end end end diff --git a/lib/datadog/core/environment/identity.rb b/lib/datadog/core/environment/identity.rb index bd0e2c92afb..52407609a98 100644 --- a/lib/datadog/core/environment/identity.rb +++ b/lib/datadog/core/environment/identity.rb @@ -49,9 +49,9 @@ def lang_version Core::Environment::Ext::LANG_VERSION end - # Returns tracer version, rubygems-style + # Returns datadog gem version, rubygems-style def tracer_version - Core::Environment::Ext::TRACER_VERSION + Core::Environment::Ext::GEM_DATADOG_VERSION end # Returns tracer version, comforming to https://semver.org/spec/v2.0.0.html diff --git a/lib/datadog/core/metrics/options.rb b/lib/datadog/core/metrics/options.rb index 10ea69b701b..2d9f074b133 100644 --- a/lib/datadog/core/metrics/options.rb +++ b/lib/datadog/core/metrics/options.rb @@ -14,6 +14,8 @@ module Options "#{Ext::TAG_LANG}:#{Environment::Identity.lang}", "#{Ext::TAG_LANG_INTERPRETER}:#{Environment::Identity.lang_interpreter}", "#{Ext::TAG_LANG_VERSION}:#{Environment::Identity.lang_version}", + # TODO: Technically not accurate, if tracing version diverges from datadog gem version + # If we extract tracing to its own gem, this needs to be updated. "#{Ext::TAG_TRACER_VERSION}:#{Environment::Identity.tracer_version}" ].freeze }.freeze diff --git a/lib/datadog/core/remote/transport/http.rb b/lib/datadog/core/remote/transport/http.rb index d902c96127f..ed87c0dc5cb 100644 --- a/lib/datadog/core/remote/transport/http.rb +++ b/lib/datadog/core/remote/transport/http.rb @@ -115,7 +115,7 @@ def default_headers Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER => Datadog::Core::Environment::Ext::LANG_INTERPRETER, Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => - Datadog::Core::Environment::Ext::TRACER_VERSION + Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION }.tap do |headers| # Add container ID, if present. container_id = Datadog::Core::Environment::Container.container_id diff --git a/lib/datadog/tracing/transport/http.rb b/lib/datadog/tracing/transport/http.rb index 423855b5ef1..25a7e77c426 100644 --- a/lib/datadog/tracing/transport/http.rb +++ b/lib/datadog/tracing/transport/http.rb @@ -69,7 +69,7 @@ def default_headers Datadog::Core::Environment::Ext::LANG_INTERPRETER, Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER_VENDOR => Core::Environment::Ext::LANG_ENGINE, Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => - Datadog::Core::Environment::Ext::TRACER_VERSION + Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION }.tap do |headers| # Add container ID, if present. container_id = Datadog::Core::Environment::Container.container_id diff --git a/sig/datadog/core/environment/ext.rbs b/sig/datadog/core/environment/ext.rbs index dbc3431279f..328bdfc4e9e 100644 --- a/sig/datadog/core/environment/ext.rbs +++ b/sig/datadog/core/environment/ext.rbs @@ -14,7 +14,7 @@ module Datadog RUBY_ENGINE: untyped - TRACER_VERSION: untyped + GEM_DATADOG_VERSION: untyped ENGINE_VERSION: untyped end diff --git a/spec/datadog/core/environment/identity_spec.rb b/spec/datadog/core/environment/identity_spec.rb index 007081d7902..af4b127106d 100644 --- a/spec/datadog/core/environment/identity_spec.rb +++ b/spec/datadog/core/environment/identity_spec.rb @@ -67,7 +67,7 @@ describe '::tracer_version' do subject(:tracer_version) { described_class.tracer_version } - it { is_expected.to eq(Datadog::Core::Environment::Ext::TRACER_VERSION) } + it { is_expected.to eq(Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION) } end describe '::tracer_version_semver2' do diff --git a/spec/datadog/core/telemetry/collector_spec.rb b/spec/datadog/core/telemetry/collector_spec.rb index 1a6a78b537b..bd9a3768dde 100644 --- a/spec/datadog/core/telemetry/collector_spec.rb +++ b/spec/datadog/core/telemetry/collector_spec.rb @@ -95,7 +95,7 @@ before do Datadog.configuration.profiling.enabled = false Datadog.configuration.appsec.enabled = false - stub_const('Datadog::Core::Environment::Ext::TRACER_VERSION', '4.2') + stub_const('Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION', '4.2') end after do @@ -272,7 +272,7 @@ context 'when profiling is enabled' do before do - stub_const('Datadog::Core::Environment::Ext::TRACER_VERSION', '4.2') + stub_const('Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION', '4.2') Datadog.configure do |c| c.profiling.enabled = true end @@ -286,7 +286,7 @@ before do require 'datadog/appsec' - stub_const('Datadog::Core::Environment::Ext::TRACER_VERSION', '4.2') + stub_const('Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION', '4.2') Datadog.configure do |c| c.appsec.enabled = true end diff --git a/spec/datadog/tracing/transport/http/adapters/net_integration_spec.rb b/spec/datadog/tracing/transport/http/adapters/net_integration_spec.rb index efa3faa68e1..2c70b30cac8 100644 --- a/spec/datadog/tracing/transport/http/adapters/net_integration_spec.rb +++ b/spec/datadog/tracing/transport/http/adapters/net_integration_spec.rb @@ -84,7 +84,7 @@ 'datadog-meta-lang' => [Datadog::Core::Environment::Ext::LANG], 'datadog-meta-lang-version' => [Datadog::Core::Environment::Ext::LANG_VERSION], 'datadog-meta-lang-interpreter' => [Datadog::Core::Environment::Ext::LANG_INTERPRETER], - 'datadog-meta-tracer-version' => [Datadog::Core::Environment::Ext::TRACER_VERSION], + 'datadog-meta-tracer-version' => [Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION], 'content-type' => ['application/msgpack'], 'x-datadog-trace-count' => [traces.length.to_s] ) diff --git a/spec/datadog/tracing/transport/http/adapters/unix_socket_integration_spec.rb b/spec/datadog/tracing/transport/http/adapters/unix_socket_integration_spec.rb index 1310ec732e2..4e3230cc31a 100644 --- a/spec/datadog/tracing/transport/http/adapters/unix_socket_integration_spec.rb +++ b/spec/datadog/tracing/transport/http/adapters/unix_socket_integration_spec.rb @@ -95,7 +95,7 @@ def cleanup_socket 'datadog-meta-lang' => [Datadog::Core::Environment::Ext::LANG], 'datadog-meta-lang-version' => [Datadog::Core::Environment::Ext::LANG_VERSION], 'datadog-meta-lang-interpreter' => [Datadog::Core::Environment::Ext::LANG_INTERPRETER], - 'datadog-meta-tracer-version' => [Datadog::Core::Environment::Ext::TRACER_VERSION], + 'datadog-meta-tracer-version' => [Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION], 'content-type' => ['application/msgpack'], 'x-datadog-trace-count' => [traces.length.to_s] ) diff --git a/spec/datadog/tracing/transport/http_spec.rb b/spec/datadog/tracing/transport/http_spec.rb index feae6028d76..830f9d372f1 100644 --- a/spec/datadog/tracing/transport/http_spec.rb +++ b/spec/datadog/tracing/transport/http_spec.rb @@ -160,7 +160,8 @@ Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER => Datadog::Core::Environment::Ext::LANG_INTERPRETER, 'Datadog-Meta-Lang-Interpreter-Vendor' => RUBY_ENGINE, - Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => Datadog::Core::Environment::Ext::TRACER_VERSION + Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => + Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION ) end