Make reports hostname configurable and enable stats collection in tests.

This patch adds --with-reports-host configure option, which sets the
REPORTS_BASE_URL constant. The default is reports.citusdata.com.

It also enables stats collection in tests.
pull/1751/head
Hadi Moshayedi 2017-10-31 21:33:45 -04:00 committed by Hadi Moshayedi
parent acaf085a80
commit 9bfbbf8a04
7 changed files with 51 additions and 12 deletions

34
configure vendored
View File

@ -686,6 +686,7 @@ enable_option_checking
with_extra_version with_extra_version
enable_coverage enable_coverage
with_libcurl with_libcurl
with_reports_hostname
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1316,6 +1317,9 @@ Optional Packages:
append STRING to version append STRING to version
--without-libcurl do not use libcurl for anonymous statistics --without-libcurl do not use libcurl for anonymous statistics
collection collection
--with-reports-hostname=HOSTNAME
Use HOSTNAME as hostname for statistics collection
and update checks
Some influential environment variables: Some influential environment variables:
PG_CONFIG Location to find pg_config for target PostgreSQL instalation PG_CONFIG Location to find pg_config for target PostgreSQL instalation
@ -4112,6 +4116,36 @@ fi
fi fi
# REPORTS_BASE_URL definition
# Check whether --with-reports-hostname was given.
if test "${with_reports_hostname+set}" = set; then :
withval=$with_reports_hostname;
case $withval in
yes)
as_fn_error $? "argument required for --with-reports-hostname option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-reports-hostname option" "$LINENO" 5
;;
*)
REPORTS_BASE_URL="https://${withval}"
;;
esac
else
REPORTS_BASE_URL="https://reports.citusdata.com"
fi
cat >>confdefs.h <<_ACEOF
#define REPORTS_BASE_URL "$REPORTS_BASE_URL"
_ACEOF
CITUS_CFLAGS="$CITUS_CFLAGS" CITUS_CFLAGS="$CITUS_CFLAGS"
CITUS_LDFLAGS="$LIBS" CITUS_LDFLAGS="$LIBS"

View File

@ -191,6 +191,14 @@ failure. It is possible the compiler isn't looking in the proper directory.
Use --without-libcurl to disable libcurl support.])]) Use --without-libcurl to disable libcurl support.])])
fi fi
# REPORTS_BASE_URL definition
PGAC_ARG_REQ(with, reports-hostname, [HOSTNAME],
[Use HOSTNAME as hostname for statistics collection and update checks],
[REPORTS_BASE_URL="https://${withval}"],
[REPORTS_BASE_URL="https://reports.citusdata.com"])
AC_DEFINE_UNQUOTED(REPORTS_BASE_URL, "$REPORTS_BASE_URL",
[Base URL for statistics collection and update checks])
AC_SUBST(CITUS_CFLAGS, "$CITUS_CFLAGS") AC_SUBST(CITUS_CFLAGS, "$CITUS_CFLAGS")
AC_SUBST(CITUS_LDFLAGS, "$LIBS") AC_SUBST(CITUS_LDFLAGS, "$LIBS")
AC_SUBST(POSTGRES_SRCDIR, "$POSTGRES_SRCDIR") AC_SUBST(POSTGRES_SRCDIR, "$POSTGRES_SRCDIR")

View File

