diff options
author | K900 <me@0upti.me> | 2022-07-10 14:01:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-10 14:01:30 +0300 |
commit | d2b579b23ef70f7c45af4b2268989511278f57fc (patch) | |
tree | c275f553e71f4a2abe191124358c20edc3feee81 | |
parent | 97d5a1a5919c7124fc22405cf43098e3cfa8ea45 (diff) | |
parent | 03dd01dd2fbba721f9f1a4c757e55cf2c6e15345 (diff) | |
download | nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar.gz nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar.bz2 nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar.lz nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar.xz nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.tar.zst nixlib-d2b579b23ef70f7c45af4b2268989511278f57fc.zip |
Merge pull request #178254 from K900/update-tempo
tempo: 1.1.0 -> 1.4.1, add NixOS module
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2211.section.xml | 7 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2211.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/tracing/tempo.nix | 68 | ||||
-rw-r--r-- | pkgs/servers/tracing/tempo/default.nix | 16 |
5 files changed, 91 insertions, 3 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml index 2aa88d4bd93d..1e6b46fcdf41 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml @@ -156,6 +156,13 @@ <link linkend="opt-services.expressvpn.enable">services.expressvpn</link>. </para> </listitem> + <listitem> + <para> + <link xlink:href="https://www.grafana.com/oss/tempo/">Grafana + Tempo</link>, a distributed tracing store. Available as + <link linkend="opt-services.tempo.enable">services.tempo</link>. + </para> + </listitem> </itemizedlist> </section> <section xml:id="sec-release-22.11-incompatibilities"> diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md index 15c95c9206b2..c47408662204 100644 --- a/nixos/doc/manual/release-notes/rl-2211.section.md +++ b/nixos/doc/manual/release-notes/rl-2211.section.md @@ -64,6 +64,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [expressvpn](https://www.expressvpn.com), the CLI client for ExpressVPN. Available as [services.expressvpn](#opt-services.expressvpn.enable). +- [Grafana Tempo](https://www.grafana.com/oss/tempo/), a distributed tracing store. Available as [services.tempo](#opt-services.tempo.enable). + <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> ## Backward Incompatibilities {#sec-release-22.11-incompatibilities} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 034d6ba1f582..3a06694130bc 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1033,6 +1033,7 @@ ./services/torrent/peerflix.nix ./services/torrent/rtorrent.nix ./services/torrent/transmission.nix + ./services/tracing/tempo.nix ./services/ttys/getty.nix ./services/ttys/gpm.nix ./services/ttys/kmscon.nix diff --git a/nixos/modules/services/tracing/tempo.nix b/nixos/modules/services/tracing/tempo.nix new file mode 100644 index 000000000000..15491a51c8e9 --- /dev/null +++ b/nixos/modules/services/tracing/tempo.nix @@ -0,0 +1,68 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkEnableOption mkIf mkOption types; + + cfg = config.services.tempo; + + settingsFormat = pkgs.formats.yaml {}; +in { + options.services.tempo = { + enable = mkEnableOption "Grafana Tempo"; + + settings = mkOption { + type = settingsFormat.type; + default = {}; + description = '' + Specify the configuration for Tempo in Nix. + + See https://grafana.com/docs/tempo/latest/configuration/ for available options. + ''; + }; + + configFile = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Specify a path to a configuration file that Tempo should use. + ''; + }; + }; + + config = mkIf cfg.enable { + # for tempo-cli and friends + environment.systemPackages = [ pkgs.tempo ]; + + assertions = [{ + assertion = ( + (cfg.settings == {}) != (cfg.configFile == null) + ); + message = '' + Please specify a configuration for Tempo with either + 'services.tempo.settings' or + 'services.tempo.configFile'. + ''; + }]; + + systemd.services.tempo = { + description = "Grafana Tempo Service Daemon"; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = let + conf = if cfg.configFile == null + then settingsFormat.generate "config.yaml" cfg.settings + else cfg.configFile; + in + { + ExecStart = "${pkgs.tempo}/bin/tempo --config.file=${conf}"; + DynamicUser = true; + Restart = "always"; + ProtectSystem = "full"; + DevicePolicy = "closed"; + NoNewPrivileges = true; + WorkingDirectory = "/var/lib/tempo"; + StateDirectory = "tempo"; + }; + }; + }; +} diff --git a/pkgs/servers/tracing/tempo/default.nix b/pkgs/servers/tracing/tempo/default.nix index 3380a0e99d12..19f2df40ed45 100644 --- a/pkgs/servers/tracing/tempo/default.nix +++ b/pkgs/servers/tracing/tempo/default.nix @@ -1,18 +1,28 @@ { lib, buildGoModule, fetchFromGitHub }: buildGoModule rec { - version = "1.1.0"; pname = "tempo"; + version = "1.4.1"; src = fetchFromGitHub { - rev = "v${version}"; owner = "grafana"; repo = "tempo"; - sha256 = "sha256-qKsgcc62HTwl7Usmp8zk4vKDo4XEJnwL+A3hoLhgBkk="; + rev = "v${version}"; + fetchSubmodules = true; + sha256 = "sha256-kxR+xwhthsK3gThs0jPJfWlsRG35kCuWvKH3Wr7ENTs="; }; vendorSha256 = null; + subPackages = [ + "cmd/tempo-cli" + "cmd/tempo-query" + # FIXME: build is broken upstream, enable for next release + # "cmd/tempo-serverless" + "cmd/tempo-vulture" + "cmd/tempo" + ]; + # tests use docker doCheck = false; |