1
0
Форкнуть 0
Not sure if this even works yet.
This commit is contained in:
Andrew Hayworth 2021-01-26 14:56:36 -06:00
Родитель 924a5e1de4
Коммит d3f4cee228
5 изменённых файлов: 90 добавлений и 0 удалений

Просмотреть файл

@ -1,2 +1,4 @@
# heroku-buildpack-lightstep-collector
Heroku buildpack to run the lightstep collector in each dyno
Honestly not sure this even works yet.

50
bin/compile Executable file
Просмотреть файл

@ -0,0 +1,50 @@
#!/bin/bash
set -eo pipefail
# set -x
BUILD_DIR=$1
CACHE_DIR=$2
ENV_DIR=$3
BUILDPACK_DIR=$(cd "$(dirname "$0")"; cd ..; pwd)
VERSION="2020.09.24.05.22.16Z"
CACHED_VERSION="$CACHE_DIR/lightstep-collector-$VERSION"
arrow() {
echo '----->' "$@"
}
fetch_lightstep() {
if [ ! -f "$CACHED_VERSION" ]; then
arrow "Installing LightStep collector ${VERSION}"
wget \
-O lightstep-collector.deb \
--quiet \
--content-disposition \
https://packagecloud.io/lightstep/collector/packages/ubuntu/bionic/lightstep-collector_${VERSION}_amd64.deb/download.deb
UNPACK_DIR="lightstep-collector-${VERSION}"
dpkg -x lightstep-collector.deb "$UNPACK_DIR"
# Only contains usr/share/doc
rm -rf "$UNPACK_DIR/usr"
mkdir "$CACHED_VERSION"
mv "$UNPACK_DIR/*" "$CACHED_VERSION/"
else
arrow "LightStep collector ${VERSION} found in cache"
fi
}
install_lightstep() {
mkdir -p "$BUILD_DIR/bin/lightstep-collector"
mkdir -p "$BUILD_DIR/.profile.d"
cp "$CACHE_DIR/opt/lightstep/collector" "$BUILD_DIR/bin/lightstep-collector/collector"
cp "$BUILDPACK_DIR/extra/lightstep-collector.sh" "$BUILD_DIR/.profile.d/lightstep-collector.sh"
}
fetch_lightstep
install_lightstep

3
bin/detect Executable file
Просмотреть файл

@ -0,0 +1,3 @@
#!/bin/bash
echo "LightStep Collector"

5
bin/release Executable file
Просмотреть файл

@ -0,0 +1,5 @@
#!/bin/bash
cat <<EOF
---
EOF

Просмотреть файл

@ -0,0 +1,30 @@
#!/bin/bash
ulimit -n $(ulimit -n -H)
LS_POOL=${LS_POOL:-heroku}
LS_GUID="${HEROKU_APP_NAME}-${DYNO}"
LS_BYTES_PER_PROJECT=${LS_BYTES_PER_PROJECT:-100000}
# TODO: metrics
# TODO: ports
cat <<EOF > "$HOME/bin/lightstep-collector/collector.yaml"
api_key: ${LS_API_KEY}
pool: ${LS_POOL}
guid: ${LS_GUID}
babysitter_port: 8000
plain_port: 8383
admin:
plain_port: 8080
http:
plain_port: 8181
grpc:
plain_port: 8282
instrument:
start_wait_time_limit: 30s
reporter:
bytes_per_project: ${LS_BYTES_PER_PROJECT}
span_group_update_period: 2s
EOF
"$HOME/bin/lightstep-collector/collector" \
--collector_base_config="$HOME/bin/lightstep-collector/collector.yaml" 2>&1 &