Skip to content

Commit

Permalink
use otel instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
plengauer committed Sep 20, 2023
1 parent b305921 commit fc27864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: gitaptly
Version: 2.4.4
Version: 2.5.0
Architecture: all
Depends: debconf, bash, jq, cron, gzip, dpkg-dev, wget, python3, python3-pip, python3-venv
Suggests: opentelemetry-bash (>= 0.1.0)
Suggests: opentelemetry-bash (>= 0.7.0)
Priority: extra
Maintainer: Philipp Lengauer <p.lengauer@gmail.com>
Homepage: https://github.com/plengauer/GitAptly
Expand Down
14 changes: 6 additions & 8 deletions package/usr/bin/gitaptly_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ if [ -f /usr/bin/opentelemetry_bash.sh ]; then
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="$OTLP_TRACES_ENDPOINT"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS=authorization=$(echo "$OTLP_TRACES_HEADER" | jq -Rr @uri)
source /usr/bin/opentelemetry_bash.sh
else
otel_observe {
eval "$@"
}
otel_instrument dpkg-scanpackages
otel_instrument gzip
fi
cd /var/lib/gitaptly

Expand All @@ -30,7 +28,7 @@ if [ "$MODE" = 'cache' ]; then
mkdir -p pool/main/$owner/$repo
wget -q -nc -P pool/main/$owner/$repo $(bash /usr/bin/gitaptly_scan.sh $owner $repo) || true
done < /etc/gitaptly.conf
otel_observe dpkg-scanpackages --multiversion pool/ > dists/stable/main/binary-all/Packages
dpkg-scanpackages --multiversion pool/ > dists/stable/main/binary-all/Packages

elif [ "$MODE" = 'proxy' ]; then
while read line; do
Expand All @@ -48,7 +46,7 @@ elif [ "$MODE" = 'proxy' ]; then
continue
fi
wget -q -nc -O pool/main/$owner/$repo/$file $url
otel_observe dpkg-scanpackages --multiversion pool/main/$owner/$repo/$file | sed "s/Filename: .*/Filename: cgi-bin\/main\/$owner\/$repo\/$file/" >> dists/stable/main/binary-all/Packages
dpkg-scanpackages --multiversion pool/main/$owner/$repo/$file | sed "s/Filename: .*/Filename: cgi-bin\/main\/$owner\/$repo\/$file/" >> dists/stable/main/binary-all/Packages
rm pool/main/$owner/$repo/$file
ln --symbolic /usr/bin/gitaptly_serve.sh pool/main/$owner/$repo/$file
done
Expand All @@ -58,5 +56,5 @@ else
exit 1
fi

otel_observe gzip -9 < dists/stable/main/binary-all/Packages > dists/stable/main/binary-all/Packages.gz
otel_observe bash /usr/bin/gitaptly_create_release.sh dists/stable > dists/stable/Release
gzip -9 < dists/stable/main/binary-all/Packages > dists/stable/main/binary-all/Packages.gz
bash /usr/bin/gitaptly_create_release.sh dists/stable > dists/stable/Release

0 comments on commit fc27864

Please sign in to comment.