Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove telegraf and use only fluent-bit for telemetry #1030

Draft
wants to merge 47 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dec238f
get build with new fluent-bit
gracewehner Dec 2, 2024
ed96e0b
update branch name
gracewehner Dec 2, 2024
890a1ad
support mariner
gracewehner Dec 2, 2024
bd51464
fix download
gracewehner Dec 2, 2024
a421f17
install normally
gracewehner Dec 2, 2024
8c0d65e
telegraf to file
gracewehner Dec 2, 2024
9c03ffa
get latest fluent-bit
gracewehner Dec 2, 2024
c3aeb9f
add process metrics from fluent-bit
gracewehner Dec 3, 2024
2cc0010
add back in telegraf
gracewehner Dec 3, 2024
759e167
use correct mem value
gracewehner Dec 4, 2024
beb425f
add in extra dimensions
gracewehner Dec 5, 2024
2b5102b
remove telegraf cpu/mem
gracewehner Dec 5, 2024
a5228b2
dont start telegraf
gracewehner Dec 5, 2024
b07f6aa
unrelated telemetry fixes
gracewehner Dec 5, 2024
9a0bff3
build custom fluent-bit
gracewehner Dec 6, 2024
562b7cc
add in metrics
gracewehner Dec 6, 2024
78efb86
fix path to cmake options
gracewehner Dec 6, 2024
44d3b26
missed file
gracewehner Dec 6, 2024
7036b98
fluent-bit version
gracewehner Dec 6, 2024
3710e9f
remove other fluent-bit reference
gracewehner Dec 6, 2024
a0436ce
remove process printing, add metrics printing
gracewehner Dec 6, 2024
9e4ce53
settings
gracewehner Dec 6, 2024
b29e4d0
remove db
gracewehner Dec 6, 2024
ed39e3c
remove printing metrics
gracewehner Dec 7, 2024
827bece
use metrics selector
gracewehner Dec 12, 2024
6e69eca
fix decoding to have ns and ss
gracewehner Dec 12, 2024
6be8680
change daemonset
gracewehner Dec 12, 2024
4ba0db8
match exact telemetry name
gracewehner Dec 12, 2024
118cd88
include all changed files
gracewehner Dec 12, 2024
10c6d1b
completely remove telegraf
gracewehner Dec 12, 2024
ce3180e
fix daemonset spacing
gracewehner Dec 12, 2024
f250ff3
change labels to string
gracewehner Dec 12, 2024
6365603
remove db references
gracewehner Dec 12, 2024
98c4fca
install newer fluent-bit
gracewehner Dec 12, 2024
61145b9
typo fix
gracewehner Dec 13, 2024
600cd5c
update to build windows
gracewehner Dec 13, 2024
0a7116d
add all env vars
gracewehner Dec 13, 2024
23b1f40
add in missing telemetry
gracewehner Dec 13, 2024
c8f74a6
turn on label processor
gracewehner Dec 13, 2024
280f86c
accept for daemonset too
gracewehner Dec 13, 2024
9f3bdbc
fix windows pid finder
gracewehner Dec 13, 2024
667c5b5
cleanup
gracewehner Dec 14, 2024
fdde68f
fixes
gracewehner Dec 14, 2024
e11b82b
fix OS_TYPE
gracewehner Dec 14, 2024
520d3f7
add debugging logs
gracewehner Dec 15, 2024
a2ca7ed
extra logging
gracewehner Dec 15, 2024
3108e4e
fix
gracewehner Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .pipelines/azure-pipeline-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ trigger:
branches:
include:
- main
- grace/telegraf-removal-2024

pr:
autoCancel: true
Expand All @@ -26,6 +27,7 @@ variables:
BUILD_WINDOWS: true
Codeql.Enabled: true
GOLANG_VERSION: '1.22.7'
FLUENT_BIT_VERSION: '3.2.2'

stages:
- stage: Build
Expand Down Expand Up @@ -634,7 +636,7 @@ stages:

