Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init commit debug utils #30474

Merged
merged 25 commits into from
Nov 5, 2024
Merged

init commit debug utils #30474

merged 25 commits into from
Nov 5, 2024

Conversation

clarkb7
Copy link
Contributor

@clarkb7 clarkb7 commented Oct 24, 2024

What does this PR do?

Add invoke tasks (and helpers) to

  • download coredump file from Gitlab job artifacts
  • download Agent debug symbols from Gitlab job artifacts (auto-finds the package build job in the pipeline)
  • download Agent debug symbols for released versions

implemented fetch/extract for windows, suse, and debian debug packages.

  • some tools may be required, such as rpm2cpio and dpkg-deb
# download dump from 681900370 and symbols from pipeline and launch delve
inv debugging.debug-job-dump --job-id 681900370 --platform windows
# download symbols from pipeline
inv debugging.get-debug-symbols --job-id 681900370 --platform debian
# download symbols for version
inv debugging.dump.get-debug-symbols --version 7.57.0 --platform windows

persists/caches downloaded files into ~/.agent-crash-analyzer/

/home/brandenclark/.agent-crash-analyzer
├── artifacts
│   └── datadog-agent
│       ├── 681900223
│       ├── 681900226
│       ├── 681900227
│       └── 681900370
└── symbols
    ├── 7.57.0
    │   ├── debian
    │   │   ├── arm64
    │   │   └── x86_64
    │   ├── suse
    │   │   └── x86_64
    │   └── windows
    │       └── x86_64
    └── 7.58.0-installer-0.6.0.git.119.b718ef8.pipeline.47264433
        ├── debian
        │   └── x86_64
        ├── suse
        │   ├── arm64
        │   └── x86_64
        └── windows
            └── x86_64

Motivation

automation

  • very clicky to get artifacts/symbols/dumps
  • debug packages for different platforms are in different places, jobs, can be hard to find

based on info from https://datadoghq.atlassian.net/wiki/spaces/agent/pages/3777987099/Loading+an+agent+core+dump

Describe how to test/QA your changes

run unit tests

cd tasks/debugging; inv invoke-unit-tests.run -v 2

run some of the invoke tasks and see if you get symbols/dumps

Possible Drawbacks / Trade-offs

there doesn't seem to be a way to list artifacts or download a specific artifact, so all the artifacts get downloaded.
This is nice for e2e test artifacts because you get the dump and the agent logs
but is not nice for package build artifacts when we only care about the debug symbol archive and the other artifacts are large. maybe we could upload the debug packages to the mstesting bucket, too.

Additional Notes

Not sure where to get debug symbols for release candidate builds for Linux platforms

@clarkb7 clarkb7 added changelog/no-changelog team/windows-agent qa/no-code-change No code change in Agent code requiring validation labels Oct 24, 2024
@clarkb7 clarkb7 requested review from a team as code owners October 24, 2024 23:11
Copy link

cit-pr-commenter bot commented Oct 25, 2024

Regression Detector

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Oct 25, 2024

[Fast Unit Tests Report]

On pipeline 47920908 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_deb-arm64-py3
  • tests_deb-x64-py3
  • tests_flavor_dogstatsd_deb-x64
  • tests_flavor_heroku_deb-x64
  • tests_flavor_iot_deb-x64
  • tests_rpm-arm64-py3
  • tests_rpm-x64-py3
  • tests_windows-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-devx-help

tasks/debugging/dump.py Show resolved Hide resolved
tasks/debugging/dump.py Outdated Show resolved Hide resolved
tasks/debugging/dump.py Outdated Show resolved Hide resolved
tasks/debugging/dump.py Show resolved Hide resolved
Comment on lines +258 to +259
# TODO: hacky way to get the version from the archive name, is there a better way?
# the setup-agent-version job stores the version in a private bucket.
Copy link
Member

@KevinFairise2 KevinFairise2 Oct 30, 2024

Choose a reason for hiding this comment

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

I think we should be able to compute using that function:

@task
def version(
ctx,
url_safe=False,
omnibus_format=False,
git_sha_length=7,
major_version='7',
cache_version=False,
pipeline_id=None,
include_git=True,
include_pre=True,
release=False,
):

But not sure what parameters you would need to pass.
If that works like that I guess this is fine for a first PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this leads to query_version which runs git commands. If those commands support being given a refspec i might be able to give it commit hash from the pipeline, but it would only work if you have the refspec locally, too. it might be nice to have a clone of the repo at that commit, though, so the source matches.

@github-actions github-actions bot added the long review PR is complex, plan time to review it label Oct 30, 2024
@clarkb7 clarkb7 requested a review from KevinFairise2 October 31, 2024 17:08
@clarkb7
Copy link
Contributor Author

clarkb7 commented Nov 5, 2024

/merge

@dd-devflow
Copy link

dd-devflow bot commented Nov 5, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 22m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit 4dacc6f into main Nov 5, 2024
208 checks passed
@dd-mergequeue dd-mergequeue bot deleted the branden.clark/debug-utils branch November 5, 2024 14:59
@github-actions github-actions bot added this to the 7.61.0 milestone Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog long review PR is complex, plan time to review it qa/no-code-change No code change in Agent code requiring validation team/windows-agent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants