Skip to content

Commit

Permalink
Changed: TRACER_VERSION to GEM_DATADOG_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Mar 18, 2024
1 parent c0356bd commit 59a4e65
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/core/environment/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/core/environment/identity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/core/metrics/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/core/remote/transport/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/transport/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/core/environment/ext.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Datadog

RUBY_ENGINE: untyped

TRACER_VERSION: untyped
GEM_DATADOG_VERSION: untyped

ENGINE_VERSION: untyped
end
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/core/environment/identity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/datadog/core/telemetry/collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
3 changes: 2 additions & 1 deletion spec/datadog/tracing/transport/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 59a4e65

Please sign in to comment.