3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #180950 from alyssais/graphite

This commit is contained in:
Martin Weinelt 2022-07-10 17:22:45 +02:00 committed by GitHub
commit 0044b4fa22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 411 deletions

View file

@ -257,6 +257,16 @@
maintainer to update the package. maintainer to update the package.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
The <literal>services.graphite.api</literal> and
<literal>services.graphite.beacon</literal> NixOS options, and
the <literal>python3.pkgs.graphite_api</literal>,
<literal>python3.pkgs.graphite_beacon</literal> and
<literal>python3.pkgs.influxgraph</literal> packages, have
been removed due to lack of upstream maintenance.
</para>
</listitem>
<listitem> <listitem>
<para> <para>
(Neo)Vim can not be configured with (Neo)Vim can not be configured with

View file

@ -99,6 +99,11 @@ In addition to numerous new and upgraded packages, this release has the followin
- riak package removed along with `services.riak` module, due to lack of maintainer to update the package. - riak package removed along with `services.riak` module, due to lack of maintainer to update the package.
- The `services.graphite.api` and `services.graphite.beacon` NixOS options, and
the `python3.pkgs.graphite_api`, `python3.pkgs.graphite_beacon` and
`python3.pkgs.influxgraph` packages, have been removed due to lack of upstream
maintenance.
- (Neo)Vim can not be configured with `configure.pathogen` anymore to reduce maintainance burden. - (Neo)Vim can not be configured with `configure.pathogen` anymore to reduce maintainance burden.
Use `configure.packages` instead. Use `configure.packages` instead.

View file

