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
This commit is contained in:
Dirk Stoecker 2024-05-14 13:25:06 +00:00 committed by Git OBS Bridge
commit 6995d588b3
12 changed files with 243 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

29
Makefile Normal file
View File

@ -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

15
PACKAGING_README.md Normal file
View File

@ -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`.

21
_service Normal file
View File

@ -0,0 +1,21 @@
<services>
<service name="obs_scm" mode="manual">
<param name="url">https://github.com/grafana/alloy</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="revision">v1.0.0</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="changesgenerate">enable</param>
<param name="versionrewrite-pattern">v(.*)</param>
</service>
<service name="set_version" mode="manual">
</service>
<service name="tar" mode="buildtime">
</service>
<service name="recompress" mode="buildtime">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="go_modules" mode="manual">
</service>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/grafana/alloy</param>
<param name="changesrevision">1eef9b3ae92cb806181dc6ad39a660864f778764</param></service></servicedata>

3
alloy-1.0.0.obscpio Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:16686139cbf0aa7a7e2555a5ed92653dd06f83d40b6359cd17e8cd3df963ed2c
size 29902861

5
alloy.changes Normal file
View File

@ -0,0 +1,5 @@
-------------------------------------------------------------------
Tue Apr 16 18:00:05 UTC 2024 - Johannes Kastl <opensuse_buildservice@ojkastl.de>
- new package alloy: OpenTelemetry Collector distribution with
programmable pipelines

4
alloy.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: alloy
version: 1.0.0
mtime: 1712346539
commit: 1eef9b3ae92cb806181dc6ad39a660864f778764

132
alloy.spec Normal file
View File

@ -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

3
ui-1.0.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a9325b0e24475d441f2aca6987a3ace02b88066ab187d9e7ecd36ed01b690a0d
size 57514307

3
vendor.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a1b7b32a48999a676324a04007076ad18c60b1f6fea1f34a11029cf98fac605
size 42621236