Skip to content

Comments

Fix Datadog log-query to use Logs API instead of Error Tracking API#1043

Merged
neubig merged 5 commits intomainfrom
fix-datadog-log-query-api
Nov 6, 2025
Merged

Fix Datadog log-query to use Logs API instead of Error Tracking API#1043
neubig merged 5 commits intomainfrom
fix-datadog-log-query-api

Conversation

@neubig
Copy link
Contributor

@neubig neubig commented Nov 5, 2025

Problem

The Datadog debugging workflow was downloading zero examples when using text-based queries.

Example from issue #5:
Query "or as a global setting instead" returned "total_examples": 0

Root Cause

The script was using the Datadog Error Tracking API for log-query mode:

  • API: https://api.{dd_site}/api/v2/error-tracking/issues/search
  • This API only searches pre-indexed error tracking issues, NOT arbitrary log text
  • Text queries return empty results: {"data": []}

Solution

Changed the log-query mode to use the Datadog Logs Search API:

  • API: https://api.{dd_site}/api/v2/logs/events/search
  • This API properly searches log content by text
  • Same query now returns 5 log entries with full details

Changes Made

Modified examples/03_github_workflows/04_datadog_debugging/datadog_debugging.py:

  • ✅ Changed API endpoint from Error Tracking to Logs Search
  • ✅ Updated request body format (filter/page/sort structure)
  • ✅ Changed timestamp format from milliseconds to ISO format
  • ✅ Updated response parsing to extract log entry fields (message, service, host, tags, etc.)
  • ✅ Updated docstring to clarify API usage

Testing

Tested with the same query from issue #5:

  • Query: "or as a global setting instead"
  • Before: 0 examples ❌
  • After: 5 examples ✅ (with message, service, host, tags, etc.)

Impact

This fix ensures that text-based log queries return actual log examples, making the Datadog debugging workflow functional for text searches.

@neubig can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:d1e6ad9-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-d1e6ad9-python \
  ghcr.io/openhands/agent-server:d1e6ad9-python

All tags pushed for this build

ghcr.io/openhands/agent-server:d1e6ad9-golang-amd64
ghcr.io/openhands/agent-server:v1.0.0_golang_tag_1.21-bookworm_binary-amd64
ghcr.io/openhands/agent-server:d1e6ad9-golang-arm64
ghcr.io/openhands/agent-server:v1.0.0_golang_tag_1.21-bookworm_binary-arm64
ghcr.io/openhands/agent-server:d1e6ad9-java-amd64
ghcr.io/openhands/agent-server:v1.0.0_eclipse-temurin_tag_17-jdk_binary-amd64
ghcr.io/openhands/agent-server:d1e6ad9-java-arm64
ghcr.io/openhands/agent-server:v1.0.0_eclipse-temurin_tag_17-jdk_binary-arm64
ghcr.io/openhands/agent-server:d1e6ad9-python-amd64
ghcr.io/openhands/agent-server:v1.0.0_nikolaik_s_python-nodejs_tag_python3.12-nodejs22_binary-amd64
ghcr.io/openhands/agent-server:d1e6ad9-python-arm64
ghcr.io/openhands/agent-server:v1.0.0_nikolaik_s_python-nodejs_tag_python3.12-nodejs22_binary-arm64
ghcr.io/openhands/agent-server:d1e6ad9-golang
ghcr.io/openhands/agent-server:d1e6ad9-java
ghcr.io/openhands/agent-server:d1e6ad9-python

About Multi-Architecture Support

  • Each variant tag (e.g., d1e6ad9-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., d1e6ad9-python-amd64) are also available if needed

- Changed log-query mode from Error Tracking API to Logs Search API
- Error Tracking API only searches pre-indexed error issues, not arbitrary text
- Logs API properly searches log content by text queries
- Updated request format to use filter/page/sort structure for Logs API
- Updated response parsing to extract log entry fields (message, service, host, etc.)
- Fixes issue where text-based queries returned zero examples

Co-authored-by: openhands <openhands@all-hands.dev>
@openhands-ai
Copy link

openhands-ai bot commented Nov 5, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Pre-commit checks

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #1043 at branch `fix-datadog-log-query-api`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@neubig neubig marked this pull request as ready for review November 5, 2025 21:09
@neubig neubig requested a review from simonrosenberg November 5, 2025 21:11
@neubig neubig merged commit 84fe9f0 into main Nov 6, 2025
20 checks passed
@neubig neubig deleted the fix-datadog-log-query-api branch November 6, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants