Skip to content

creating install.json file related to apm single step instrumation #572

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

Merged
merged 15 commits into from
Jun 18, 2024

Conversation

schneideradam
Copy link
Contributor

@schneideradam schneideradam commented Jun 11, 2024

What does this PR do?

This PR makes the agent install ansible collection write an install.json file to the same directory as the Agent config file, datadog.yaml. The install.json file contains a random UUID, an installation timestamp, and the mechanism that was used to install the agent (the hardcoded string ansible_manual or ansible_single_step). The agent will send this information to the Datadog backend, so that we can gather telemetric data on how long users take to onboard after the initial installation of the agent.

Motivation

Jira: https://datadoghq.atlassian.net/browse/APMON-1070 . This is part of our broader work on improving the APM onboarding experience.

Additional Notes

Possible Drawbacks / Trade-offs

I am not copying these changes to the agent-dmg, iot-agent-deb or iot-agent-rpm directories, because we are initially focusing on improving the onboarding experience on Linux.

Describe how to test/QA your changes

Quick test

There isn't a quick test because of the nature of the ansible installer. Please follow the non-quick test below.

End to end test

To test, I first spun up a gcp RHEL instance and pulled the latest branch code. I installed ansible-core v2.11.12. I confirmed that the datadog_apm_instrumentation_enabled was set to "host".
From there I ran the playbook with the manual test listed in the command below:

ansible-playbook -i localhost, manual_tests/test_7_full.yml --connection=local

I checked in /etc/datadog-agent to ensure install.json existed and had the following values:
{"install_id": "88d5cfef-2f72-4b59-af8d-1e07b71b684b", "install_type": "ansible_single_step", "install_time": 1718116519}

I then changed the value for datadog_apm_instrumentation_enabled to an empty string "" and re-ran the command. I observed that the following install.json updated with the following:

{"install_id": "88d5cfef-2f72-4b59-af8d-1e07b71b684b", "install_type": "ansible_manual", "install_time": 1718116519}

I repeated all above steps in debian.

@schneideradam schneideradam requested a review from a team as a code owner June 11, 2024 13:49
Copy link

@yshapiro-57 yshapiro-57 left a comment

Choose a reason for hiding this comment

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

Is there any test plan that can be run to install the agent on Ansible with this code in place and verify that an install.json file gets generated?

@schneideradam
Copy link
Contributor Author

I have verified this on both rhel and debian. I checked with both datadog_apm_instrumentation_enabled enabled, and disabled, and verified the correct behavior. Let me know if that is adequate. I can share screenshots if you'd like.

Copy link

@yshapiro-57 yshapiro-57 left a comment

Choose a reason for hiding this comment

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

@schneideradam I trust you, you don't have to upload screenshots. I am just a fan of leaving test plans on PRs so that my successor knows how to maintain my code after I get promoted to VP and no longer have time to deal with this stuff.

Thank you very much again for helping me and @yahya-mouman on short notice with these changes. This was very nice of you.

@schneideradam
Copy link
Contributor Author

@yshapiro-57 Do you mean you'd like to see some sort of CI unit test? Or instructions on how to test this PR? I'm happy to do whatever, I just usually don't worry about testing something like this when it should just fail silently so as not to get in the way of instrumenting their applications.

@yshapiro-57
Copy link

@schneideradam I was thinking something like this wiki or the end to end test plan on this PR; something that explains to a fresh person how to cause this code to be executed in a local environment.

Again, if you don't already have a writeup handy, and putting one together is time-consuming, then don't worry about it. I think it will be fine to document the testing steps on RHEL and Debian another time.

@schneideradam
Copy link
Contributor Author

@spencergilbert Can we get this merged? Also, what is the process for deploying to ansible-galaxy?

@spencergilbert spencergilbert merged commit c7953c5 into DataDog:main Jun 18, 2024
115 checks passed
@spencergilbert
Copy link
Contributor

Followed up internally regarding release, expected publishing next week.

@Kyle-Verhoog
Copy link
Member

@spencergilbert did the release go out?

cc @alexbryukhanova

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.

4 participants