docker buildx create --name dockerbuilder --driver docker-container --driver-opt image=mcr.microsoft.com/azuremonitor/containerinsights/cidev/prometheus-collector/images:buildx-stable-1 --use
docker buildx inspect --bootstrap
docker buildx build . --platform=linux/amd64,linux/arm64 --file ./build/linux/Dockerfile -t $(LINUX_FULL_IMAGE_NAME) --build-arg "GOLANG_VERSION=$(GOLANG_VERSION)" --metadata-file $(Build.ArtifactStagingDirectory)/linux/metadata.json --push # --cache-to type=registry,ref=$(ACR_REGISTRY)$(ACR_REPOSITORY)/cache:prometheuscollector,mode=max --cache-from type=registry,ref=$(ACR_REGISTRY)$(ACR_REPOSITORY)/cache:prometheuscollector
docker buildx build . --platform=linux/amd64 --file ./build/linux/Dockerfile -t $(LINUX_FULL_IMAGE_NAME) --build-arg "GOLANG_VERSION=$(GOLANG_VERSION)" --build-arg "FLUENT_BIT_VERSION=$(FLUENT_BIT_VERSION)" --metadata-file $(Build.ArtifactStagingDirectory)/linux/metadata.json --push # --cache-to type=registry,ref=$(ACR_REGISTRY)$(ACR_REPOSITORY)/cache:prometheuscollector,mode=max --cache-from type=registry,ref=$(ACR_REGISTRY)$(ACR_REPOSITORY)/cache:prometheuscollector
docker pull $(LINUX_FULL_IMAGE_NAME)
docker system prune --all -f
workingDirectory: $(Build.SourcesDirectory)/otelcollector/
Expand Down
51 changes: 43 additions & 8 deletions otelcollector/build/linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,39 @@ RUN apt-get update && apt-get install gcc-aarch64-linux-gnu -y
ARG TARGETOS TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ] ; then CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -buildmode=exe -ldflags '-linkmode external -extldflags=-Wl,-z,now' -o main.exe ./main.go ; else CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -buildmode=exe -ldflags '-linkmode external -extldflags=-Wl,-z,now' -o main.exe ./main.go ; fi

ARG TARGETARCH
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS fluent-bit-binary-builder
WORKDIR /
# Install with the same exact dependencies and code source that Mariner uses
RUN tdnf install wget tar ca-certificates bison cmake cyrus-sasl-devel doxygen flex gcc-c++ \
gnutls-devel graphviz libpq-devel libyaml-devel luajit-devel make openssl-devel pkgconfig \
systemd-devel systemd-rpm-macros zlib-devel build-essential -y
ARG FLUENT_BIT_VERSION
RUN wget https://github.com/fluent/fluent-bit/archive/refs/tags/v${FLUENT_BIT_VERSION}.tar.gz
RUN tar -xvf v${FLUENT_BIT_VERSION}.tar.gz
# Add a file with settings to build only the plugins we use
COPY ./fluent-bit/plugins_options.cmake /fluent-bit-${FLUENT_BIT_VERSION}/cmake/plugins_options.cmake
# Make a change that allows Fluent-Bit metrics to flow to our Go output plugin
RUN sed -i '/out->type = FLB_OUTPUT_PLUGIN_PROXY;/a \ \ \ \ out->event_type = FLB_OUTPUT_LOGS | FLB_OUTPUT_METRICS;' /fluent-bit-${FLUENT_BIT_VERSION}/src/flb_plugin_proxy.c
WORKDIR /fluent-bit-${FLUENT_BIT_VERSION}/build
# Run cmake with the same flags that Mariner uses
RUN cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DFLB_EXAMPLES=Off \
-DFLB_OUT_SLACK=Off \
-DFLB_IN_SYSTEMD=On \
-DFLB_OUT_TD=Off \
-DFLB_OUT_ES=Off \
-DFLB_SHARED_LIB=On \
-DFLB_RELEASE=On \
-DFLB_DEBUG=Off \
-DFLB_TLS=On \
-DFLB_JEMALLOC=On \
-DFLB_PREFER_SYSTEM_LIBS=On \
-DFLB_PROXY_GO=On ../
RUN make
RUN make install

FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 as builder
LABEL description="Azure Monitor Prometheus metrics collector"
LABEL maintainer="[email protected]"
Expand Down Expand Up @@ -103,9 +136,11 @@ COPY --from=main-builder --chmod=777 /main/main.exe $tmpdir/main

COPY ./scripts/*.sh $tmpdir/
COPY ./metricextension/me.config ./metricextension/me_internal.config ./metricextension/me_ds.config ./metricextension/me_ds_internal.config /usr/sbin/
COPY ./telegraf/ $tmpdir/telegraf/
COPY ./fluent-bit/fluent-bit.conf ./fluent-bit/fluent-bit-daemonset.conf ./fluent-bit/fluent-bit-parsers.conf $tmpdir/fluent-bit/
COPY ./fluent-bit/fluent-bit.yaml ./fluent-bit/fluent-bit-daemonset.yaml ./fluent-bit/fluent-bit-parsers.conf $tmpdir/fluent-bit/
COPY --from=fluent-bit-builder /src/out_appinsights.so $tmpdir/fluent-bit/bin/
COPY --from=fluent-bit-binary-builder /usr/local/bin/fluent-bit /usr/local/bin/fluent-bit
COPY --from=fluent-bit-binary-builder /usr/local/etc/fluent-bit /usr/local/etc/fluent-bit
COPY --from=fluent-bit-binary-builder /usr/local/lib/fluent-bit /usr/local/etc/fluent-bit
COPY ./react /static/react
COPY ./LICENSE $tmpdir/microsoft
COPY ./NOTICE $tmpdir/microsoft
Expand All @@ -123,7 +158,7 @@ RUN chmod 775 $tmpdir/*.sh;
RUN sync;
RUN $tmpdir/setup.sh ${TARGETARCH}
# If wanting to run without distroless, uncomment this line and comment everything after
# CMD [ "/opt/main.sh" ]
# ENTRYPOINT ["./opt/main"]

FROM mcr.microsoft.com/cbl-mariner/distroless/base:2.0
# Below is for ContainerInsightsPrometheusCollector-Prod AppInsights Resource
Expand Down Expand Up @@ -169,8 +204,6 @@ COPY --from=builder /usr/sbin/MetricsExtension /usr/sbin/MetricsExtension
COPY --from=builder /usr/bin/inotifywait /usr/bin/inotifywait
COPY --from=builder /usr/bin/bash /usr/bin/bash
COPY --from=builder /usr/sbin/busybox /usr/sbin/busybox
COPY --from=builder /usr/bin/fluent-bit /usr/bin/fluent-bit
COPY --from=builder /usr/bin/telegraf /usr/bin/telegraf
COPY --from=builder /usr/sbin/crond /usr/sbin/crond
COPY --from=builder /usr/bin/vim /usr/bin/vim
COPY --from=builder /usr/share/vim /usr/share/vim
Expand All @@ -183,6 +216,10 @@ COPY --from=builder /bin/sh /bin/sh
COPY --from=builder /usr/bin/p11-kit /usr/bin
COPY --from=builder /usr/bin/trust /usr/bin

COPY --from=fluent-bit-binary-builder /usr/local/bin/fluent-bit /usr/local/bin/fluent-bit
COPY --from=fluent-bit-binary-builder /usr/local/etc/fluent-bit /usr/local/etc/fluent-bit
COPY --from=fluent-bit-binary-builder /usr/local/lib/fluent-bit /usr/local/etc/fluent-bit

# bash dependencies
COPY --from=builder /lib/libreadline.so.8 /lib/
COPY --from=builder /usr/lib/libncursesw.so.6 /usr/lib/libtinfo.so.6 /usr/lib/
Expand All @@ -198,9 +235,7 @@ COPY --from=builder /lib/libboost_filesystem.so.1.76.0 /lib/libcpprest.so.2.10
COPY --from=builder /lib64/libuuid.so.1 /lib64
# fluent-bit dependencies
# libssl.so.1.1 & libcrypto.so.1.1 are already available with openssl in distroless and copying them over causes FIPS HMAC verification failures
COPY --from=builder /lib/libyaml-0.so.2 /lib/libsystemd.so.0 /lib/libcurl.so.4 /lib/libm.so.6 /lib/libz.so.1 /lib/libzstd.so.1 /lib/libsasl2.so.3 /lib/libgcc_s.so.1 /lib/libc.so.6 /lib/liblzma.so.5 /lib/liblz4.so.1 /lib/libcap.so.2 /lib/libgcrypt.so.20 /lib/libnghttp2.so.14 /lib/libssh2.so.1 /lib/libgssapi_krb5.so.2 /lib/libresolv.so.2 /lib/libgpg-error.so.0 /usr/lib/libkrb5.so.3 /usr/lib/libk5crypto.so.3 /usr/lib/libcom_err.so.2 /usr/lib/libkrb5support.so.0 /lib/
# telegraf dependencies
COPY --from=builder /lib/libc.so.6 /lib/
COPY --from=fluent-bit-binary-builder /lib/libluajit-5.1.so.2 /lib/libyaml-0.so.2 /lib/libsystemd.so.0 /lib/libgcc_s.so.1 /lib/libc.so.6 /lib/liblzma.so.5 /lib/libzstd.so.1 /lib/liblz4.so.1 /lib/libcap.so.2 /lib/libgcrypt.so.20 /lib/libgpg-error.so.0 /lib/
# mdsd dependencies
COPY --from=builder /usr/lib/libdl.so.2 /usr/lib/librt.so.1 /usr/lib/libpthread.so.0 /usr/lib/libm.so.6 /usr/lib/libstdc++.so.6 /usr/lib/libgcc_s.so.1 /usr/lib/
# logrotate dependencies
Expand Down
1 change: 0 additions & 1 deletion otelcollector/build/windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ COPY ./configmapparser/default-prom-configs/*.yml $tmpdir/microsoft/otelcollecto
COPY ./opentelemetry-collector-builder/otelcollector.exe ./opentelemetry-collector-builder/collector-config-default.yml ./opentelemetry-collector-builder/collector-config-template.yml $tmpdir/microsoft/otelcollector/
COPY ./prom-config-validator-builder/promconfigvalidator.exe $tmpdir/
COPY ./metricextension/me.config ./metricextension/me_internal.config ./metricextension/me_ds.config ./metricextension/me_ds_win.config ./metricextension/me_ds_internal.config ./metricextension/me_ds_internal_win.config $tmpdir/metricextension/
COPY ./telegraf/telegraf-prometheus-collector-windows.conf $tmpdir/telegraf/
COPY ./fluent-bit/fluent-bit-windows.conf $tmpdir/fluent-bit/
COPY ./fluent-bit/fluent-bit-parsers.conf $tmpdir/fluent-bit/
COPY ./fluent-bit/src/out_appinsights.so $tmpdir/fluent-bit/bin/
Expand Down
2 changes: 1 addition & 1 deletion otelcollector/build/windows/scripts/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Write-Host ('Installing Fluent Bit');
try {
# Keep version in sync with linux in setup.sh file
# $fluentBitUri = 'https://github.com/microsoft/OMS-docker/releases/download/winakslogagent/td-agent-bit-1.4.0-win64.zip'
$fluentBitUri = 'https://releases.fluentbit.io/2.1/fluent-bit-2.1.10-win64.zip'
$fluentBitUri = 'https://releases.fluentbit.io/3.0/fluent-bit-3.0.7-win64.zip'
Invoke-WebRequest -Uri $fluentBitUri -OutFile /installation/fluent-bit.zip
Expand-Archive -Path /installation/fluent-bit.zip -Destination /installation/fluent-bit
Move-Item -Path /installation/fluent-bit/*/bin/* -Destination /opt/fluent-bit/bin/ -ErrorAction SilentlyContinue
Expand Down
203 changes: 0 additions & 203 deletions otelcollector/fluent-bit/fluent-bit-daemonset.conf

This file was deleted.

Loading