@ -147,7 +147,7 @@ CollectBasicUsageStatistics(void)
appendStringInfo(fields, ",\"node_metadata\": %s", metadataJsonbStr); appendStringInfo(fields, ",\"node_metadata\": %s", metadataJsonbStr);
appendStringInfoString(fields, "}"); appendStringInfoString(fields, "}");
return SendHttpPostJsonRequest(STATS_COLLECTION_HOST "/v1/usage_reports", return SendHttpPostJsonRequest(REPORTS_BASE_URL "/v1/usage_reports",
fields->data, HTTP_TIMEOUT_SECONDS, fields->data, HTTP_TIMEOUT_SECONDS,
StatisticsCallback); StatisticsCallback);
} }
@ -170,7 +170,7 @@ void
CheckForUpdates(void) CheckForUpdates(void)
{ {
StringInfo url = makeStringInfo(); StringInfo url = makeStringInfo();
appendStringInfoString(url, STATS_COLLECTION_HOST "/v1/releases/latest?edition="); appendStringInfoString(url, REPORTS_BASE_URL "/v1/releases/latest?edition=");
if (!UrlEncode(url, CITUS_EDITION)) if (!UrlEncode(url, CITUS_EDITION))
{ {

View File

@ -79,6 +79,9 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Base URL for statistics collection and update checks */
#undef REPORTS_BASE_URL
/* The size of `void *', as computed by sizeof. */ /* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P #undef SIZEOF_VOID_P

View File

@ -23,3 +23,6 @@
/* Define to 1 if you have the `curl' library (-lcurl). */ /* Define to 1 if you have the `curl' library (-lcurl). */
#undef HAVE_LIBCURL #undef HAVE_LIBCURL
/* Base URL for statistics collection and update checks */
#undef REPORTS_BASE_URL

View File

@ -28,7 +28,6 @@ extern bool EnableStatisticsCollection;
#ifdef HAVE_LIBCURL #ifdef HAVE_LIBCURL
#define STATS_COLLECTION_HOST "https://citus-statistics.herokuapp.com"
#define HTTP_TIMEOUT_SECONDS 5 #define HTTP_TIMEOUT_SECONDS 5
extern void WarnIfSyncDNS(void); extern void WarnIfSyncDNS(void);

View File

@ -43,44 +43,36 @@ check-full: check-multi check-multi-mx check-multi-task-tracker-extra check-work
# for check-worker. But that's harmless besides a few cycles. # for check-worker. But that's harmless besides a few cycles.
check-worker: all check-worker: all
$(pg_regress_multi_check) --load-extension=citus \ $(pg_regress_multi_check) --load-extension=citus \
--server-option=citus.enable_statistics_collection=0 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/worker_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/worker_schedule $(EXTRA_TESTS)
check-multi: all tempinstall-main check-multi: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus \ $(pg_regress_multi_check) --load-extension=citus \
--server-option=citus.enable_statistics_collection=0 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_schedule $(EXTRA_TESTS)
check-multi-vg: all tempinstall-main check-multi-vg: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus --valgrind \ $(pg_regress_multi_check) --load-extension=citus --valgrind \
--server-option=citus.enable_statistics_collection=0 \
--pg_ctl-timeout=360 --connection-timeout=500000 --valgrind-path=valgrind --valgrind-log-file=$(VALGRIND_LOG_FILE) \ --pg_ctl-timeout=360 --connection-timeout=500000 --valgrind-path=valgrind --valgrind-log-file=$(VALGRIND_LOG_FILE) \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_schedule $(EXTRA_TESTS)
check-isolation: all tempinstall-main check-isolation: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus --isolationtester \ $(pg_regress_multi_check) --load-extension=citus --isolationtester \
--server-option=citus.enable_statistics_collection=0 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/isolation_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/isolation_schedule $(EXTRA_TESTS)
check-vanilla: all tempinstall-main check-vanilla: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus --vanillatest \ $(pg_regress_multi_check) --load-extension=citus --vanillatest
--server-option=citus.enable_statistics_collection=0
check-multi-mx: all tempinstall-main check-multi-mx: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus \ $(pg_regress_multi_check) --load-extension=citus \
--server-option=citus.enable_statistics_collection=0 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_mx_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_mx_schedule $(EXTRA_TESTS)
check-multi-task-tracker-extra: all tempinstall-main check-multi-task-tracker-extra: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus \ $(pg_regress_multi_check) --load-extension=citus \
--server-option=citus.enable_statistics_collection=0 \
--server-option=citus.task_executor_type=task-tracker \ --server-option=citus.task_executor_type=task-tracker \
--server-option=citus.large_table_shard_count=1 \ --server-option=citus.large_table_shard_count=1 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_task_tracker_extra_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_task_tracker_extra_schedule $(EXTRA_TESTS)
check-follower-cluster: all check-follower-cluster: all
$(pg_regress_multi_check) --load-extension=citus --follower-cluster \ $(pg_regress_multi_check) --load-extension=citus --follower-cluster \
--server-option=citus.enable_statistics_collection=0 \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_follower_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/multi_follower_schedule $(EXTRA_TESTS)
clean distclean maintainer-clean: clean distclean maintainer-clean: