mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
Merge pull request #220812 from anpin/feature/promscale-rebase
promscale: 0.10.0 -> 0.17.0
This commit is contained in:
commit
5249a7ce55
@ -1061,6 +1061,16 @@
|
||||
githubId = 1342360;
|
||||
name = "Andrew Morgan";
|
||||
};
|
||||
anpin = {
|
||||
email = "pavel@anpin.fyi";
|
||||
github = "anpin";
|
||||
githubId = 6060545;
|
||||
matrix = "@anpin:matrix.org";
|
||||
name = "Pavel Anpin";
|
||||
keys = [{
|
||||
fingerprint = "06E8 4FF6 0CCF 7AFD 5101 76C9 0FBC D3EE 6310 7407";
|
||||
}];
|
||||
};
|
||||
anpryl = {
|
||||
email = "anpryl@gmail.com";
|
||||
github = "anpryl";
|
||||
|
@ -713,6 +713,7 @@ in {
|
||||
tiddlywiki = handleTest ./tiddlywiki.nix {};
|
||||
tigervnc = handleTest ./tigervnc.nix {};
|
||||
timescaledb = handleTest ./timescaledb.nix {};
|
||||
promscale = handleTest ./promscale.nix {};
|
||||
timezone = handleTest ./timezone.nix {};
|
||||
tinc = handleTest ./tinc {};
|
||||
tinydns = handleTest ./tinydns.nix {};
|
||||
|
60
nixos/tests/promscale.nix
Normal file
60
nixos/tests/promscale.nix
Normal file
@ -0,0 +1,60 @@
|
||||
# mostly copied from ./timescaledb.nix which was copied from ./postgresql.nix
|
||||
# as it seemed unapproriate to test additional extensions for postgresql there.
|
||||
|
||||
{ system ? builtins.currentSystem
|
||||
, config ? { }
|
||||
, pkgs ? import ../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
with import ../lib/testing-python.nix { inherit system pkgs; };
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
postgresql-versions = import ../../pkgs/servers/sql/postgresql pkgs;
|
||||
test-sql = pkgs.writeText "postgresql-test" ''
|
||||
CREATE USER promscale SUPERUSER PASSWORD 'promscale';
|
||||
CREATE DATABASE promscale OWNER promscale;
|
||||
'';
|
||||
|
||||
make-postgresql-test = postgresql-name: postgresql-package: makeTest {
|
||||
name = postgresql-name;
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ anpin ];
|
||||
};
|
||||
|
||||
nodes.machine = { config, pkgs, ... }:
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = postgresql-package;
|
||||
extraPlugins = with postgresql-package.pkgs; [
|
||||
timescaledb
|
||||
promscale_extension
|
||||
];
|
||||
settings = { shared_preload_libraries = "timescaledb, promscale"; };
|
||||
};
|
||||
environment.systemPackages = with pkgs; [ promscale ];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.start()
|
||||
machine.wait_for_unit("postgresql")
|
||||
with subtest("Postgresql with extensions timescaledb and promscale is available just after unit start"):
|
||||
print(machine.succeed("sudo -u postgres psql -f ${test-sql}"))
|
||||
machine.succeed("sudo -u postgres psql promscale -c 'SHOW shared_preload_libraries;' | grep promscale")
|
||||
machine.succeed(
|
||||
"promscale --db.name promscale --db.password promscale --db.user promscale --db.ssl-mode allow --startup.install-extensions --startup.only"
|
||||
)
|
||||
machine.succeed("sudo -u postgres psql promscale -c 'SELECT ps_trace.get_trace_retention_period();' | grep '(1 row)'")
|
||||
machine.shutdown()
|
||||
'';
|
||||
};
|
||||
#version 15 is not supported yet
|
||||
applicablePostgresqlVersions = filterAttrs (_: value: versionAtLeast value.version "12" && !(versionAtLeast value.version "15")) postgresql-versions;
|
||||
in
|
||||
mapAttrs'
|
||||
(name: package: {
|
||||
inherit name;
|
||||
value = make-postgresql-test name package;
|
||||
})
|
||||
applicablePostgresqlVersions
|
@ -1,17 +0,0 @@
|
||||
|
||||
A Promscale test has a dependency on a package which was not intended to be
|
||||
vendored, so `go mod vendor` breaks. The dependency is not required to build
|
||||
Promscale, so it can be removed.
|
||||
|
||||
diff --git a/pkg/tests/end_to_end_tests/trace_query_integration_test.go b/pkg/tests/end_to_end_tests/trace_query_integration_test.go
|
||||
index 84a0d08..efbe5e1 100644
|
||||
--- a/pkg/tests/end_to_end_tests/trace_query_integration_test.go
|
||||
+++ b/pkg/tests/end_to_end_tests/trace_query_integration_test.go
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
ingstr "github.com/timescale/promscale/pkg/pgmodel/ingestor"
|
||||
"github.com/timescale/promscale/pkg/pgxconn"
|
||||
|
||||
- jaegerQueryApp "github.com/jaegertracing/jaeger/cmd/query/app"
|
||||
jaegerQueryService "github.com/jaegertracing/jaeger/cmd/query/app/querysvc"
|
||||
jaegerJSONModel "github.com/jaegertracing/jaeger/model/json"
|
||||
)
|
@ -7,20 +7,16 @@
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "promscale";
|
||||
version = "0.10.0";
|
||||
version = "0.17.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "timescale";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-KF+aD9vJYqNJkJftx27ZsxmOIXZ/2ciKwjwcTw0GBvY=";
|
||||
sha256 = "sha256-JizUI9XRzOEHF1kAblYQRYB11z9KWX7od3lPiRN+JNI=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./0001-remove-jaeger-test-dep.patch
|
||||
];
|
||||
|
||||
vendorSha256 = "sha256-/cjRM8CrOKnx0BcRu2+MLV28MYLOrG5x1DN24mRUJzQ=";
|
||||
vendorSha256 = "sha256-lnyKsipr/f9W9LWLb2lizKGLvIbS3XnSlOH1u1B87OY=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
@ -28,7 +24,11 @@ buildGoModule rec {
|
||||
"-X github.com/timescale/promscale/pkg/version.Version=${version}"
|
||||
"-X github.com/timescale/promscale/pkg/version.CommitHash=${src.rev}"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
# Without this build fails with
|
||||
# main module (github.com/timescale/promscale) does not contain package github.com/timescale/promscale/migration-tool/cmd/prom-migrator
|
||||
rm -r migration-tool
|
||||
'';
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
@ -51,6 +51,6 @@ buildGoModule rec {
|
||||
changelog = "https://github.com/timescale/promscale/blob/${version}/CHANGELOG.md";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ _0x4A6F ];
|
||||
maintainers = with maintainers; [ _0x4A6F anpin ];
|
||||
};
|
||||
}
|
||||
|
60
pkgs/servers/sql/postgresql/ext/promscale_extension.nix
Normal file
60
pkgs/servers/sql/postgresql/ext/promscale_extension.nix
Normal file
@ -0,0 +1,60 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, buildPgxExtension
|
||||
, postgresql
|
||||
, stdenv
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
buildPgxExtension rec {
|
||||
inherit postgresql;
|
||||
|
||||
pname = "promscale_extension";
|
||||
version = "0.8.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "timescale";
|
||||
repo = "promscale_extension";
|
||||
rev = version;
|
||||
sha256 = "sha256-vyEfQMGguHrHYdBEEmbev29L2uCa/4xL9DpGIniUwfI=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-VK9DObkg4trcGUXxxISCd0zqU3vc1Qt6NxqpgKIARCQ=";
|
||||
|
||||
cargoPatches = [
|
||||
# there is a duplicate definition in the lock file which fails to build with buildRustPackage
|
||||
(fetchpatch {
|
||||
name = "cargo-vendor.patch";
|
||||
url = "https://github.com/timescale/promscale_extension/commit/3048bd959430e9abc2c1d5c772ab6b4fc1dc6a95.patch";
|
||||
hash = "sha256-xTk4Ml8GN06QlJdrvAdVK21r30ZR/S83y5A5jJPdOw4=";
|
||||
})
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
patchShebangs create-upgrade-symlinks.sh extract-extension-version.sh
|
||||
## Hack to boostrap the build because some pgx commands require this file. It gets re-generated later.
|
||||
cp templates/promscale.control ./promscale.control
|
||||
'';
|
||||
postInstall = ''
|
||||
ln -s $out/lib/promscale-${version}.so $out/lib/promscale.so
|
||||
'';
|
||||
passthru.tests = {
|
||||
promscale = nixosTests.promscale;
|
||||
};
|
||||
|
||||
# tests take really long
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Promscale is an open source observability backend for metrics and traces powered by SQL";
|
||||
homepage = "https://github.com/timescale/promscale_extension";
|
||||
maintainers = with maintainers; [ anpin ];
|
||||
platforms = postgresql.meta.platforms;
|
||||
license = licenses.unfree;
|
||||
|
||||
# as it needs to be used with timescaledb, simply use the condition from there
|
||||
broken = versionOlder postgresql.version "12"
|
||||
|| versionAtLeast postgresql.version "15";
|
||||
};
|
||||
}
|
@ -71,6 +71,8 @@ self: super: {
|
||||
|
||||
pg_safeupdate = super.callPackage ./ext/pg_safeupdate.nix { };
|
||||
|
||||
promscale_extension = super.callPackage ./ext/promscale_extension.nix { };
|
||||
|
||||
repmgr = super.callPackage ./ext/repmgr.nix { };
|
||||
|
||||
rum = super.callPackage ./ext/rum.nix { };
|
||||
|
Loading…
Reference in New Issue
Block a user