Merge pull request #31039 from LumiGuide/fix-graphite-api

graphite: fix the graphiteApi service
This commit is contained in:
Graham Christensen 2017-10-31 17:53:02 -04:00 committed by GitHub
commit 2d583f7275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -22,8 +22,8 @@ let
);
graphiteApiConfig = pkgs.writeText "graphite-api.yaml" ''
time_zone: ${config.time.timeZone}
search_index: ${dataDir}/index
${optionalString (!isNull config.time.timeZone) ''time_zone: ${config.time.timeZone}''}
${optionalString (cfg.api.finders != []) ''finders:''}
${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders}
${optionalString (cfg.api.functions != []) ''functions:''}
@ -536,7 +536,7 @@ in {
environment = {
PYTHONPATH = let
aenv = pkgs.python.buildEnv.override {
extraLibs = [ cfg.api.package pkgs.cairo ] ++ cfg.api.finders;
extraLibs = [ cfg.api.package pkgs.cairo pkgs.pythonPackages.cffi ] ++ cfg.api.finders;
};
in "${aenv}/${pkgs.python.sitePackages}";
GRAPHITE_API_CONFIG = graphiteApiConfig;

View File

@ -4,13 +4,16 @@ import ./make-test.nix ({ pkgs, ...} :
nodes = {
one =
{ config, pkgs, ... }: {
time.timeZone = "UTC";
services.graphite = {
web = {
web.enable = true;
api = {
enable = true;
port = 8082;
};
carbon = {
enableCache = true;
};
carbon.enableCache = true;
seyren.enable = true;
pager.enable = true;
};
};
};
@ -19,7 +22,10 @@ import ./make-test.nix ({ pkgs, ...} :
startAll;
$one->waitForUnit("default.target");
$one->requireActiveUnit("graphiteWeb.service");
$one->requireActiveUnit("graphiteApi.service");
$one->requireActiveUnit("graphitePager.service");
$one->requireActiveUnit("carbonCache.service");
$one->requireActiveUnit("seyren.service");
$one->succeed("echo \"foo 1 `date +%s`\" | nc -q0 localhost 2003");
$one->waitUntilSucceeds("curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo")
'';