Skip to content

Commit

Permalink
[AGENTRUN-96] Update Go version to 1.23.6 (#33934)
Browse files Browse the repository at this point in the history
Co-authored-by: jeremy-hanna <[email protected]> fa9884f
  • Loading branch information
dd-mergequeue[bot] committed Feb 13, 2025
1 parent 119abfd commit b41f5e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</code></pre></div> <p>On Windows, install Python 2.7 and/or 3.12 via the <a href=https://www.python.org/downloads/ >official installer</a> brings along all the development files needed:</p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>If you don't use one of the Python versions that are explicitly supported, you may have problems running the built Agent's Python checks, especially if using a virtualenv. At this time, only Python 3.12 is confirmed to work as expected in the development environment.</p> </div> <h4 id=python-dependencies>Python Dependencies<a class=headerlink href=#python-dependencies title="Permanent link">&para;</a></h4> <p>To protect and isolate your system-wide python installation, a python virtual environment is <em>highly</em> recommended (though optional). It will help keep a self-contained development environment and ensure a clean system Python.</p> <div class="admonition note"> <p class=admonition-title>Note</p> <p>Due to the <a href=https://bugs.python.org/issue22213>way some virtual environments handle executable paths</a> (e.g. <code>python -m venv</code>), not all virtual environment options will be able to run the built Agent correctly. At this time, the only confirmed virtual environment creator that is known for sure to work is <code>virtualenv</code>.</p> </div> <ul> <li>Install the virtualenv module: <div class=highlight><pre><span></span><code>python3 -m pip install virtualenv
</code></pre></div></li> <li>Create the virtual environment: <div class=highlight><pre><span></span><code>virtualenv $GOPATH/src/github.com/DataDog/datadog-agent/venv
</code></pre></div></li> <li><a href=https://virtualenv.pypa.io/en/latest/user_guide.html#activators>Activate the virtualenv</a> (OS-dependent). This must be done for every new terminal before you start.</li> </ul> <p>If using virtual environments when running the built Agent, you may need to override the built Agent's search path for Python check packages using the <code>PYTHONPATH</code> variable (your target path must have the <a href=https://datadoghq.dev/integrations-core/setup/ >pre-requisite core integration packages installed</a> though).</p> <div class=highlight><pre><span></span><code><span class=nv>PYTHONPATH</span><span class=o>=</span><span class=s2>&quot;./venv/lib/python3.12/site-packages:</span><span class=nv>$PYTHONPATH</span><span class=s2>&quot;</span><span class=w> </span>./agent<span class=w> </span>run<span class=w> </span>...
</code></pre></div> <p>See also some notes in <a href=https://github.com/DataDog/datadog-agent/tree/main/docs/dev/checks>./checks</a> about running custom python checks.</p> <h3 id=golang>Golang<a class=headerlink href=#golang title="Permanent link">&para;</a></h3> <p>You must <a href=https://golang.org/doc/install>install Golang</a> version <code>1.23.5</code> or later. Make sure that <code>$GOPATH/bin</code> is in your <code>$PATH</code>, otherwise <a href=#tooling>tooling</a> cannot use any additional tool it might need.</p> <div class="admonition note"> <p class=admonition-title>Note</p> <p>Versions of Golang that aren't an exact match to the version specified in our build images (see e.g. <a href=https://github.com/DataDog/datadog-agent-buildimages/blob/c025473ee467ee6d884d532e4c12c7d982ce8fe1/circleci/Dockerfile#L43>here</a>) may not be able to build the agent and/or the <a href=https://github.com/DataDog/datadog-agent/tree/main/rtloader>rtloader</a> binary properly.</p> </div> <h4 id=installing-tools>Installing tools<a class=headerlink href=#installing-tools title="Permanent link">&para;</a></h4> <p>From the root of <code>datadog-agent</code>, run <code>inv install-tools</code> to install go tooling. This uses <code>go</code> to install the necessary dependencies.</p> <h3 id=system-or-embedded>System or Embedded?<a class=headerlink href=#system-or-embedded title="Permanent link">&para;</a></h3> <p>When working on the Agent codebase you can choose among two different ways to build the binary, informally named <em>System</em> and <em>Embedded</em> builds. For most contribution scenarios you should rely on the System build (the default) and use the Embedded one only for specific use cases. Let's explore the differences.</p> <h4 id=system-build>System build<a class=headerlink href=#system-build title="Permanent link">&para;</a></h4> <p><em>System</em> builds use your operating system's standard system libraries to satisfy the Agent's external dependencies. Since, for example, macOS 10.11 may provide a different version of Python than macOS 10.12, system builds on each of these platforms may produce different Agent binaries. If this doesn't matter to you—perhaps you just want to contribute a quick bugfix—do a System build; it's easier and faster than an Embedded build. System build is the default for all build and test tasks, so you don't need to configure anything there. But to make sure you have system copies of all the Agent's dependencies, skip the <em>Embedded build</em> section below and read on to see how to install them via your usual package manager (apt, yum, brew, etc).</p> <h4 id=embedded-build>Embedded build<a class=headerlink href=#embedded-build title="Permanent link">&para;</a></h4> <p><em>Embedded</em> builds download specifically-versioned dependencies and compile them locally from sources. We run Embedded builds to create Datadog's official Agent releases (i.e. RPMs, debs, etc), and while you can run the same builds while developing locally, the process is as slow as it sounds. Hence, you should only use them when you care about reproducible builds. For example:</p> <ul> <li>you want to build an agent binary that can be used as-is to replace the binary of an existing agent installation</li> <li>some dependencies are not available on your system</li> <li>you're working or debugging at a very low level: let's say you're adding a function to the Python bindings, you want to make sure you're using the exact same versions of Python as the official Agent packages</li> </ul> <p>Embedded builds rely on <a href=https://github.com/chef/omnibus>Omnibus</a> to download and build dependencies, so you need a recent <code>ruby</code> environment with <code>bundler</code> installed. See <a href=https://github.com/DataDog/datadog-agent/blob/main/docs/dev/agent_omnibus.md>how to build Agent packages with Omnibus</a> for more details.</p> <h4 id=systemd>Systemd<a class=headerlink href=#systemd title="Permanent link">&para;</a></h4> <p>The agent is able to collect systemd journal logs using a wrapper on the systemd utility library.</p> <p>On Ubuntu/Debian:</p> <div class=highlight><pre><span></span><code>sudo apt-get install libsystemd-dev
</code></pre></div> <p>See also some notes in <a href=https://github.com/DataDog/datadog-agent/tree/main/docs/dev/checks>./checks</a> about running custom python checks.</p> <h3 id=golang>Golang<a class=headerlink href=#golang title="Permanent link">&para;</a></h3> <p>You must <a href=https://golang.org/doc/install>install Golang</a> version <code>1.23.6</code> or later. Make sure that <code>$GOPATH/bin</code> is in your <code>$PATH</code>, otherwise <a href=#tooling>tooling</a> cannot use any additional tool it might need.</p> <div class="admonition note"> <p class=admonition-title>Note</p> <p>Versions of Golang that aren't an exact match to the version specified in our build images (see e.g. <a href=https://github.com/DataDog/datadog-agent-buildimages/blob/c025473ee467ee6d884d532e4c12c7d982ce8fe1/circleci/Dockerfile#L43>here</a>) may not be able to build the agent and/or the <a href=https://github.com/DataDog/datadog-agent/tree/main/rtloader>rtloader</a> binary properly.</p> </div> <h4 id=installing-tools>Installing tools<a class=headerlink href=#installing-tools title="Permanent link">&para;</a></h4> <p>From the root of <code>datadog-agent</code>, run <code>inv install-tools</code> to install go tooling. This uses <code>go</code> to install the necessary dependencies.</p> <h3 id=system-or-embedded>System or Embedded?<a class=headerlink href=#system-or-embedded title="Permanent link">&para;</a></h3> <p>When working on the Agent codebase you can choose among two different ways to build the binary, informally named <em>System</em> and <em>Embedded</em> builds. For most contribution scenarios you should rely on the System build (the default) and use the Embedded one only for specific use cases. Let's explore the differences.</p> <h4 id=system-build>System build<a class=headerlink href=#system-build title="Permanent link">&para;</a></h4> <p><em>System</em> builds use your operating system's standard system libraries to satisfy the Agent's external dependencies. Since, for example, macOS 10.11 may provide a different version of Python than macOS 10.12, system builds on each of these platforms may produce different Agent binaries. If this doesn't matter to you—perhaps you just want to contribute a quick bugfix—do a System build; it's easier and faster than an Embedded build. System build is the default for all build and test tasks, so you don't need to configure anything there. But to make sure you have system copies of all the Agent's dependencies, skip the <em>Embedded build</em> section below and read on to see how to install them via your usual package manager (apt, yum, brew, etc).</p> <h4 id=embedded-build>Embedded build<a class=headerlink href=#embedded-build title="Permanent link">&para;</a></h4> <p><em>Embedded</em> builds download specifically-versioned dependencies and compile them locally from sources. We run Embedded builds to create Datadog's official Agent releases (i.e. RPMs, debs, etc), and while you can run the same builds while developing locally, the process is as slow as it sounds. Hence, you should only use them when you care about reproducible builds. For example:</p> <ul> <li>you want to build an agent binary that can be used as-is to replace the binary of an existing agent installation</li> <li>some dependencies are not available on your system</li> <li>you're working or debugging at a very low level: let's say you're adding a function to the Python bindings, you want to make sure you're using the exact same versions of Python as the official Agent packages</li> </ul> <p>Embedded builds rely on <a href=https://github.com/chef/omnibus>Omnibus</a> to download and build dependencies, so you need a recent <code>ruby</code> environment with <code>bundler</code> installed. See <a href=https://github.com/DataDog/datadog-agent/blob/main/docs/dev/agent_omnibus.md>how to build Agent packages with Omnibus</a> for more details.</p> <h4 id=systemd>Systemd<a class=headerlink href=#systemd title="Permanent link">&para;</a></h4> <p>The agent is able to collect systemd journal logs using a wrapper on the systemd utility library.</p> <p>On Ubuntu/Debian:</p> <div class=highlight><pre><span></span><code>sudo apt-get install libsystemd-dev
</code></pre></div> <p>On Redhat/CentOS:</p> <div class=highlight><pre><span></span><code>sudo yum install systemd-devel
</code></pre></div> <h3 id=docker>Docker<a class=headerlink href=#docker title="Permanent link">&para;</a></h3> <p>If you want to build a Docker image containing the Agent, or if you wan to run <a href=https://github.com/DataDog/datadog-agent/blob/main/docs/dev/agent_tests.md>system and integration tests</a> you need to run a recent version of Docker in your dev environment.</p> <h3 id=doxygen>Doxygen<a class=headerlink href=#doxygen title="Permanent link">&para;</a></h3> <p>We use <a href=http://www.doxygen.nl>Doxygen</a> to generate the documentation for the <code>rtloader</code> part of the Agent.</p> <p>To generate it (using the <code>inv rtloader.generate-doc</code> command), you'll need to have Doxygen installed on your system and available in your <code>$PATH</code>. You can compile and install Doxygen from source with the instructions available <a href=http://www.doxygen.nl/manual/install.html>here</a>. Alternatively, you can use already-compiled Doxygen binaries from <a href=http://www.doxygen.nl/download.html>here</a>.</p> <p>To get the dependency graphs, you may also need to install the <code>dot</code> executable from <a href=http://www.graphviz.org/ >graphviz</a> and add it to your <code>$PATH</code>.</p> <h3 id=pre-commit-hooks>Pre-commit hooks<a class=headerlink href=#pre-commit-hooks title="Permanent link">&para;</a></h3> <p>It is optional but recommended to install <code>pre-commit</code> to run a number of checks done by the CI locally.</p> <h4 id=installation>Installation<a class=headerlink href=#installation title="Permanent link">&para;</a></h4> <p>To install it, run:</p> <div class=highlight><pre><span></span><code>python3<span class=w> </span>-m<span class=w> </span>pip<span class=w> </span>install<span class=w> </span>pre-commit
pre-commit<span class=w> </span>install
Expand Down

0 comments on commit b41f5e3

Please sign in to comment.