Skip to content

Commit

Permalink
parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed May 10, 2024
1 parent 24f49ae commit 7cc3069
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
15 changes: 15 additions & 0 deletions lib/datadog/debugger/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ def build(settings)

def shutdown!(replacement = nil)
end

def add_probe_from_remote(config)
where = config.fetch('where')
if where.key?('sourceFile')
file = where.fetch('sourceFile')
lines = where.fetch('lines')

lines.each do |line|
line = Integer(line)
Hook.hook_line(file, line) do
puts 'hook executed'
end
end
end
end
end
end
end
18 changes: 4 additions & 14 deletions lib/datadog/debugger/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,13 @@ def capabilities
end

def process_config(config, content)
p config,content
lib_config = config['lib_config']

env_vars = Datadog::Tracing::Configuration::Dynamic::OPTIONS.map do |name, env_var, option|
value = lib_config[name]

# Guard for RBS/Steep
raise "option is a #{option.class}, expected Option" unless option.is_a?(Configuration::Dynamic::Option)

option.call(value)

[env_var, value]
end
# content is one probe info
component = Datadog.send(:components).debugger
component.add_probe_from_remote(config)

content.applied

Datadog.send(:components).telemetry.client_configuration_change!(env_vars)
# Datadog.send(:components).telemetry.client_configuration_change!(env_vars)
rescue => e
raise
content.errored("#{e.class.name} #{e.message}: #{Array(e.backtrace).join("\n")}")
Expand Down

0 comments on commit 7cc3069

Please sign in to comment.