Overview

Request 1150280 new

This is a replacement for golang-github-justwatchcom-elasticsearch_exporter.
It is the same application, but the sourced moved to a new location on GitHub, and
updating the old and broken package containing an obsolete organization in its name
did not make sense.
One additional change is the use of a dedicated system user in order to not allow
different Prometheus components on a machine to interfere with each other.
There is one "bug" when upgrading the package on machines with existing
golang-github-justwatchcom-elasticsearch_exporter installations - the service is
disabled during the upgrade (likely during the uninstall of the obsoleted package),
and needs to be manually re-enabled/started by the administrator.
Since this is just hosted in a devel project, I think it is not a big issue, but
happy to hear about better ideas.


Georg Pfuetzenreuter's avatar

One more change I forgot to mention: ExecReload was dropped, the application hot-reloads certificates when they change on disk without the need for sending a signal.


Witek Bedyk's avatar

The exporter uses promu for building. Let's leverage it here as well. Please compare e.g. https://build.opensuse.org/package/show/server:monitoring/golang-github-prometheus-prometheus


Georg Pfuetzenreuter's avatar

Hi, building this with promu build results in:

[   35s] prometheus-elasticsearch_exporter.x86_64: W: position-independent-executable-suggested /usr/bin/elasticsearch_exporter
[   35s] This executable should be position independent (all binaries should).  Check
[   35s] that it is built with -fPIE/-fpie in compiler flags and -pie in linker flags.
[   35s] 
[   35s] prometheus-elasticsearch_exporter.x86_64: W: statically-linked-binary /usr/bin/elasticsearch_exporter
[   35s] The package installs a statically linked binary or object file.  Usually this
[   35s] is a packaging bug. If not, contact your rpmlint distributor about this so
[   35s] that this error gets included in the exception file for rpmlint and will not
[   35s] be flagged as a packaging bug in the future (or add it to your local
[   35s] configuration if you installed rpmlint from the source tarball).

Using -v it seems to invoke go build without the needed arguments, which I pass in my custom go build call:

[   10s] Building binary: elasticsearch_exporter
[   10s]  >   elasticsearch_exporter
[   10s] Building binary: go build -o elasticsearch_exporter -ldflags -s -X github.com/prometheus/common/version.Version=1.7.0 -X github.com/prometheus/common/version.Revision=non-git -X github.com/prometheus/common/version.Branch=non-git -X github.com/prometheus/common/version.BuildUser=reproducible@reproducible -X github.com/prometheus/common/version.BuildDate=20240225-12:00:00  -extldflags '-static' github.com/prometheus-community/elasticsearch_exporter
[   10s]  +  go build -o elasticsearch_exporter -ldflags -s -X github.com/prometheus/common/version.Version=1.7.0 -X github.com/prometheus/common/version.Revision=non-git -X github.com/prometheus/common/version.Branch=non-git -X github.com/prometheus/common/version.BuildUser=reproducible@reproducible -X github.com/prometheus/common/version.BuildDate=20240225-12:00:00  -extldflags '-static' github.com/prometheus-community/elasticsearch_exporter

Witek Bedyk's avatar

I think most of the used custom build options are not recommended anymore. Please compare this request:

https://build.opensuse.org/request/show/1145684

Building with promu has the advantage of setting the right BuildDate and BuildUser for reproducible builds.


Georg Pfuetzenreuter's avatar

Reproducible builds can be achieved using settings in the project configuration:

https://en.opensuse.org/index.php?title=openSUSE:Reproducible_Builds#With_OBS

Why are the custom options not recommended?

Other openSUSE packagers faced the issue with building PIE using promu as well, and upstream suggests patching flags.yaml:

https://github.com/prometheus/promu/issues/158

This sounds like unnecessary overhead, given promu just being a wrapper around go build, the latter of which I can invoke directly with the needed arguments.

I understand the desire to use a common build tool, but it does in my opinion not help using wrappers which merely make it more complicated.


Request History
Georg Pfuetzenreuter's avatar

crameleon created request

This is a replacement for golang-github-justwatchcom-elasticsearch_exporter.
It is the same application, but the sourced moved to a new location on GitHub, and
updating the old and broken package containing an obsolete organization in its name
did not make sense.
One additional change is the use of a dedicated system user in order to not allow
different Prometheus components on a machine to interfere with each other.
There is one "bug" when upgrading the package on machines with existing
golang-github-justwatchcom-elasticsearch_exporter installations - the service is
disabled during the upgrade (likely during the uninstall of the obsoleted package),
and needs to be manually re-enabled/started by the administrator.
Since this is just hosted in a devel project, I think it is not a big issue, but
happy to hear about better ideas.

openSUSE Build Service is sponsored by