Skip to content

Conversation

@rarguelloF
Copy link
Contributor

@rarguelloF rarguelloF commented Oct 27, 2025

What does this PR do?

We were reading the response body after the request context is canceled, which was triggering an error in the io.ReadAll(resp.Body) call in certain cases (observed it happening when the response included the header Transfer-Encoding: chunked).

Additionally, it improves the error messages for better debugging and checks for the presence of an app key in dataset.Pull when running in agentless mode, similar as the other dataset public functions.

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@pr-commenter
Copy link

pr-commenter bot commented Oct 27, 2025

Benchmarks

Benchmark execution time: 2025-10-28 15:27:11

Comparing candidate commit e0c6721 in PR branch rarguelloF/improve-llmobs-errors with baseline commit 99623ba in branch main.

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

@rarguelloF rarguelloF changed the title chore(llmobs): include server response in llmobs errors fix(llmobs): do not cancel the context before reading response bodies Oct 27, 2025
@rarguelloF rarguelloF marked this pull request as ready for review October 27, 2025 21:02
@rarguelloF rarguelloF requested a review from a team as a code owner October 27, 2025 21:02
Copy link

@gary-huang gary-huang left a comment

Choose a reason for hiding this comment

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

just a few comments about log lines

thanks!

if !strings.Contains(contentType, "application/json") {
return ""
}
// Limit reading to 1KB to avoid reading huge error responses

Choose a reason for hiding this comment

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

i guess it's fine to start like this but why not read the whole thing? imo this is internal use (for now) so there is no issue with reading big error responses, if anything it would be helpful for debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense! will change

@rarguelloF
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Oct 28, 2025

View all feedbacks in Devflow UI.

2025-10-28 17:53:40 UTC ℹ️ Start processing command /merge


2025-10-28 17:53:45 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 18m (p90).


2025-10-28 18:18:09 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit 3b824da into main Oct 28, 2025
243 checks passed
@dd-mergequeue dd-mergequeue bot deleted the rarguelloF/improve-llmobs-errors branch October 28, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants