Skip to content

Commit

Permalink
Fix bug where Tracing::AgentSettingsResolver wasn't being passed para…
Browse files Browse the repository at this point in the history
…m logger (#3076)

* Fix bug where Tracing::AgentSettingsResolver wasn't being passed param logger

* re-add types from profiling/components.rbs accidentally removed in 94158db
  • Loading branch information
ekump authored Aug 25, 2023
1 parent be628e2 commit 09c0862
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/tracing/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build_tracer(settings, logger:)
tracer = settings.tracing.instance
return tracer unless tracer.nil?

agent_settings = Configuration::AgentSettingsResolver.call(settings, logger: @logger)
agent_settings = Configuration::AgentSettingsResolver.call(settings, logger: logger)

# Apply test mode settings if test mode is activated
if settings.tracing.test_mode.enabled
Expand Down
37 changes: 27 additions & 10 deletions sig/datadog/profiling/component.rbs
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
module Datadog
module Profiling
module Component
def self.build_profiler_component: (settings: untyped, logger: untyped, optional_tracer: untyped) -> (nil | untyped)
def self.build_profiler_component: (
settings: untyped,
logger: untyped,
optional_tracer: Datadog::Tracing::Tracer?,
) -> Datadog::Profiling::Profiler?

def self.build_profiler_old_recorder: (untyped settings) -> untyped
def self.build_profiler_old_recorder: (untyped settings) -> Datadog::Profiling::OldRecorder

def self.build_profiler_exporter: (untyped settings, untyped recorder, internal_metadata: untyped) -> untyped
def self.build_profiler_exporter: (
untyped settings,
(Datadog::Profiling::StackRecorder | Datadog::Profiling::OldRecorder) recorder,
internal_metadata: ::Hash[::Symbol, ::String | bool | ::Numeric],
) -> Datadog::Profiling::Exporter

def self.build_profiler_oldstack_collector: (untyped settings, untyped old_recorder, untyped tracer) -> untyped
def self.build_profiler_oldstack_collector: (
untyped settings,
Datadog::Profiling::OldRecorder old_recorder,
Datadog::Tracing::Tracer? tracer,
) -> Datadog::Profiling::Collectors::OldStack

def self.build_profiler_transport: (untyped settings, untyped agent_settings) -> untyped
def self.build_profiler_transport: (
untyped settings,
Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings agent_settings
) -> untyped

def self.enable_gc_profiling?: (untyped settings) -> (true | false)
def self.enable_gc_profiling?: (untyped settings) -> bool

def self.enable_new_profiler?: (untyped settings) -> (false | true)
def self.enable_new_profiler?: (untyped settings) -> bool

def self.no_signals_workaround_enabled?: (untyped settings) -> (false | true)
def self.incompatible_libmysqlclient_version?: (untyped settings) -> (true | untyped)
def self.load_pprof_support: () -> untyped
def self.no_signals_workaround_enabled?: (untyped settings) -> bool

def self.incompatible_libmysqlclient_version?: (untyped settings) -> bool

def self.load_pprof_support: () -> void
end
end
end
4 changes: 4 additions & 0 deletions spec/datadog/core/configuration/components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@
allow(Datadog::Tracing::Writer).to receive(:new)
.with(agent_settings: agent_settings, **writer_options)
.and_return(writer)

expect(Datadog::Tracing::Configuration::AgentSettingsResolver).to receive(:call)
.with(settings, logger: logger)
.and_return(agent_settings)
end

after do
Expand Down
4 changes: 4 additions & 0 deletions spec/datadog/profiling/component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@

settings.profiling.enabled = true
allow(profiler_setup_task).to receive(:run)

expect(Datadog::Profiling::AgentSettingsResolver).to receive(:call)
.with(settings, logger: logger)
.and_return(agent_settings)
end

context 'when using the legacy profiler' do
Expand Down

0 comments on commit 09c0862

Please sign in to comment.