diff --git a/ct/signoz.sh b/ct/signoz.sh index 6bbf27ce6..1e89a275b 100644 --- a/ct/signoz.sh +++ b/ct/signoz.sh @@ -31,6 +31,31 @@ function update_script() { exit fi + if [[ ! -f /var/lib/clickhouse/user_scripts/histogramQuantile ]]; then + fetch_and_deploy_gh_release "histogram-quantile" "SigNoz/signoz" "prebuild" "histogram-quantile/v0.0.1" "/opt/histogram-quantile" "histogram-quantile_linux_$(arch_resolve).tar.gz" + + msg_info "Adding ClickHouse histogramQuantile Function" + mkdir -p /var/lib/clickhouse/user_scripts + install -m 755 -o clickhouse -g clickhouse /opt/histogram-quantile/histogram-quantile /var/lib/clickhouse/user_scripts/histogramQuantile + cat </etc/clickhouse-server/histogram_quantile_function.yaml +functions: + name: histogramQuantile + type: executable + format: CSV + command: ./histogramQuantile + return_type: Float64 + argument: + - name: buckets + type: Array(Float64) + - name: counts + type: Array(Float64) + - name: quantile + type: Float64 +EOF + systemctl restart clickhouse-server + msg_ok "Added ClickHouse histogramQuantile Function" + fi + if check_for_gh_release "signoz" "SigNoz/signoz"; then msg_info "Stopping Services" systemctl stop signoz diff --git a/install/signoz-install.sh b/install/signoz-install.sh index 2fc0ccd46..cd5046f87 100644 --- a/install/signoz-install.sh +++ b/install/signoz-install.sh @@ -36,6 +36,28 @@ export DEBIAN_FRONTEND=noninteractive $STD apt install -y clickhouse-server clickhouse-client msg_ok "Setup ClickHouse" +fetch_and_deploy_gh_release "histogram-quantile" "SigNoz/signoz" "prebuild" "histogram-quantile/v0.0.1" "/opt/histogram-quantile" "histogram-quantile_linux_$(arch_resolve).tar.gz" + +msg_info "Setting up ClickHouse histogramQuantile Function" +mkdir -p /var/lib/clickhouse/user_scripts +install -m 755 -o clickhouse -g clickhouse /opt/histogram-quantile/histogram-quantile /var/lib/clickhouse/user_scripts/histogramQuantile +cat </etc/clickhouse-server/histogram_quantile_function.yaml +functions: + name: histogramQuantile + type: executable + format: CSV + command: ./histogramQuantile + return_type: Float64 + argument: + - name: buckets + type: Array(Float64) + - name: counts + type: Array(Float64) + - name: quantile + type: Float64 +EOF +msg_ok "Setup ClickHouse histogramQuantile Function" + msg_info "Setting up Zookeeper" ZOOURL=$(curl -fsSL https://dlcdn.apache.org/zookeeper/current/ | grep -o 'apache-zookeeper-[0-9.]\+-bin\.tar\.gz' | head -n1) curl -fsSL "https://dlcdn.apache.org/zookeeper/current/$ZOOURL" -o ~/zookeeper.tar.gz