@ -24,16 +24,6 @@ let
+ cfg.web.extraConfig + cfg.web.extraConfig
); );
graphiteApiConfig = pkgs.writeText "graphite-api.yaml" ''
search_index: ${dataDir}/index
${optionalString (config.time.timeZone != null) "time_zone: ${config.time.timeZone}"}
${optionalString (cfg.api.finders != []) "finders:"}
${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders}
${optionalString (cfg.api.functions != []) "functions:"}
${concatMapStringsSep "\n" (f: " - " + f) cfg.api.functions}
${cfg.api.extraConfig}
'';
seyrenConfig = { seyrenConfig = {
SEYREN_URL = cfg.seyren.seyrenUrl; SEYREN_URL = cfg.seyren.seyrenUrl;
MONGO_URL = cfg.seyren.mongoUrl; MONGO_URL = cfg.seyren.mongoUrl;
@ -72,6 +62,8 @@ let
in { in {
imports = [ imports = [
(mkRemovedOptionModule ["services" "graphite" "api"] "")
(mkRemovedOptionModule ["services" "graphite" "beacon"] "")
(mkRemovedOptionModule ["services" "graphite" "pager"] "") (mkRemovedOptionModule ["services" "graphite" "pager"] "")
]; ];
@ -115,88 +107,6 @@ in {
}; };
}; };
api = {
enable = mkOption {
description = ''
Whether to enable graphite api. Graphite api is lightweight alternative
to graphite web, with api and without dashboard. It's advised to use
grafana as alternative dashboard and influxdb as alternative to
graphite carbon.
For more information visit
<link xlink:href="https://graphite-api.readthedocs.org/en/latest/"/>
'';
default = false;
type = types.bool;
};
finders = mkOption {
description = "List of finder plugins to load.";
default = [];
example = literalExpression "[ pkgs.python3Packages.influxgraph ]";
type = types.listOf types.package;
};
functions = mkOption {
description = "List of functions to load.";
default = [
"graphite_api.functions.SeriesFunctions"
"graphite_api.functions.PieFunctions"
];
type = types.listOf types.str;
};
listenAddress = mkOption {
description = "Graphite web service listen address.";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
description = "Graphite api service port.";
default = 8080;
type = types.int;
};
package = mkOption {
description = "Package to use for graphite api.";
default = pkgs.python3Packages.graphite_api;
defaultText = literalExpression "pkgs.python3Packages.graphite_api";
type = types.package;
};
extraConfig = mkOption {
description = "Extra configuration for graphite api.";
default = ''
whisper:
directories:
- ${dataDir}/whisper
'';
defaultText = literalExpression ''
'''
whisper:
directories:
- ''${config.${opt.dataDir}}/whisper
'''
'';
example = ''
allowed_origins:
- dashboard.example.com
cheat_times: true
influxdb:
host: localhost
port: 8086
user: influxdb
pass: influxdb
db: metrics
cache:
CACHE_TYPE: 'filesystem'
CACHE_DIR: '/tmp/graphite-api-cache'
'';
type = types.lines;
};
};
carbon = { carbon = {
config = mkOption { config = mkOption {
description = "Content of carbon configuration file."; description = "Content of carbon configuration file.";
@ -354,16 +264,6 @@ in {
''; '';
}; };
}; };
beacon = {
enable = mkEnableOption "graphite beacon";
config = mkOption {
description = "Graphite beacon configuration.";
default = {};
type = types.attrs;
};
};
}; };
###### implementation ###### implementation
@ -489,44 +389,6 @@ in {
environment.systemPackages = [ pkgs.python3Packages.graphite-web ]; environment.systemPackages = [ pkgs.python3Packages.graphite-web ];
})) }))
(mkIf cfg.api.enable {
systemd.services.graphiteApi = {
description = "Graphite Api Interface";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
environment = {
PYTHONPATH = let
aenv = pkgs.python3.buildEnv.override {
extraLibs = [ cfg.api.package pkgs.cairo pkgs.python3Packages.cffi ] ++ cfg.api.finders;
};
in "${aenv}/${pkgs.python3.sitePackages}";
GRAPHITE_API_CONFIG = graphiteApiConfig;
LD_LIBRARY_PATH = "${pkgs.cairo.out}/lib";
};
serviceConfig = {
ExecStart = ''
${pkgs.python3Packages.waitress}/bin/waitress-serve \
--host=${cfg.api.listenAddress} --port=${toString cfg.api.port} \
graphite_api.app:app
'';
User = "graphite";
Group = "graphite";
PermissionsStartOnly = true;
};
preStart = ''
if ! test -e ${dataDir}/db-created; then
mkdir -p ${dataDir}/cache/
chmod 0700 ${dataDir}/cache/
chown graphite:graphite ${cfg.dataDir}
chown -R graphite:graphite ${cfg.dataDir}/cache
touch ${dataDir}/db-created
fi
'';
};
})
(mkIf cfg.seyren.enable { (mkIf cfg.seyren.enable {
systemd.services.seyren = { systemd.services.seyren = {
description = "Graphite Alerting Dashboard"; description = "Graphite Alerting Dashboard";
@ -550,25 +412,9 @@ in {
services.mongodb.enable = mkDefault true; services.mongodb.enable = mkDefault true;
}) })
(mkIf cfg.beacon.enable {
systemd.services.graphite-beacon = {
description = "Grpahite Beacon Alerting Daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.python3Packages.graphite_beacon}/bin/graphite-beacon \
--config=${pkgs.writeText "graphite-beacon.json" (builtins.toJSON cfg.beacon.config)}
'';
User = "graphite";
Group = "graphite";
};
};
})
(mkIf ( (mkIf (
cfg.carbon.enableCache || cfg.carbon.enableAggregator || cfg.carbon.enableRelay || cfg.carbon.enableCache || cfg.carbon.enableAggregator || cfg.carbon.enableRelay ||
cfg.web.enable || cfg.api.enable || cfg.web.enable || cfg.seyren.enable
cfg.seyren.enable || cfg.beacon.enable
) { ) {
users.users.graphite = { users.users.graphite = {
uid = config.ids.uids.graphite; uid = config.ids.uids.graphite;

View file

@ -12,14 +12,8 @@ import ./make-test-python.nix ({ pkgs, ... } :
SECRET_KEY = "abcd"; SECRET_KEY = "abcd";
''; '';
}; };
api = {
enable = true;
port = 8082;
finders = [ ];
};
carbon.enableCache = true; carbon.enableCache = true;
seyren.enable = false; # Implicitely requires openssl-1.0.2u which is marked insecure seyren.enable = false; # Implicitely requires openssl-1.0.2u which is marked insecure
beacon.enable = true;
}; };
}; };
}; };
@ -28,21 +22,15 @@ import ./make-test-python.nix ({ pkgs, ... } :
start_all() start_all()
one.wait_for_unit("default.target") one.wait_for_unit("default.target")
one.wait_for_unit("graphiteWeb.service") one.wait_for_unit("graphiteWeb.service")
one.wait_for_unit("graphiteApi.service")
one.wait_for_unit("graphite-beacon.service")
one.wait_for_unit("carbonCache.service") one.wait_for_unit("carbonCache.service")
# The services above are of type "simple". systemd considers them active immediately # The services above are of type "simple". systemd considers them active immediately
# even if they're still in preStart (which takes quite long for graphiteWeb). # even if they're still in preStart (which takes quite long for graphiteWeb).
# Wait for ports to open so we're sure the services are up and listening. # Wait for ports to open so we're sure the services are up and listening.
one.wait_for_open_port(8080) one.wait_for_open_port(8080)
one.wait_for_open_port(8082)
one.wait_for_open_port(2003) one.wait_for_open_port(2003)
one.succeed('echo "foo 1 `date +%s`" | nc -N localhost 2003') one.succeed('echo "foo 1 `date +%s`" | nc -N localhost 2003')
one.wait_until_succeeds( one.wait_until_succeeds(
"curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2" "curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2"
) )
one.wait_until_succeeds(
"curl 'http://localhost:8082/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2"
)
''; '';
}) })

