|
9 | 9 | with pkgs.lib;
|
10 | 10 |
|
11 | 11 | let
|
| 12 | + # For testing legacy to new cardano-tracer-service transition |
| 13 | + # useLegacyTracerService = true; |
| 14 | + useLegacyTracerService = false; |
12 | 15 |
|
13 | 16 | ## Given an env config, evaluate it and produce the service.
|
14 | 17 | ##
|
|
18 | 21 | let
|
19 | 22 | tracerConfig =
|
20 | 23 | {
|
| 24 | + enable = true; |
21 | 25 | ## In both the local and remote scenarios, it's most frequently
|
22 | 26 | ## convenient to act as an acceptor.
|
23 | 27 | acceptingSocket = "tracer.socket";
|
24 | 28 | networkMagic = profile.genesis.network_magic;
|
25 |
| - dsmPassthrough = { |
26 |
| - # rtsOpts = ["-xc"]; |
27 |
| - } // optionalAttrs (profile.tracer.withresources or false) { |
28 |
| - rtsOpts = [ "-scardano-tracer.gcstats" ]; |
29 |
| - }; |
30 | 29 | configFile = "config.json";
|
31 |
| - logRoot = "."; |
32 | 30 | metricsHelp = "../../../cardano-tracer/configuration/metrics_help.json";
|
33 | 31 | } // optionalAttrs backend.useCabalRun {
|
34 | 32 | executable = "cardano-tracer";
|
|
39 | 37 | };
|
40 | 38 | } // optionalAttrs (profile.tracer.withresources or false) {
|
41 | 39 | resourceFreq = 1000;
|
| 40 | + } // optionalAttrs useLegacyTracerService { |
| 41 | + dsmPassthrough = { |
| 42 | + # rtsOpts = ["-xc"]; |
| 43 | + } // optionalAttrs (profile.tracer.withresources or false) { |
| 44 | + rtsOpts = [ "-scardano-tracer.gcstats" ]; |
| 45 | + }; |
| 46 | + logRoot = "."; |
| 47 | + } // optionalAttrs (!useLegacyTracerService) { |
| 48 | + logging = [ |
| 49 | + { |
| 50 | + logRoot = "."; |
| 51 | + logMode = "FileMode"; |
| 52 | + logFormat = "ForMachine"; |
| 53 | + } |
| 54 | + ]; |
| 55 | + rtsArgs = |
| 56 | + # ["-xc"] ++ |
| 57 | + optionals (profile.tracer.withresources or false) ["-scardano-tracer.gcstats"]; |
| 58 | + stateDir = null; |
42 | 59 | }
|
43 | 60 | ;
|
44 | 61 | systemdCompat.options = {
|
|
48 | 65 | assertions = mkOption {};
|
49 | 66 | environment = mkOption {};
|
50 | 67 | };
|
51 |
| - eval = |
52 |
| - let |
53 |
| - extra = { |
54 |
| - services.cardano-tracer = { |
55 |
| - enable = true; |
56 |
| - } // tracerConfig; |
57 |
| - }; |
58 |
| - in evalModules { |
59 |
| - prefix = []; |
60 |
| - modules = [ |
61 |
| - (import ../../nixos/cardano-node-service.nix) |
62 |
| - (import ../../nixos/cardano-submit-api-service.nix) |
63 |
| - # (import ../../nixos/cardano-tracer-service.nix) |
64 |
| - (import ../../nixos/cardano-tracer-service-legacy.nix pkgs) |
65 |
| - systemdCompat |
66 |
| - extra |
67 |
| - { config._module.args = { inherit pkgs; }; } |
68 |
| - ] |
69 |
| - ++ [ backend.service-modules.tracer or {} ] |
| 68 | + eval = evalModules { |
| 69 | + prefix = []; |
| 70 | + |
| 71 | + modules = [ |
| 72 | + (import ../../nixos/cardano-node-service.nix) |
| 73 | + (import ../../nixos/cardano-submit-api-service.nix) |
| 74 | + { config._module.args = { inherit pkgs; }; } |
| 75 | + { services.cardano-tracer = tracerConfig; } |
| 76 | + systemdCompat |
| 77 | + ] |
| 78 | + ++ [ backend.service-modules.tracer or {} ] |
| 79 | + ++ optionals useLegacyTracerService |
| 80 | + [ (import ../../nixos/cardano-tracer-service-legacy.nix pkgs) ] |
| 81 | + ++ optionals (!useLegacyTracerService) |
| 82 | + [ (import ../../nixos/cardano-tracer-service.nix) ] |
70 | 83 | ;
|
71 |
| - # args = { inherit pkgs; }; |
72 |
| - } |
73 |
| - ; |
| 84 | + |
| 85 | + # args = { inherit pkgs; }; |
| 86 | + }; |
74 | 87 | in
|
75 | 88 | eval.config.services.cardano-tracer;
|
76 | 89 |
|
|
81 | 94 | (nodeSpecs:
|
82 | 95 | let
|
83 | 96 | nixosServiceConfig = tracerConfigServiceConfig;
|
84 |
| - execConfig = nixosServiceConfig.configJSONfn nixosServiceConfig; |
| 97 | + execConfig = if useLegacyTracerService |
| 98 | + then nixosServiceConfig.configJSONfn nixosServiceConfig |
| 99 | + else nixosServiceConfig.tracerConfig; |
85 | 100 | in {
|
86 | 101 | start = rec {
|
87 | 102 | value = ''
|
|
92 | 107 | JSON = pkgs.writeScript "startup-tracer.sh" value;
|
93 | 108 | };
|
94 | 109 |
|
95 |
| - config = rec { |
| 110 | + config = { |
96 | 111 | value = execConfig;
|
97 | 112 | JSON = jsonFilePretty "config.json" (__toJSON execConfig);
|
98 | 113 | };
|
|
0 commit comments