Skip to content

Commit

Permalink
Add support for binary otelcollectors
Browse files Browse the repository at this point in the history
  • Loading branch information
jriguera committed Aug 22, 2024
1 parent f04bba0 commit b585b0e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Parameters (see `jobs/otelcollector-bin/spec`):

To update the collector deployed by this release:

1. In `packages/otelcollector-linux-amd64/spec` file, update the version of the tar file under `files` section and also the commented URL.
1. In `packages/otelcollector-linux-amd64/spec` file, update the version of the tar file under `files` section and also the commented URL. You can use files with 2 extensions: `.bin` and `.tgz`.
2. Run `./update-blobs.sh`. This will read the commented URL from the previous file, and create the file specified in `files` section. This file will become a *blob* which will be uploaded/synced to the `blobstore`.
3. Upload the release to a Bosh director and test it (see below).
4. Push all blob and package resources to the repository. Check if the pipeline works and check if the generated package (bosh release) works.
Expand Down
2 changes: 1 addition & 1 deletion manifest/addon-add-loggregator-ingress-mtls.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- type: replace
path: /addons?/name=otelcollector-binary/jobs/name=otelcollector-bin/properties/ingress/grpc/tls?
path: /addons?/name=otel-collector-agent/jobs/name=otelcollector-bin/properties/ingress/grpc/tls?
value:
ca_cert: ((otel_collector_tls.ca))
cert: ((otel_collector_tls.certificate))
Expand Down
49 changes: 49 additions & 0 deletions manifest/addon-base-otelcollector-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
releases:
- name: otelcollector-binary
version: latest

addons:
- name: otel-collector-agent
jobs:
- name: otelcollector-bin
release: otelcollector-binary
properties:
otelcollector-bin:
config: |
extensions:
health_check:
receivers:
otlp:
protocols:
grpc:
endpoint: ${env:OTELCOL_GRPC_ADDR}:${env:OTELCOL_GRPC_PORT}
# Collect own metrics
prometheus:
config:
scrape_configs:
- job_name: 'otel-collector'
scrape_interval: 30s
static_configs:
- targets: ['127.0.0.1:8881']
processors:
batch:
exporters:
debug:
verbosity: basic
service:
logs:
level: INFO
metrics:
level: basic
address: 127.0.0.1:8881
extensions: [health_check, pprof]
pipelines:
metrics:
receivers: [otlp, prometheus]
processors: [batch]
exporters: [debug]
21 changes: 17 additions & 4 deletions packages/otelcollector-linux-amd64/packaging
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
set -e -x

BOSH_PACKAGES_DIR=${BOSH_PACKAGES_DIR:-/var/vcap/packages}
OTELCOL_VERSION=$(ls -vr otelcollector-linux-amd64/otelcol-contrib_*_linux_amd64.tar.gz | sed 's/.*\/otelcol-contrib_\(.*\)_linux_amd64.tar.gz$/\1/' | head -1)
OTELCOL_VERSION=$(ls -vr otelcollector-linux-amd64/otelcol-contrib_*_linux_amd64* | sed 's/.*\/otelcol-contrib_\(.*\)_linux_amd64.*$/\1/' | head -1)
FILE=$(ls -vr "otelcollector-linux-amd64/otelcol-contrib_${OTELCOL_VERSION}_linux_amd64"* | head -1)

echo "Extracting otel collector version ${OTELCOL_VERSION} ... "
mkdir -p ${BOSH_INSTALL_TARGET}/bin
tar xzf "otelcollector-linux-amd64/otelcol-contrib_${OTELCOL_VERSION}_linux_amd64.tar.gz" -C ${BOSH_INSTALL_TARGET}
mv ${BOSH_INSTALL_TARGET}/otelcol-contrib ${BOSH_INSTALL_TARGET}/bin/otelcollector
case "${FILE##*.}" in
bin)
echo "Copying otel collector binary version ${OTELCOL_VERSION} ... "
cp ${FILE} ${BOSH_INSTALL_TARGET}/bin/otelcollector
;;
tgz)
echo "Extracting otel collector version ${OTELCOL_VERSION} ... "
tar xzf ${FILE} -C ${BOSH_INSTALL_TARGET}
mv ${BOSH_INSTALL_TARGET}/otelcol-contrib ${BOSH_INSTALL_TARGET}/bin/otelcollector
;;
*)
echo "Unknown file extension, valid types are bin and tgz"
exit 1
;;
esac
chmod a+x ${BOSH_INSTALL_TARGET}/bin/*

# Install shell helpers
Expand Down
3 changes: 2 additions & 1 deletion packages/otelcollector-linux-amd64/spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: otelcollector-linux-amd64
dependencies: []

files:
- otelcollector-linux-amd64/otelcol-contrib_0.100.0_linux_amd64.tar.gz # https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.100.0/otelcol-contrib_0.100.0_linux_amd64.tar.gz
- otelcollector-linux-amd64/otelcol-contrib_0.107.0_linux_amd64.bin # https://github.com/springernature/o11y-otel-contextprocessor/releases/download/v0.107.0-cfgardenobserver0/otelcol-dev.bin
# - otelcollector-linux-amd64/otelcol-contrib_0.100.0_linux_amd64.tgz # https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.100.0/otelcol-contrib_0.100.0_linux_amd64.tar.gz
- bosh-helpers/**/*

0 comments on commit b585b0e

Please sign in to comment.