View file

@ -1,46 +0,0 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, lib, flask, flask-caching, cairocffi, pyparsing, pytz, pyyaml
, raven, six, structlog, tzlocal, nose, mock, cairo, isPyPy
}:
buildPythonPackage rec {
pname = "graphite-api";
version = "1.1.3";
disabled = isPyPy;
src = fetchFromGitHub {
owner = "brutasse";
repo = "graphite-api";
rev = version;
sha256 = "0sz3kav2024ms2z4q03pigcf080gsr5v774z9bp3zw29k2p47ass";
};
# https://github.com/brutasse/graphite-api/pull/239 rebased onto 1.1.3
patches = [ ./flask-caching-rebased.patch ];
checkPhase = "nosetests";
propagatedBuildInputs = [
flask
flask-caching
cairocffi
pyparsing
pytz
pyyaml
raven
six
structlog
tzlocal
];
checkInputs = [ nose mock ];
LD_LIBRARY_PATH = "${cairo.out}/lib";
meta = with lib; {
broken = stdenv.isDarwin;
description = "Graphite-web, without the interface. Just the rendering HTTP API";
homepage = "https://github.com/brutasse/graphite-api";
license = licenses.asl20;
};
}

View file

@ -1,132 +0,0 @@
diff --git a/graphite_api/config.py b/graphite_api/config.py
index 5e1e382..dc033a8 100644
--- a/graphite_api/config.py
+++ b/graphite_api/config.py
@@ -112,11 +112,11 @@ def configure(app):
app.cache = None
if 'cache' in config:
try:
- from flask.ext.cache import Cache
+ from flask_caching import Cache
except ImportError:
warnings.warn("'cache' is provided in the configuration but "
- "Flask-Cache is not installed. Please `pip install "
- "Flask-Cache`.")
+ "flask-caching is not installed. Please `pip "
+ "install flask-caching`.")
else:
cache_conf = {'CACHE_DEFAULT_TIMEOUT': 60,
'CACHE_KEY_PREFIX': 'graphite-api:'}
diff --git a/requirements.txt b/requirements.txt
index c68b446..7826b0c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
Flask
-Flask-Cache
+Flask-Caching
cairocffi
pyparsing>=1.5.7
pytz
diff --git a/setup.py b/setup.py
index 0337cbe..df07989 100644
--- a/setup.py
+++ b/setup.py
@@ -38,7 +38,7 @@ setup(
extras_require={
'sentry': ['raven[flask]'],
'cyanite': ['cyanite'],
- 'cache': ['Flask-Cache'],
+ 'cache': ['Flask-Caching'],
'statsd': ['statsd'],
},
zip_safe=False,
diff --git a/tests/test_render.py b/tests/test_render.py
index be5609d..a0e7190 100644
--- a/tests/test_render.py
+++ b/tests/test_render.py
@@ -8,7 +8,7 @@ from graphite_api._vendor import whisper
from . import TestCase, WHISPER_DIR
try:
- from flask.ext.cache import Cache
+ from flask_caching import Cache
except ImportError:
Cache = None
diff --git a/tox.ini b/tox.ini
index 85a0abb..c820393 100644
--- a/tox.ini
+++ b/tox.ini
@@ -47,7 +47,7 @@ basepython = python2.7
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing
mock
@@ -56,7 +56,7 @@ basepython = python3.3
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing
[testenv:py34]
@@ -66,7 +66,7 @@ commands =
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing
[testenv:py35]
@@ -76,7 +76,7 @@ commands =
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing
[testenv:pyparsing1]
@@ -84,7 +84,7 @@ basepython = python2.7
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing==1.5.7
mock
@@ -93,7 +93,7 @@ basepython = pypy
deps =
{[testenv]deps}
Flask
- Flask-Cache
+ Flask-Caching
pyparsing
mock
@@ -102,7 +102,7 @@ basepython = python2.7
deps =
{[testenv]deps}
Flask<0.9
- Flask-Cache
+ Flask-Caching
pyparsing
mock
@@ -111,7 +111,7 @@ basepython = python2.7
deps =
{[testenv]deps}
Flask<0.10
- Flask-Cache
+ Flask-Caching
pyparsing
mock

View file

@ -1,33 +0,0 @@
{ lib, buildPythonPackage, fetchPypi
, tornado_5, pyyaml, funcparserlib
, nixosTests
}:
buildPythonPackage rec {
pname = "graphite_beacon";
version = "0.27.0";
src = fetchPypi {
inherit pname version;
sha256 = "03bp4wyfn3xhcqyvs5hnk1n87m4smsmm1p7qp459m7j8hwpbq2ks";
};
propagatedBuildInputs = [ tornado_5 pyyaml funcparserlib ];
postPatch = ''
substituteInPlace requirements.txt --replace "==" ">="
'';
pythonImportsCheck = [ "graphite_beacon" ];
passthru.tests = {
nixos = nixosTests.graphite;
};
meta = with lib; {
description = "A simple alerting application for Graphite metrics";
homepage = "https://github.com/klen/graphite-beacon";
maintainers = [ maintainers.offline ];
license = licenses.mit;
};
}

View file

@ -1,24 +0,0 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k
, influxdb, graphite_api, python-memcached
}:
buildPythonPackage rec {
pname = "influxgraph";
version = "1.5.0";
src = fetchPypi {
inherit pname version;
sha256 = "0l33sfwdh4bfprmzp2kx0d9098g6yxbnhyyx9qr3kzczpm0jg9vy";
};
propagatedBuildInputs = [ influxdb graphite_api python-memcached ];
passthru.moduleName = "influxgraph.InfluxDBFinder";
meta = with lib; {
description = "InfluxDB storage plugin for Graphite-API";
homepage = "https://github.com/InfluxGraph/influxgraph";
license = licenses.asl20;
maintainers = with maintainers; [ basvandijk ];
};
}

View file

@ -79,6 +79,8 @@ mapAliases ({
glances = throw "glances has moved to pkgs.glances"; # added 2020-20-28 glances = throw "glances has moved to pkgs.glances"; # added 2020-20-28
google_api_python_client = google-api-python-client; # added 2021-03-19 google_api_python_client = google-api-python-client; # added 2021-03-19
googleapis_common_protos = googleapis-common-protos; # added 2021-03-19 googleapis_common_protos = googleapis-common-protos; # added 2021-03-19
graphite_api = throw "graphite_api was removed, because it is no longer maintained"; # added 2022-07-10
graphite_beacon = throw "graphite_beacon was removed, because it is no longer maintained"; # added 2022-07-09
grpc_google_iam_v1 = grpc-google-iam-v1; # added 2021-08-21 grpc_google_iam_v1 = grpc-google-iam-v1; # added 2021-08-21
ha-av = throw "ha-av was removed, because it is no longer maintained"; # added 2022-04-06 ha-av = throw "ha-av was removed, because it is no longer maintained"; # added 2022-04-06
HAP-python = hap-python; # added 2021-06-01 HAP-python = hap-python; # added 2021-06-01
@ -87,6 +89,7 @@ mapAliases ({
hyperkitty = throw "Please use pkgs.mailmanPackages.hyperkitty"; # added 2022-04-29 hyperkitty = throw "Please use pkgs.mailmanPackages.hyperkitty"; # added 2022-04-29
IMAPClient = imapclient; # added 2021-10-28 IMAPClient = imapclient; # added 2021-10-28
ipaddress = throw "ipaddress has been removed because it is no longer required since python 2.7."; # added 2022-05-30 ipaddress = throw "ipaddress has been removed because it is no longer required since python 2.7."; # added 2022-05-30
influxgraph = throw "influxgraph has been removed because it is no longer maintained"; # added 2022-07-10
jupyter_client = jupyter-client; # added 2021-10-15 jupyter_client = jupyter-client; # added 2021-10-15
Keras = keras; # added 2021-11-25 Keras = keras; # added 2021-11-25
lammps-cython = throw "lammps-cython no longer builds and is unmaintained"; # added 2021-07-04 lammps-cython = throw "lammps-cython no longer builds and is unmaintained"; # added 2021-07-04

View file

@ -3759,10 +3759,6 @@ in {
grapheme = callPackage ../development/python-modules/grapheme { }; grapheme = callPackage ../development/python-modules/grapheme { };
graphite_api = callPackage ../development/python-modules/graphite-api { };
graphite_beacon = callPackage ../development/python-modules/graphite_beacon { };
graphite-web = callPackage ../development/python-modules/graphite-web { }; graphite-web = callPackage ../development/python-modules/graphite-web { };
graphene = callPackage ../development/python-modules/graphene { }; graphene = callPackage ../development/python-modules/graphene { };
@ -4284,8 +4280,6 @@ in {
influxdb-client = callPackage ../development/python-modules/influxdb-client { }; influxdb-client = callPackage ../development/python-modules/influxdb-client { };
influxgraph = callPackage ../development/python-modules/influxgraph { };
inform = callPackage ../development/python-modules/inform { }; inform = callPackage ../development/python-modules/inform { };
iniconfig = callPackage ../development/python-modules/iniconfig { }; iniconfig = callPackage ../development/python-modules/iniconfig { };
@ -10666,7 +10660,7 @@ in {
# Used by circus and grab-site, 2020-08-29 # Used by circus and grab-site, 2020-08-29
tornado_4 = callPackage ../development/python-modules/tornado/4.nix { }; tornado_4 = callPackage ../development/python-modules/tornado/4.nix { };
# Used by streamlit, graphite_beacon, 2021-01-29 # Used by streamlit, 2021-01-29
tornado_5 = callPackage ../development/python-modules/tornado/5.nix { }; tornado_5 = callPackage ../development/python-modules/tornado/5.nix { };
torrequest = callPackage ../development/python-modules/torrequest { }; torrequest = callPackage ../development/python-modules/torrequest { };