Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,67 @@ The `Prometheus` requires a different port number than `cardano-node`'s
}
```

By default all counters are prefixed with `dmq_node_`, this can be changed with
`TraceOptionMetricsPrefix` option in the configuration file, e.g.
DMQ metrics use the prefix `dmq_node_` by default. To change it, set
`TraceOptionMetricsPrefix` in the configuration file, e.g.
```json
{
"TraceOptionMetricsPrefix": "dmq_aggregator."
}
```

### NixOS

The flake exports `nixosModules.dmq-node`, which configures
`services.dmq-node`. It reads the Shelley genesis and the cardano network magic
from the attached node's flat configuration. dmq-node connects to the node
socket through the node's group, so that socket must be group-writable; the
example uses socket activation for this, and the `cardanoNodeSocketGroup`
option lists the alternatives. In a flake's `nixosSystem`:

```nix
nixpkgs.lib.nixosSystem {
modules = [
inputs.dmq-node.nixosModules.dmq-node
({ config, ... }: {
services.cardano-node.systemdSocketActivation = true;
services.dmq-node = {
enable = true;
networkMagic = 2912307721;
cardanoNodeConfig = config.services.cardano-node.nodeConfig;
cardanoNodeSocketPath = config.services.cardano-node.socketPath 0;
hostAddr = "0.0.0.0";
openFirewall = true;
topology = { localRoots = [ ]; publicRoots = [ ]; useLedgerAfterSlot = -1; };
traceOptions."" = {
backends = [ "Stdout MachineFormat" "PrometheusSimple suffix 127.0.0.1 12800" ];
severity = "Info";
};
};
})
];
}
```

With this configuration, a Prometheus instance on the same host can scrape
`127.0.0.1:12800` at its default path, `/metrics`. To inspect it directly:

```sh
curl -fsS http://127.0.0.1:12800/metrics
```

`dmq_node_peerSelection_ActivePeers_int` reports the current active peer count.
For messages received from peers, look for `dmq_node_txSubmission_txsReceived_int`,
`dmq_node_txSubmission_txsAccepted_int` and `dmq_node_txSubmission_txsRejected_int`.
The V2 submission worker checks for changed totals every seven seconds, so these
series can be absent from an early scrape. The NixOS service enables GHC runtime
statistics with `+RTS -T -RTS`, including `rts_gc_bytes_allocated` and
`rts_gc_num_gcs`.

`nix/nixos/dmq-node-service.nix` holds the module with no reference to this
flake, so it can be imported by path. There `package` defaults to
`pkgs.dmq-node`, which `overlays.default` adds; set `package` instead to pin
another build.

## Developing with Nix

To enter a development shell with all dependencies available, use:
Expand Down
22 changes: 19 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,23 @@
flake-utils.url = "github:numtide/flake-utils";
};

outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system:
import ./nix/outputs.nix { inherit inputs system; }
);
outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem
(system:
import ./nix/outputs.nix { inherit inputs system; }
) // {
overlays.default = final: _prev: {
inherit (inputs.self.packages.${final.stdenv.hostPlatform.system}) dmq-node;
};

# Defaults `package` directly rather than adding the overlay: NixOS rejects
# `nixpkgs.overlays` when `nixpkgs.pkgs` is set from outside.
nixosModules = rec {
dmq-node = { lib, pkgs, ... }: {
imports = [ ./nix/nixos/dmq-node-service.nix ];
services.dmq-node.package = lib.mkDefault
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.dmq-node;
};
default = dmq-node;
};
};
}
Loading
Loading