forked from bottlerocket-os/bottlerocket-core-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bottlerocket-os#50 from koooosh/add-otel-collector
Add aws-otel-collector
- Loading branch information
Showing
9 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/aws-otel-collector/0001-change-logger-and-extraconfig-file-paths.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 1f1fc80e5869e125f5900aca76c3dbd3f1a24d81 Mon Sep 17 00:00:00 2001 | ||
From: Kush Upadhyay <[email protected]> | ||
Date: Thu, 15 Aug 2024 09:12:55 +0000 | ||
Subject: [PATCH] change logger and extraconfig file paths | ||
|
||
Signed-off-by: Kush Upadhyay <[email protected]> | ||
--- | ||
pkg/extraconfig/extraconfig.go | 2 +- | ||
pkg/logger/logger.go | 2 +- | ||
2 files changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/pkg/extraconfig/extraconfig.go b/pkg/extraconfig/extraconfig.go | ||
index 9c14d5f7..8ee7cbd9 100644 | ||
--- a/pkg/extraconfig/extraconfig.go | ||
+++ b/pkg/extraconfig/extraconfig.go | ||
@@ -23,7 +23,7 @@ import ( | ||
) | ||
|
||
var ( | ||
- UnixExtraConfigPath = "/opt/aws/aws-otel-collector/etc/extracfg.txt" | ||
+ UnixExtraConfigPath = "/etc/aws-otel-collector/extracfg.txt" | ||
WindowsExtraConfigPath = "C:\\ProgramData\\Amazon\\AWSOTelCollector\\Configs\\extracfg.txt" | ||
) | ||
|
||
diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go | ||
index 9805eeab..7fcbab31 100644 | ||
--- a/pkg/logger/logger.go | ||
+++ b/pkg/logger/logger.go | ||
@@ -31,7 +31,7 @@ import ( | ||
) | ||
|
||
var ( | ||
- UnixLogPath = "/opt/aws/aws-otel-collector/logs/aws-otel-collector.log" | ||
+ UnixLogPath = "/var/log/aws/aws-otel-collector.log" | ||
WindowsLogPath = "C:\\ProgramData\\Amazon\\AWSOTelCollector\\Logs\\aws-otel-collector.log" | ||
logfile = getLogFilePath() | ||
lumberjackLogger = tryNewLumberJackLogger() | ||
-- | ||
2.40.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "aws-otel-collector" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
build = "../build.rs" | ||
|
||
[lib] | ||
path = "../packages.rs" | ||
|
||
[[package.metadata.build-package.external-files]] | ||
url = "https://github.com/aws-observability/aws-otel-collector/archive/v0.40.0/aws-otel-collector-v0.40.0.tar.gz" | ||
sha512 = "4dc90d798fc818f357c93424e3111697e6830a2dc9913fb71e754959ec4f6002be8f079220208cad93b3b6850d337174fa0e52f57d517364d004dd08bae97e14" | ||
|
||
[build-dependencies] | ||
glibc = { path = "../glibc" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C /etc/aws-otel-collector.yaml - - - - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=AWS OTEL collector | ||
After=network-online.target configured.target | ||
Wants=network-online.target configured.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/aws-otel-collector --config /etc/aws-otel-collector.yaml | ||
KillMode=process | ||
Restart=always | ||
RestartSec=5s | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
%global goproject github.com/aws-observability | ||
%global gorepo aws-otel-collector | ||
%global goimport %{goproject}/%{gorepo} | ||
|
||
Name: %{_cross_os}aws-otel-collector | ||
Version: 0.40.0 | ||
Release: 1%{?dist} | ||
Summary: AWS Distro for OpenTelemetry Collector | ||
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0 | ||
URL: https://github.com/aws-observability/aws-otel-collector | ||
Source0: %{gorepo}-v%{version}.tar.gz | ||
Source1: aws-otel-collector.service | ||
Source2: aws-otel-collector-tmpfiles.conf | ||
Source3: aws-otel-collector.yaml | ||
|
||
# Change log and extraconfig file paths from /opt to /var/log and /etc, respectively | ||
Patch0001: 0001-change-logger-and-extraconfig-file-paths.patch | ||
|
||
BuildRequires: %{_cross_os}glibc-devel | ||
Requires: %{name}(binary) | ||
|
||
%description | ||
%{summary}. | ||
|
||
%package bin | ||
Summary: Telemetry collector binary | ||
Provides: %{name}(binary) | ||
Requires: (%{_cross_os}image-feature(no-fips) and %{name}) | ||
Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin) | ||
|
||
%description bin | ||
%{summary}. | ||
|
||
%package fips-bin | ||
Summary: Telemetry collector binary, FIPS edition | ||
Provides: %{name}(binary) | ||
Requires: (%{_cross_os}image-feature(fips) and %{name}) | ||
Conflicts: (%{_cross_os}image-feature(no-fips) or %{name}-bin) | ||
|
||
%description fips-bin | ||
%{summary}. | ||
|
||
%prep | ||
%autosetup -n %{gorepo}-%{version} -p1 | ||
|
||
%build | ||
export GO_MAJOR="1.22" | ||
|
||
%set_cross_go_flags | ||
|
||
go build -ldflags "${GOLDFLAGS}" -o aws-otel-collector ./cmd/awscollector | ||
gofips build -ldflags "${GOLDFLAGS}" -o fips/aws-otel-collector ./cmd/awscollector | ||
|
||
%install | ||
install -D -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir}/aws-otel-collector.service | ||
|
||
install -d %{buildroot}%{_cross_tmpfilesdir} | ||
install -p -m 0644 %{S:2} %{buildroot}%{_cross_tmpfilesdir} | ||
|
||
install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir} | ||
install -p -m 0644 %{S:3} %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir} | ||
|
||
install -d %{buildroot}{%{_cross_bindir},%{_cross_fips_bindir}} | ||
install -p -m 0755 aws-otel-collector %{buildroot}%{_cross_bindir} | ||
install -p -m 0755 fips/aws-otel-collector %{buildroot}%{_cross_fips_bindir} | ||
|
||
%files | ||
%{_cross_attribution_file} | ||
%{_cross_unitdir}/aws-otel-collector.service | ||
%{_cross_tmpfilesdir}/aws-otel-collector-tmpfiles.conf | ||
%{_cross_factorydir}%{_cross_sysconfdir}/aws-otel-collector.yaml | ||
|
||
%files bin | ||
%{_cross_bindir}/aws-otel-collector | ||
|
||
%files fips-bin | ||
%{_cross_fips_bindir}/aws-otel-collector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 127.0.0.1:4317 | ||
|
||
processors: | ||
batch/traces: | ||
batch/metrics: | ||
|
||
exporters: | ||
otlp: | ||
endpoint: 127.0.0.1:4318 | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch/traces] | ||
exporters: [otlp] | ||
metrics: | ||
receivers: [otlp] | ||
processors: [batch/metrics] | ||
exporters: [otlp] |