summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRob Vermaas <rob.vermaas@gmail.com>2018-10-23 12:29:53 +0200
committerRob Vermaas <rob.vermaas@gmail.com>2018-10-23 12:30:06 +0200
commitdebbed29d1da582e75ebf266b203baad063550c3 (patch)
tree9d24d1623a31b395bea4eaff4ad536155be749a1 /nixos
parente20e1e5c2cb247ed3c10d9560db7c3a509115674 (diff)
downloadnixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar.gz
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar.bz2
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar.lz
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar.xz
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.tar.zst
nixpkgs-debbed29d1da582e75ebf266b203baad063550c3.zip
datadog-agent: add option to enable trace agent
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/datadog-agent.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix
index 8fd3455a238..5434fe99347 100644
--- a/nixos/modules/services/monitoring/datadog-agent.nix
+++ b/nixos/modules/services/monitoring/datadog-agent.nix
@@ -7,7 +7,7 @@ let
 
   ddConf = {
     dd_url              = "https://app.datadoghq.com";
-    skip_ssl_validation = "no";
+    skip_ssl_validation = false;
     confd_path          = "/etc/datadog-agent/conf.d";
     additional_checksd  = "/etc/datadog-agent/checks.d";
     use_dogstatsd       = true;
@@ -16,6 +16,7 @@ let
   // optionalAttrs (cfg.hostname != null) { inherit (cfg) hostname; }
   // optionalAttrs (cfg.tags != null ) { tags = concatStringsSep ", " cfg.tags; }
   // optionalAttrs (cfg.enableLiveProcessCollection) { process_config = { enabled = "true"; }; }
+  // optionalAttrs (cfg.enableTraceAgent) { apm_config = { enabled = true; }; }
   // cfg.extraConfig;
 
   # Generate Datadog configuration files for each configured checks.
@@ -132,6 +133,15 @@ in {
       default = false;
       type = types.bool;
     };
+
+    enableTraceAgent = mkOption {
+      description = ''
+        Whether to enable the trace agent.
+      '';
+      default = false;
+      type = types.bool;
+    };
+
     checks = mkOption {
       description = ''
         Configuration for all Datadog checks. Keys of this attribute
@@ -244,6 +254,16 @@ in {
           ${pkgs.datadog-process-agent}/bin/agent --config /etc/datadog-agent/datadog.yaml
         '';
       });
+
+      datadog-trace-agent = lib.mkIf cfg.enableTraceAgent (makeService {
+        description = "Datadog Trace Agent";
+        path = [ ];
+        script = ''
+          export DD_API_KEY=$(head -n 1 ${cfg.apiKeyFile})
+          ${pkgs.datadog-trace-agent}/bin/trace-agent -config /etc/datadog-agent/datadog.yaml
+        '';
+      });
+
     };
 
     environment.etc = etcfiles;