Skip to content

APMS-15590 explicitly handle error responses from agent to RC requests#4669

Merged
p-datadog merged 6 commits into
masterfrom
rc-error-response
May 21, 2025
Merged

APMS-15590 explicitly handle error responses from agent to RC requests#4669
p-datadog merged 6 commits into
masterfrom
rc-error-response

Conversation

@p-datadog

@p-datadog p-datadog commented May 19, 2025

Copy link
Copy Markdown
Member

What does this PR do?
When agent returns an error to RC request, dd-trace-rb will now report this as an agent error.

Before:

E, [2025-05-19T15:22:07.958120 #34618] ERROR -- datadog: [datadog] (/home/w/apps/dd-trace-rb/lib/datadog/core/remote/component.rb:52:in `rescue in block in initialize') remote worker error: Datadog::Core::Remote::Client::TransportError #<Datadog::Core::Transport::InternalErrorResponse:0x00007b1ae6f0d918>, error_type:Datadog::Core::Remote::Transport::HTTP::Config::Response::ParseError error:could not parse key :roots: #<JSON::ParserError:"unexpected token at 'rpc error: code = DeadlineExceeded desc = context deadline exceeded\n'"> location: /home/w/apps/dd-trace-rb/lib/datadog/core/remote/client.rb:35:in `sync'. reseting client state

After:

E, [2025-05-19T15:21:24.642331 #73584] ERROR -- datadog: [datadog] (/home/w/apps/dd-trace-rb/lib/datadog/core/remote/component.rb:52:in `rescue in block in initialize') remote worker error: Datadog::Core::Remote::Client::TransportError #<Datadog::Core::Transport::InternalErrorResponse:0x000077f887267760>, error_type:Datadog::Core::Remote::Transport::HTTP::Config::Response::AgentErrorResponse error:Agent returned an error response: 500: rpc error: code = DeadlineExceeded desc = context deadline exceeded

Motivation:

Existing reporting can be confusing as to whether there is an issue with the tracer. The new language should make it clear that the tracer is simply reporting an error that the agent produced.

Change log entry
Yes: improve tracer error reporting when agent responds with error responses to remote configuration requests

Additional Notes:

How to test the change?
Unit test added

@github-actions github-actions Bot added the core Involves Datadog core libraries label May 19, 2025
@github-actions

github-actions Bot commented May 19, 2025

Copy link
Copy Markdown

Thank you for updating Change log entry section 👏

Visited at: 2025-05-19 19:23:37 UTC

@codecov-commenter

codecov-commenter commented May 19, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.73%. Comparing base (6f87326) to head (e5fa9e4).
Report is 561 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4669      +/-   ##
==========================================
- Coverage   97.73%   97.73%   -0.01%     
==========================================
  Files        1453     1455       +2     
  Lines       87316    87359      +43     
  Branches     4487     4490       +3     
==========================================
+ Hits        85340    85381      +41     
- Misses       1976     1978       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented May 19, 2025

Copy link
Copy Markdown
Contributor

Datadog Report

Branch report: rc-error-response
Commit report: e5fa9e4
Test service: dd-trace-rb

✅ 0 Failed, 21296 Passed, 1373 Skipped, 3m 43.56s Total Time

@p-datadog
p-datadog force-pushed the rc-error-response branch from aeda810 to 057cd78 Compare May 19, 2025 19:17
@p-datadog
p-datadog marked this pull request as ready for review May 19, 2025 19:23
@p-datadog
p-datadog requested a review from a team as a code owner May 19, 2025 19:23
@p-datadog p-datadog changed the title explicitly handle error responses from agent to RC requests APMS-15590 explicitly handle error responses from agent to RC requests May 19, 2025
@pr-commenter

pr-commenter Bot commented May 19, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-05-19 19:52:39

Comparing candidate commit bce78bf in PR branch rc-error-response with baseline commit b0c64c0 in branch master.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 42 metrics, 2 unstable metrics.

scenario:tracing - Propagation - Datadog

  • 🟩 throughput [+3252.439op/s; +3328.366op/s] or [+11.263%; +11.526%]

@Strech Strech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few non-blocking suggestion

Comment thread lib/datadog/core/remote/transport/http/config.rb
Comment thread lib/datadog/core/remote/transport/http/config.rb Outdated
@p-datadog
p-datadog merged commit 7de1732 into master May 21, 2025
@p-datadog
p-datadog deleted the rc-error-response branch May 21, 2025 16:24
@github-actions github-actions Bot added this to the 2.17.0 milestone May 21, 2025
@p-datadog p-datadog mentioned this pull request Jun 2, 2025
p-datadog pushed a commit that referenced this pull request May 13, 2026
Revert "RC: include response details in TransportError message"

Switching approach: fix InternalErrorResponse#to_s directly instead of
changing the raise site. The previous approach only swapped an
"#<...:0xADDR>" prefix for a string of mostly-nil predicates without
adding signal beyond what PR #4669 already produces.
p-datadog pushed a commit that referenced this pull request May 13, 2026
The Response module does not define to_s, so the super call in
InternalErrorResponse#to_s resolves to Object#to_s and emits
"#<Datadog::Core::Transport::InternalErrorResponse:0xADDR>" as the
prefix of the error message — replacing the wrapped exception info that
follows with a memory address.

Replace super with self.class so the prefix is the class name rather
than the default object identifier. The trailing
"error_type:<klass> error:<message>" portion (already useful since
PR #4669 added AgentErrorResponse with an informative message) is
unchanged.

Reported in https://github.com/DataDog/ruby-guild/issues/241.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants