Skip to content

Commit

Permalink
Add method name into telemetry in Context#run
Browse files Browse the repository at this point in the history
  • Loading branch information
Strech committed Nov 5, 2024
1 parent 2cbd6a1 commit f6f5f86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/appsec/processor/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(handle, telemetry:)
@events = []
@run_mutex = Mutex.new

@libddwaf_debug_tag = "libddwaf:#{WAF::VERSION::STRING}"
@libddwaf_debug_tag = "libddwaf:#{WAF::VERSION::STRING} method:ddwaf_run"
end

def run(persistent_data, ephemeral_data, timeout = WAF::LibDDWAF::DDWAF_RUN_TIMEOUT)
Expand Down
4 changes: 2 additions & 2 deletions spec/datadog/appsec/processor/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
end

it 'sends telemetry error' do
expect(telemetry).to receive(:error).with(/libddwaf:[\d.]+ execution error: :err_invalid_object/)
expect(telemetry).to receive(:error).with(/libddwaf:[\d.]+ method:ddwaf_run execution error: :err_invalid_object/)

context.run(input, {}, timeout)
end
Expand All @@ -269,7 +269,7 @@
let(:result) { context.run(input, {}, timeout) }

it 'sends telemetry report' do
expect(telemetry).to receive(:error).with(/libddwaf:[\d.]+ execution error: :err_internal/)
expect(telemetry).to receive(:error).with(/libddwaf:[\d.]+ method:ddwaf_run execution error: :err_internal/)
expect(telemetry).to receive(:report)
.with(kind_of(Datadog::AppSec::WAF::LibDDWAF::Error), description: 'libddwaf internal low-level error')

Expand Down

0 comments on commit f6f5f86

Please sign in to comment.