Skip to content

Commit

Permalink
[Backport release-24.11] datadog-agent: 7.50.3 -> 7.56.2 (#362994)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangwalther authored Dec 10, 2024
2 parents 30d7902 + 6286a9d commit 4672405
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 39 deletions.
8 changes: 7 additions & 1 deletion nixos/modules/services/monitoring/datadog-agent.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ let
// optionalAttrs (cfg.ddUrl != null) { dd_url = cfg.ddUrl; }
// optionalAttrs (cfg.site != null) { site = cfg.site; }
// optionalAttrs (cfg.tags != null ) { tags = concatStringsSep ", " cfg.tags; }
// optionalAttrs (cfg.enableLiveProcessCollection) { process_config = { enabled = "true"; }; }
// optionalAttrs (cfg.enableLiveProcessCollection) {
process_config = {
dd_agent_bin = "${datadogPkg}/bin/agent";
process_collection.enabled = "true";
container_collection.enabled = "true";
};
}
// optionalAttrs (cfg.enableTraceAgent) { apm_config = { enabled = true; }; }
// cfg.extraConfig;

Expand Down
40 changes: 17 additions & 23 deletions pkgs/tools/networking/dd-agent/datadog-agent.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
{ lib
, stdenv
, cmake
, buildGoModule
, buildGo122Module
, makeWrapper
, fetchFromGitHub
, pythonPackages
, pkg-config
, systemd
, hostname
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, withDocker ? true
, extraTags ? [ ]
, testers
, datadog-agent
}:

let
# keep this in sync with github.com/DataDog/agent-payload dependency
payloadVersion = "5.0.97";
payloadVersion = "5.0.124";
python = pythonPackages.python;
owner = "DataDog";
repo = "datadog-agent";
goPackagePath = "github.com/${owner}/${repo}";
version = "7.50.3";
version = "7.56.2";

src = fetchFromGitHub {
inherit owner repo;
rev = version;
hash = "sha256-AN5BruLPyrpIGSUkcYkZC0VgItk9NHiZTXstv6j9TlY=";
hash = "sha256-rU3eg92MuGs/6r7oJho2roeUCZoyfqYt1xOERoRPqmQ=";
};
rtloader = stdenv.mkDerivation {
pname = "datadog-agent-rtloader";
Expand All @@ -37,19 +38,20 @@ let
cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"];
};

in buildGoModule rec {
in buildGo122Module rec {
pname = "datadog-agent";
inherit src version;

doCheck = false;

vendorHash = "sha256-Rn8EB/6FHQk9COlOaxm4TQXjGCIPZHJV2QQnPDcbRnM=";
vendorHash = if stdenv.isDarwin
then "sha256-3Piq5DPMTZUEjqNkw5HZY25An2kATX6Jac9unQfZnZc="
else "sha256-FR0Et3DvjJhbYUPy9mpN0QCJ7QDU4VRZFUTL0J1FSXw=";

subPackages = [
"cmd/agent"
"cmd/cluster-agent"
"cmd/dogstatsd"
"cmd/py-launcher"
"cmd/trace-agent"
];

Expand All @@ -67,26 +69,25 @@ in buildGoModule rec {
"zlib"
]
++ lib.optionals withSystemd [ "systemd" ]
++ lib.optionals withDocker [ "docker" ]
++ extraTags;

ldflags = [
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
"-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
"-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
"-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}"
"-X ${goPackagePath}/pkg/config.DefaultPython=3"
"-X ${goPackagePath}/pkg/config/setup.DefaultPython=3"
"-r ${python}/lib"
];

preBuild = ''
# Keep directories to generate in sync with tasks/go.py
go generate ./pkg/status ./cmd/agent/gui
'';

# DataDog use paths relative to the agent binary, so fix these.
# We can't just point these to $out since that would introduce self-referential paths in the go modules,
# which are a fixed-output derivation. However, the patches aren't picked up if we skip them when building
# the modules. So we'll just traverse from the bin back to the out folder.
postPatch = ''
sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \
-e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \
sed -e "s|PyChecksPath =.*|PyChecksPath = filepath.Join(_here, \"..\", \"${python.sitePackages}\")|" \
-e "s|distPath =.*|distPath = filepath.Join(_here, \"..\", \"share\", \"datadog-agent\")|" \
-i cmd/agent/common/path/path_nix.go
sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \
-i pkg/util/hostname/fqdn_nix.go
Expand All @@ -97,11 +98,9 @@ in buildGoModule rec {
postInstall = ''
mkdir -p $out/${python.sitePackages} $out/share/datadog-agent
cp -R --no-preserve=mode $src/cmd/agent/dist/conf.d $out/share/datadog-agent
rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d}
rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d,agentcrashdetect.d,myapp.d}
cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages}
cp -R $src/pkg/status/templates $out/share/datadog-agent
wrapProgram "$out/bin/agent" \
--set PYTHONPATH "$out/${python.sitePackages}"''
+ lib.optionalString withSystemd " --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ (lib.getLib systemd) rtloader ]}";
Expand All @@ -119,10 +118,5 @@ in buildGoModule rec {
homepage = "https://www.datadoghq.com";
license = licenses.bsd3;
maintainers = with maintainers; [ thoughtpolice domenkozar ];
# never built on aarch64-darwin since first introduction in nixpkgs
# broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;

# Upstream does not support Go > 1.21; for update refer to https://github.com/NixOS/nixpkgs/issues/351119
broken = true;
};
}
31 changes: 17 additions & 14 deletions pkgs/tools/networking/dd-agent/integrations-core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,30 @@
#
# [1]: https://github.com/DataDog/integrations-core

{ pkgs, python, extraIntegrations ? {} }:
{ lib, fetchFromGitHub, python3Packages, extraIntegrations ? { }, }:

let
inherit (pkgs.lib) attrValues mapAttrs;
inherit (lib) attrValues mapAttrs;

src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "DataDog";
repo = "integrations-core";
rev = version;
sha256 = "sha256-CIzuJ97KwsG1k65Y+8IUSka/3JX1pmQKN3hPHzZnGhQ=";
sha256 = "sha256-p5eoNNHQQl314mfUk2t3qQaerPu02GKA+tKkAY7bojk=";
};
version = "7.38.0";
version = "7.56.2";

# Build helper to build a single datadog integration package.
buildIntegration = { pname, ... }@args: python.pkgs.buildPythonPackage (args // {
inherit src version;
name = "datadog-integration-${pname}-${version}";
buildIntegration = { pname, ... }@args:
python3Packages.buildPythonPackage (args // {
inherit src version;
name = "datadog-integration-${pname}-${version}";
pyproject = true;

sourceRoot = "${src.name}/${args.sourceRoot or pname}";
doCheck = false;
});
sourceRoot = "${src.name}/${args.sourceRoot or pname}";
buildInputs = with python3Packages; [ hatchling setuptools ];
doCheck = false;
});

# Base package depended on by all other integrations.
datadog_checks_base = buildIntegration {
Expand All @@ -67,7 +70,7 @@ let
--replace "packages=['datadog_checks']" "packages=find_packages()"
'';

propagatedBuildInputs = with python.pkgs; [
propagatedBuildInputs = with python3Packages; [
binary
cachetools
cryptography
Expand Down Expand Up @@ -107,10 +110,10 @@ let
integrations = defaultIntegrations // extraIntegrations;
builtIntegrations = mapAttrs (pname: fdeps: buildIntegration {
inherit pname;
propagatedBuildInputs = (fdeps python.pkgs) ++ [ datadog_checks_base ];
propagatedBuildInputs = (fdeps python3Packages) ++ [ datadog_checks_base ];
}) integrations;

in builtIntegrations // {
inherit datadog_checks_base;
python = python.withPackages (_: (attrValues builtIntegrations));
python = python3Packages.python.withPackages (_: (attrValues builtIntegrations));
}
1 change: 0 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13633,7 +13633,6 @@ with pkgs;
};
datadog-process-agent = callPackage ../tools/networking/dd-agent/datadog-process-agent.nix { };
datadog-integrations-core = extras: callPackage ../tools/networking/dd-agent/integrations-core.nix {
python = python3;
extraIntegrations = extras;
};

Expand Down

0 comments on commit 4672405

Please sign in to comment.