commit 6995d588b3093f1411f894fb794f5d3cd2e3e5efb3e3abc321036592605c1476 Author: Dirk Stoecker Date: Tue May 14 13:25:06 2024 +0000 Accepting request 1168522 from home:ojkastl_buildservice:Branch_server_monitoring new package alloy: OpenTelemetry Collector distribution with programmable pipelines (now including the UI) OBS-URL: https://build.opensuse.org/request/show/1168522 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/alloy?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f42c48f --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +NAME = alloy +SPEC = alloy.spec + +default: clean tar + +clean: + rm -rf $(NAME) $(NAME)-*.obscpio $(NAME)-*.tar.gz ui-*.tar.gz vendor.tar.gz + +tar: + osc service manualrun + @version=$$( awk '/^Version:/ {print $$2;exit;}' $(SPEC) ) && \ + echo "Package version is $$version" && \ + basename=$(NAME)-$$version && \ + obscpio=$$basename.obscpio && \ + ui=ui-$$version.tar && \ + wd=$$(pwd) && \ + tmpdir=$$(mktemp -d -p /tmp) && \ + cd $$tmpdir && \ + cpio -idv < $$wd/$$obscpio && \ + cd $$basename && \ + cd internal/web/ui/ && \ + yarn --network-timeout=1200000 && \ + yarn run build && \ + cd .. && \ + echo "Creating web assets tarball" && \ + tar -cf $$wd/$$ui ui/ && \ + cd $$wd && \ + gzip -f $$ui && \ + rm -rf $$tmpdir diff --git a/PACKAGING_README.md b/PACKAGING_README.md new file mode 100644 index 0000000..d44f7f5 --- /dev/null +++ b/PACKAGING_README.md @@ -0,0 +1,15 @@ +# Packaging Grafana Alloy + +In addition to the source code in the tarball, this package also +needs the assets for the web UI. These can be generated by the +`Makefile` that is present in this package. +To do that, you need to have `make` and `yarn` installed locally. + +1. Change the version in the `_service` file +2. Change the version in the spec file +3. Run `make` +4. Create a changelog entry +5. Commit the changes as usual + +For the OBS workflow you also need `obs-service-go_modules` as well +as `obs-service-tar_scm` and `obs-service-recompress`. diff --git a/_service b/_service new file mode 100644 index 0000000..bb99c26 --- /dev/null +++ b/_service @@ -0,0 +1,21 @@ + + + https://github.com/grafana/alloy + git + .git + v1.0.0 + @PARENT_TAG@ + enable + v(.*) + + + + + + + *.tar + gz + + + + diff --git a/_servicedata b/_servicedata new file mode 100644 index 0000000..a9a3707 --- /dev/null +++ b/_servicedata @@ -0,0 +1,4 @@ + + + https://github.com/grafana/alloy + 1eef9b3ae92cb806181dc6ad39a660864f778764 \ No newline at end of file diff --git a/alloy-1.0.0.obscpio b/alloy-1.0.0.obscpio new file mode 100644 index 0000000..4f0b49a --- /dev/null +++ b/alloy-1.0.0.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16686139cbf0aa7a7e2555a5ed92653dd06f83d40b6359cd17e8cd3df963ed2c +size 29902861 diff --git a/alloy.changes b/alloy.changes new file mode 100644 index 0000000..b2408c2 --- /dev/null +++ b/alloy.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Apr 16 18:00:05 UTC 2024 - Johannes Kastl + +- new package alloy: OpenTelemetry Collector distribution with + programmable pipelines diff --git a/alloy.obsinfo b/alloy.obsinfo new file mode 100644 index 0000000..40255b3 --- /dev/null +++ b/alloy.obsinfo @@ -0,0 +1,4 @@ +name: alloy +version: 1.0.0 +mtime: 1712346539 +commit: 1eef9b3ae92cb806181dc6ad39a660864f778764 diff --git a/alloy.spec b/alloy.spec new file mode 100644 index 0000000..fcf0253 --- /dev/null +++ b/alloy.spec @@ -0,0 +1,132 @@ +# +# spec file for package alloy +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define __arch_install_post export NO_BRP_STRIP_DEBUG=true + +Name: alloy +Version: 1.0.0 +Release: 0 +Summary: OpenTelemetry Collector distribution with programmable pipelines +License: Apache-2.0 +URL: https://github.com/grafana/alloy +Source0: %{name}-%{version}.tar.gz +Source1: vendor.tar.gz +Source2: ui-%{version}.tar.gz +BuildRequires: go >= 1.22 +BuildRequires: systemd-devel +BuildRequires: user(alloy) +# Require the system user and group +Requires(pre): user(alloy) +Requires(pre): group(alloy) +# for the sysconfig file +Requires(post): %fillup_prereq + +%description +Grafana Alloy is an open source OpenTelemetry Collector distribution with +built-in Prometheus pipelines and support for metrics, logs, traces, and +profiles. + +What can Alloy do? +* Programmable pipelines: Use a rich expression-based syntax for configuring + powerful observability pipelines. +* OpenTelemetry Collector Distribution: Alloy is a distribution of + OpenTelemetry Collector and supports dozens of its components, alongside new + components that make use of Alloy's programmable pipelines. +* Big tent: Alloy embraces Grafana's "big tent" philosophy, where Alloy can be + used with other vendors or open source databases. It has components to + perfectly integrate with multiple telemetry ecosystems: + - OpenTelemetry Collector + - Prometheus + - Grafana Loki + - Grafana Pyroscope +* Kubernetes-native: Use components to interact with native and custom + Kubernetes resources; no need to learn how to use a separate Kubernetes + operator. +* Shareable pipelines: Use modules to share your pipelines with the world. +* Automatic workload distribution: Configure Alloy instances to form a cluster + for automatic workload distribution. +* Centralized configuration support: Alloy supports retrieving its + configuration from a server for centralized configuration management. +* Debugging utilities: Use the built-in UI for visualizing and debugging + pipelines. + +%prep +%autosetup -p 1 -a 1 +pwd +cd internal/web/ +tar xzf %{SOURCE2} +cd ../../ + +%build +# hash will be shortended by COMMIT_HASH:0:8 later +COMMIT_HASH="$(sed -n 's/commit: \(.*\)/\1/p' %_sourcedir/alloy.obsinfo)" + +DATE_FMT="+%%Y-%%m-%%dT%%H:%%M:%%SZ" +BUILD_DATE=$(date -u -d "@${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "${DATE_FMT}" 2>/dev/null || date -u "${DATE_FMT}") +go build \ + -mod=vendor \ + -buildmode=pie \ + -ldflags=" \ + -X github.com/grafana/alloy/internal/build.Revision=${COMMIT_HASH:0:8} \ + -X github.com/grafana/alloy/internal/build.Branch=HEAD \ + -X github.com/grafana/alloy/internal/build.Version=v%{version} \ + -X github.com/grafana/alloy/internal/build.BuildUser=geeko@obs \ + -X github.com/grafana/alloy/internal/build.BuildDate=${BUILD_DATE}" \ + -tags "builtinassets promtail_journal_enabled" \ + -o bin/%{name} . + +%install +# Install the binary. +install -D -m 0755 bin/%{name} %{buildroot}/%{_bindir}/%{name} + +# systemd unit +install -D -m 0644 packaging/rpm/%{name}.service %{buildroot}/%{_unitdir}/%{name}.service + +# configuration directory +install -d -m 0755 %{buildroot}/%{_sysconfdir}/%{name} + +# sysconfig file +install -D -m 0644 packaging/environment-file %{buildroot}%{_fillupdir}/sysconfig.alloy + +# working directory +install -d -m 0770 %{buildroot}/%{_sharedstatedir}/%{name} +install -d -m 0770 %{buildroot}/%{_sharedstatedir}/%{name}/data/ + +%pre +%service_add_pre %{name}.service + +%post +%fillup_only +%service_add_post %{name}.service + +%preun +%service_del_preun %{name}.service + +%postun +%service_del_postun %{name}.service + +%files +%doc README.md packaging/config.alloy +%license LICENSE +%{_bindir}/%{name} +%{_unitdir}/%{name}.service +%dir %attr(770,root,alloy) %config %{_sysconfdir}/%{name} +%dir %attr(770,alloy,alloy) %{_sharedstatedir}/%{name} +%{_fillupdir}/sysconfig.alloy + +%changelog diff --git a/ui-1.0.0.tar.gz b/ui-1.0.0.tar.gz new file mode 100644 index 0000000..5618315 --- /dev/null +++ b/ui-1.0.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9325b0e24475d441f2aca6987a3ace02b88066ab187d9e7ecd36ed01b690a0d +size 57514307 diff --git a/vendor.tar.gz b/vendor.tar.gz new file mode 100644 index 0000000..f49ed34 --- /dev/null +++ b/vendor.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a1b7b32a48999a676324a04007076ad18c60b1f6fea1f34a11029cf98fac605 +size 42621236