1
0
Dominique Leuenberger 2022-01-27 22:16:19 +00:00 committed by Git OBS Bridge
commit 5aaab03a39
8 changed files with 278 additions and 552 deletions

View File

@ -1,7 +1,7 @@
From f858a01d7d9ca8c28be8a9d6251e6dd7f0717272 Mon Sep 17 00:00:00 2001
From ec4f910efa917a19d9501630a695d07664d015ad Mon Sep 17 00:00:00 2001
From: Jan Fajerski <jfajerski@suse.com>
Date: Fri, 8 Feb 2019 09:28:12 +0100
Subject: [PATCH 2/3] Default settings
Subject: [PATCH] Default settings
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
---
@ -9,10 +9,10 @@ Signed-off-by: Jan Fajerski <jfajerski@suse.com>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go
index 9fbd6e76b..6283c4057 100644
index 14c738d67..6bc56d933 100644
--- a/cmd/prometheus/main.go
+++ b/cmd/prometheus/main.go
@@ -191,7 +191,7 @@ func main() {
@@ -232,7 +232,7 @@ func main() {
a.HelpFlag.Short('h')
a.Flag("config.file", "Prometheus configuration file path.").
@ -21,7 +21,7 @@ index 9fbd6e76b..6283c4057 100644
a.Flag("web.listen-address", "Address to listen on for UI, API, and telemetry.").
Default("0.0.0.0:9090").StringVar(&cfg.web.ListenAddress)
@@ -223,10 +223,10 @@ func main() {
@@ -264,10 +264,10 @@ func main() {
Default("false").BoolVar(&cfg.web.EnableAdminAPI)
a.Flag("web.console.templates", "Path to the console template directory, available at /consoles.").
@ -34,14 +34,14 @@ index 9fbd6e76b..6283c4057 100644
a.Flag("web.page-title", "Document title of Prometheus instance.").
Default("Prometheus Time Series Collection and Processing Server").StringVar(&cfg.web.PageTitle)
@@ -235,7 +235,7 @@ func main() {
@@ -276,7 +276,7 @@ func main() {
Default(".*").StringVar(&cfg.corsRegexString)
a.Flag("storage.tsdb.path", "Base path for metrics storage.").
- Default("data/").StringVar(&cfg.localStoragePath)
+ Default("/var/lib/prometheus/metrics/").StringVar(&cfg.localStoragePath)
serverOnlyFlag(a, "storage.tsdb.path", "Base path for metrics storage.").
- Default("data/").StringVar(&cfg.serverStoragePath)
+ Default("/var/lib/prometheus/metrics/").StringVar(&cfg.serverStoragePath)
a.Flag("storage.tsdb.min-block-duration", "Minimum duration of a data block before being persisted. For use in testing.").
serverOnlyFlag(a, "storage.tsdb.min-block-duration", "Minimum duration of a data block before being persisted. For use in testing.").
Hidden().Default("2h").SetValue(&cfg.tsdb.MinBlockDuration)
--
2.31.1

View File

@ -1,530 +0,0 @@
From 239bb9d32cb40409c8f2085700e85033f8642670 Mon Sep 17 00:00:00 2001
From: Joao Cavalheiro <jcavalheiro@suse.de>
Date: Mon, 27 Jul 2020 17:42:33 +0200
Subject: [PATCH 3/3] Add Uyuni service discovery
---
discovery/install/install.go | 1 +
discovery/uyuni/uyuni.go | 411 ++++++++++++++++++++++++++++++++++
discovery/uyuni/uyuni_test.go | 46 ++++
go.mod | 3 +-
go.sum | 2 +
5 files changed, 462 insertions(+), 1 deletion(-)
create mode 100644 discovery/uyuni/uyuni.go
create mode 100644 discovery/uyuni/uyuni_test.go
diff --git a/discovery/install/install.go b/discovery/install/install.go
index 3e6f0f388..484d48db8 100644
--- a/discovery/install/install.go
+++ b/discovery/install/install.go
@@ -31,5 +31,6 @@ import (
_ "github.com/prometheus/prometheus/discovery/openstack" // register openstack
_ "github.com/prometheus/prometheus/discovery/scaleway" // register scaleway
_ "github.com/prometheus/prometheus/discovery/triton" // register triton
+ _ "github.com/prometheus/prometheus/discovery/uyuni" // register uyuni
_ "github.com/prometheus/prometheus/discovery/zookeeper" // register zookeeper
)
diff --git a/discovery/uyuni/uyuni.go b/discovery/uyuni/uyuni.go
new file mode 100644
index 000000000..8163a3bf0
--- /dev/null
+++ b/discovery/uyuni/uyuni.go
@@ -0,0 +1,411 @@
+// Copyright 2019 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package uyuni
+
+import (
+ "context"
+ "fmt"
+ "net"
+ "net/url"
+ "regexp"
+ "strings"
+ "time"
+
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/kolo/xmlrpc"
+ "github.com/pkg/errors"
+ "github.com/prometheus/common/model"
+
+ "github.com/prometheus/prometheus/discovery"
+ "github.com/prometheus/prometheus/discovery/refresh"
+ "github.com/prometheus/prometheus/discovery/targetgroup"
+)
+
+const (
+ monitoringEntitlementLabel = "monitoring_entitled"
+ prometheusExporterFormulaName = "prometheus-exporters"
+ uyuniXMLRPCAPIPath = "/rpc/api"
+)
+
+// DefaultSDConfig is the default Uyuni SD configuration.
+var DefaultSDConfig = SDConfig{
+ RefreshInterval: model.Duration(1 * time.Minute),
+}
+
+// Regular expression to extract port from formula data
+var monFormulaRegex = regexp.MustCompile(`--(?:telemetry\.address|web\.listen-address)=\":([0-9]*)\"`)
+
+func init() {
+ discovery.RegisterConfig(&SDConfig{})
+}
+
+// SDConfig is the configuration for Uyuni based service discovery.
+type SDConfig struct {
+ Host string `yaml:"host"`
+ User string `yaml:"username"`
+ Pass string `yaml:"password"`
+ RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
+}
+
+// Uyuni API Response structures
+type systemGroupID struct {
+ GroupID int `xmlrpc:"id"`
+ GroupName string `xmlrpc:"name"`
+}
+
+type networkInfo struct {
+ SystemID int `xmlrpc:"system_id"`
+ Hostname string `xmlrpc:"hostname"`
+ PrimaryFQDN string `xmlrpc:"primary_fqdn"`
+ IP string `xmlrpc:"ip"`
+}
+
+type tlsConfig struct {
+ Enabled bool `xmlrpc:"enabled"`
+}
+
+type exporterConfig struct {
+ Address string `xmlrpc:"address"`
+ Args string `xmlrpc:"args"`
+ Enabled bool `xmlrpc:"enabled"`
+}
+
+type proxiedExporterConfig struct {
+ ProxyIsEnabled bool `xmlrpc:"proxy_enabled"`
+ ProxyPort float32 `xmlrpc:"proxy_port"`
+ TLSConfig tlsConfig `xmlrpc:"tls"`
+ ExporterConfigs map[string]exporterConfig `xmlrpc:"exporters"`
+}
+
+// Discovery periodically performs Uyuni API requests. It implements the Discoverer interface.
+type Discovery struct {
+ *refresh.Discovery
+ interval time.Duration
+ sdConfig *SDConfig
+ logger log.Logger
+}
+
+// Name returns the name of the Config.
+func (*SDConfig) Name() string { return "uyuni" }
+
+// NewDiscoverer returns a Discoverer for the Config.
+func (c *SDConfig) NewDiscoverer(opts discovery.DiscovererOptions) (discovery.Discoverer, error) {
+ return NewDiscovery(c, opts.Logger), nil
+}
+
+// UnmarshalYAML implements the yaml.Unmarshaler interface.
+func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
+ *c = DefaultSDConfig
+ type plain SDConfig
+ err := unmarshal((*plain)(c))
+
+ if err != nil {
+ return err
+ }
+ if c.Host == "" {
+ return errors.New("Uyuni SD configuration requires a Host")
+ }
+ if c.User == "" {
+ return errors.New("Uyuni SD configuration requires a Username")
+ }
+ if c.Pass == "" {
+ return errors.New("Uyuni SD configuration requires a Password")
+ }
+ if c.RefreshInterval <= 0 {
+ return errors.New("Uyuni SD configuration requires RefreshInterval to be a positive integer")
+ }
+ return nil
+}
+
+// Attempt to login in Uyuni Server and get an auth token
+func login(rpcclient *xmlrpc.Client, user string, pass string) (string, error) {
+ var result string
+ err := rpcclient.Call("auth.login", []interface{}{user, pass}, &result)
+ return result, err
+}
+
+// Logout from Uyuni API
+func logout(rpcclient *xmlrpc.Client, token string) error {
+ err := rpcclient.Call("auth.logout", token, nil)
+ return err
+}
+
+// Get the system groups information of monitored clients
+func getSystemGroupsInfoOfMonitoredClients(rpcclient *xmlrpc.Client, token string) (map[int][]systemGroupID, error) {
+ var systemGroupsInfos []struct {
+ SystemID int `xmlrpc:"id"`
+ SystemGroups []systemGroupID `xmlrpc:"system_groups"`
+ }
+ err := rpcclient.Call("system.listSystemGroupsForSystemsWithEntitlement", []interface{}{token, monitoringEntitlementLabel}, &systemGroupsInfos)
+ if err != nil {
+ return nil, err
+ }
+ result := make(map[int][]systemGroupID)
+ for _, systemGroupsInfo := range systemGroupsInfos {
+ result[systemGroupsInfo.SystemID] = systemGroupsInfo.SystemGroups
+ }
+ return result, nil
+}
+
+// GetSystemNetworkInfo lists client FQDNs
+func getNetworkInformationForSystems(rpcclient *xmlrpc.Client, token string, systemIDs []int) (map[int]networkInfo, error) {
+ var networkInfos []networkInfo
+ err := rpcclient.Call("system.getNetworkForSystems", []interface{}{token, systemIDs}, &networkInfos)
+ if err != nil {
+ return nil, err
+ }
+ result := make(map[int]networkInfo)
+ for _, networkInfo := range networkInfos {
+ result[networkInfo.SystemID] = networkInfo
+ }
+ return result, nil
+}
+
+// Get formula data for a given system
+func getExporterDataForSystems(
+ rpcclient *xmlrpc.Client,
+ token string,
+ systemIDs []int,
+) (map[int]proxiedExporterConfig, error) {
+ var combinedFormulaData []struct {
+ SystemID int `xmlrpc:"system_id"`
+ ExporterConfigs proxiedExporterConfig `xmlrpc:"formula_values"`
+ }
+ err := rpcclient.Call(
+ "formula.getCombinedFormulaDataByServerIds",
+ []interface{}{token, prometheusExporterFormulaName, systemIDs},
+ &combinedFormulaData)
+ if err != nil {
+ return nil, err
+ }
+ result := make(map[int]proxiedExporterConfig)
+ for _, combinedFormulaData := range combinedFormulaData {
+ result[combinedFormulaData.SystemID] = combinedFormulaData.ExporterConfigs
+ }
+ return result, nil
+}
+
+// extractPortFromFormulaData gets exporter port configuration from the formula.
+// args takes precedence over address.
+func extractPortFromFormulaData(args string, address string) (string, error) {
+ // first try args
+ var port string
+ tokens := monFormulaRegex.FindStringSubmatch(args)
+ if len(tokens) < 1 {
+ err := "Unable to find port in args: " + args
+ // now try address
+ _, addrPort, addrErr := net.SplitHostPort(address)
+ if addrErr != nil || len(addrPort) == 0 {
+ if addrErr != nil {
+ err = strings.Join([]string{addrErr.Error(), err}, " ")
+ }
+ return "", errors.New(err)
+ }
+ port = addrPort
+ } else {
+ port = tokens[1]
+ }
+
+ return port, nil
+}
+
+// NewDiscovery returns a new file discovery for the given paths.
+func NewDiscovery(conf *SDConfig, logger log.Logger) *Discovery {
+ d := &Discovery{
+ interval: time.Duration(conf.RefreshInterval),
+ sdConfig: conf,
+ logger: logger,
+ }
+ d.Discovery = refresh.NewDiscovery(
+ logger,
+ "uyuni",
+ time.Duration(conf.RefreshInterval),
+ d.refresh,
+ )
+ return d
+}
+
+func initializeExporterTargets(
+ targets *[]model.LabelSet,
+ exporterName string, config exporterConfig,
+ proxyPort string,
+ errors *[]error,
+) {
+ if !(config.Enabled) {
+ return
+ }
+ var port string
+ if len(proxyPort) == 0 {
+ exporterPort, err := extractPortFromFormulaData(config.Args, config.Address)
+ if err != nil {
+ *errors = append(*errors, err)
+ return
+ }
+ port = exporterPort
+ } else {
+ port = proxyPort
+ }
+
+ labels := model.LabelSet{}
+ labels["exporter"] = model.LabelValue(exporterName)
+ // for now set only port number here
+ labels[model.AddressLabel] = model.LabelValue(port)
+ if len(proxyPort) > 0 {
+ labels[model.ParamLabelPrefix+"module"] = model.LabelValue(exporterName)
+ }
+ *targets = append(*targets, labels)
+}
+
+func (d *Discovery) getTargetsForSystem(
+ systemID int,
+ systemGroupsIDs []systemGroupID,
+ networkInfo networkInfo,
+ combinedFormulaData proxiedExporterConfig,
+) []model.LabelSet {
+
+ var labelSets []model.LabelSet
+ var errors []error
+ var proxyPortNumber string
+ var hostname string
+ if combinedFormulaData.ProxyIsEnabled {
+ proxyPortNumber = fmt.Sprintf("%d", int(combinedFormulaData.ProxyPort))
+ }
+ if len(networkInfo.PrimaryFQDN) > 0 {
+ hostname = networkInfo.PrimaryFQDN
+ } else {
+ hostname = networkInfo.Hostname
+ }
+ for exporterName, formulaValues := range combinedFormulaData.ExporterConfigs {
+ initializeExporterTargets(&labelSets, exporterName, formulaValues, proxyPortNumber, &errors)
+ }
+ managedGroupNames := getSystemGroupNames(systemGroupsIDs)
+ for _, labels := range labelSets {
+ // add hostname to the address label
+ addr := fmt.Sprintf("%s:%s", hostname, labels[model.AddressLabel])
+ labels[model.AddressLabel] = model.LabelValue(addr)
+ labels["hostname"] = model.LabelValue(hostname)
+ labels["groups"] = model.LabelValue(strings.Join(managedGroupNames, ","))
+ if combinedFormulaData.ProxyIsEnabled {
+ labels[model.MetricsPathLabel] = "/proxy"
+ }
+ if combinedFormulaData.TLSConfig.Enabled {
+ labels[model.SchemeLabel] = "https"
+ }
+ _ = level.Debug(d.logger).Log("msg", "Configured target", "Labels", fmt.Sprintf("%+v", labels))
+ }
+ for _, err := range errors {
+ level.Error(d.logger).Log("msg", "Invalid exporter port", "clientId", systemID, "err", err)
+ }
+
+ return labelSets
+}
+
+func getSystemGroupNames(systemGroupsIDs []systemGroupID) []string {
+ managedGroupNames := make([]string, 0, len(systemGroupsIDs))
+ for _, systemGroupInfo := range systemGroupsIDs {
+ managedGroupNames = append(managedGroupNames, systemGroupInfo.GroupName)
+ }
+
+ if len(managedGroupNames) == 0 {
+ managedGroupNames = []string{"No group"}
+ }
+ return managedGroupNames
+}
+
+func (d *Discovery) getTargetsForSystems(
+ rpcClient *xmlrpc.Client,
+ token string,
+ systemGroupIDsBySystemID map[int][]systemGroupID,
+) ([]model.LabelSet, error) {
+
+ result := make([]model.LabelSet, 0)
+
+ systemIDs := make([]int, 0, len(systemGroupIDsBySystemID))
+ for systemID := range systemGroupIDsBySystemID {
+ systemIDs = append(systemIDs, systemID)
+ }
+
+ combinedFormulaDataBySystemID, err := getExporterDataForSystems(rpcClient, token, systemIDs)
+ if err != nil {
+ return nil, errors.Wrap(err, "Unable to get systems combined formula data")
+ }
+ networkInfoBySystemID, err := getNetworkInformationForSystems(rpcClient, token, systemIDs)
+ if err != nil {
+ return nil, errors.Wrap(err, "Unable to get the systems network information")
+ }
+
+ for _, systemID := range systemIDs {
+ targets := d.getTargetsForSystem(
+ systemID,
+ systemGroupIDsBySystemID[systemID],
+ networkInfoBySystemID[systemID],
+ combinedFormulaDataBySystemID[systemID])
+ result = append(result, targets...)
+
+ // Log debug information
+ if networkInfoBySystemID[systemID].IP != "" {
+ level.Debug(d.logger).Log("msg", "Found monitored system",
+ "PrimaryFQDN", networkInfoBySystemID[systemID].PrimaryFQDN,
+ "Hostname", networkInfoBySystemID[systemID].Hostname,
+ "Network", fmt.Sprintf("%+v", networkInfoBySystemID[systemID]),
+ "Groups", fmt.Sprintf("%+v", systemGroupIDsBySystemID[systemID]),
+ "Formulas", fmt.Sprintf("%+v", combinedFormulaDataBySystemID[systemID]))
+ }
+ }
+ return result, nil
+}
+
+func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
+ config := d.sdConfig
+ apiURL := config.Host + uyuniXMLRPCAPIPath
+
+ startTime := time.Now()
+
+ // Check if the URL is valid and create rpc client
+ _, err := url.ParseRequestURI(apiURL)
+ if err != nil {
+ return nil, errors.Wrap(err, "Uyuni Server URL is not valid")
+ }
+
+ rpcClient, _ := xmlrpc.NewClient(apiURL, nil)
+
+ token, err := login(rpcClient, config.User, config.Pass)
+ if err != nil {
+ return nil, errors.Wrap(err, "Unable to login to Uyuni API")
+ }
+ systemGroupIDsBySystemID, err := getSystemGroupsInfoOfMonitoredClients(rpcClient, token)
+ if err != nil {
+ return nil, errors.Wrap(err, "Unable to get the managed system groups information of monitored clients")
+ }
+
+ targets := make([]model.LabelSet, 0)
+ if len(systemGroupIDsBySystemID) > 0 {
+ targetsForSystems, err := d.getTargetsForSystems(rpcClient, token, systemGroupIDsBySystemID)
+ if err != nil {
+ return nil, err
+ }
+ targets = append(targets, targetsForSystems...)
+ level.Info(d.logger).Log("msg", "Total discovery time", "time", time.Since(startTime))
+ } else {
+ fmt.Printf("\tFound 0 systems.\n")
+ }
+
+ err = logout(rpcClient, token)
+ if err != nil {
+ level.Warn(d.logger).Log("msg", "Failed to log out from Uyuni API", "err", err)
+ }
+ rpcClient.Close()
+ return []*targetgroup.Group{&targetgroup.Group{Targets: targets, Source: config.Host}}, nil
+}
diff --git a/discovery/uyuni/uyuni_test.go b/discovery/uyuni/uyuni_test.go
new file mode 100644
index 000000000..c5fa8cc9e
--- /dev/null
+++ b/discovery/uyuni/uyuni_test.go
@@ -0,0 +1,46 @@
+// Copyright 2019 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package uyuni
+
+import "testing"
+
+func TestExtractPortFromFormulaData(t *testing.T) {
+ type args struct {
+ args string
+ address string
+ }
+ tests := []struct {
+ name string
+ args args
+ want string
+ wantErr bool
+ }{
+ {name: `TestArgs`, args: args{args: `--web.listen-address=":9100"`}, want: `9100`},
+ {name: `TestAddress`, args: args{address: `:9100`}, want: `9100`},
+ {name: `TestArgsAndAddress`, args: args{args: `--web.listen-address=":9100"`, address: `9999`}, want: `9100`},
+ {name: `TestMissingPort`, args: args{args: `localhost`}, wantErr: true},
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := extractPortFromFormulaData(tt.args.args, tt.args.address)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("extractPortFromFormulaData() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if got != tt.want {
+ t.Errorf("extractPortFromFormulaData() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
diff --git a/go.mod b/go.mod
index dd22c9be7..b283af28a 100644
--- a/go.mod
+++ b/go.mod
@@ -34,6 +34,7 @@ require (
github.com/hetznercloud/hcloud-go v1.25.0
github.com/influxdata/influxdb v1.8.5
github.com/json-iterator/go v1.1.11
+ github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b
github.com/miekg/dns v1.1.41
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/morikuni/aec v1.0.0 // indirect
@@ -110,4 +111,4 @@ exclude (
k8s.io/client-go v8.0.0+incompatible
k8s.io/client-go v9.0.0+incompatible
k8s.io/client-go v9.0.0-invalid+incompatible
-)
+)
\ No newline at end of file
diff --git a/go.sum b/go.sum
index 03a0abd29..e2fff275e 100644
--- a/go.sum
+++ b/go.sum
@@ -556,6 +556,8 @@ github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg=
github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
+github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b h1:iNjcivnc6lhbvJA3LD622NPrUponluJrBWPIwGG/3Bg=
+github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
--
2.31.1

View File

@ -4,7 +4,7 @@
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="revision">v2.27.1</param>
<param name="revision">v2.32.1</param>
<param name="versionrewrite-pattern">v(.*)</param>
</service>
<service name="recompress" mode="disabled">
@ -14,4 +14,7 @@
<service name="set_version" mode="disabled">
<param name="basename">prometheus</param>
</service>
<service name="go_modules" mode="disabled">
<param name="archive">prometheus-2.32.1.tar.gz</param>
</service>
</services>

View File

@ -1,3 +1,259 @@
-------------------------------------------------------------------
Wed Jan 19 11:36:21 UTC 2022 - Witek Bedyk <witold.bedyk@suse.com>
- Updated patches:
+ Changed:
* 0002-Default-settings.patch
+ Removed:
* 0003-Add-Uyuni-service-discovery.patch
- Use obs-service-go_modules
- Upgrade to upstream version 2.32.1 (jsc#SLE-22863)
+ Bugfixes:
* Scrape: Fix reporting metrics when sample limit is reached
during the report. #9996
* Scrape: Ensure that scrape interval and scrape timeout are
always set. #10023
* TSDB: Expose and fix bug in iterators' Seek() method. #10030
- Upgrade to upstream version 2.32.0
+ Change:
* remote-write: Change default max retry time from 100ms to
5 seconds. #9634
+ Features:
* Agent: New mode of operation optimized for remote-write only
scenarios, without local storage.
* Promtool: Add promtool check service-discovery command. #8970
+ Enhancements:
* Promtool: Improve test output. #8064
* Promtool: Use kahan summation for better numerical stability.
* Remote-write: Reuse memory for marshalling. #9412
* Scrape: Add scrape_body_size_bytes scrape metric behind the
--enable-feature=extra-scrape-metrics flag. #9569
* TSDB: Add windows arm64 support. #9703
* TSDB: Optimize query by skipping unneeded sorting in TSDB.
* Templates: Support int and uint as datatypes for template
formatting. #9680
* UI: Prefer rate over rad, delta over deg, and count over cos
in autocomplete. #9688
+ Bugfixes:
* TSDB: Add more size checks when writing individual sections
in the index. #9710
* PromQL: Make deriv() return zero values for constant series.
* TSDB: Fix panic when checkpoint directory is empty. #9687
* TSDB: Fix panic, out of order chunks, and race warning during
WAL replay. #9856
* UI: Correctly render links for targets with IPv6 addresses
that contain a Zone ID. #9853
* Promtool: Fix checking of authorization.credentials_file and
bearer_token_file fields. #9883
* Uyuni SD: Fix null pointer exception during initialization.
* TSDB: Fix queries after a failed snapshot replay. #9980
- Upgrade to upstream version 2.31.1
+ Bugfix:
* SD: Fix a panic when the experimental discovery manager
receives targets during a reload. #9656
- Upgrade to upstream version 2.31.0
+ Change:
* UI: Remove standard PromQL editor in favour of the
codemirror-based editor. #9452
+ Features:
* PromQL: Add trigonometric functions and atan2 binary
operator. #9239 #9248 #9515
* Remote: Add support for exemplar in the remote write receiver
endpoint. #9319 #9414
* SD: Add PuppetDB service discovery. #8883
* SD: Add Uyuni service discovery. #8190
* Web: Add support for security-related HTTP headers. #9546
+ Enhancements:
* Azure SD: Add proxy_url, follow_redirects, tls_config. #9267
* Backfill: Add --max-block-duration in promtool
create-blocks-from rules. #9511
* Config: Print human-readable sizes with unit instead of raw
numbers. #9361
* HTTP: Re-enable HTTP/2. #9398
* Kubernetes SD: Warn user if number of endpoints exceeds
limit. #9467
* OAuth2: Add TLS configuration to token requests. #9550
* PromQL: Several optimizations. #9365 #9360 #9362 #9552
* PromQL: Make aggregations deterministic in instant queries.
* Rules: Add the ability to limit number of alerts or series.
* SD: Experimental discovery manager to avoid restarts upon
reload.
* UI: Debounce timerange setting changes. #9359
+ Bugfixes:
* Backfill: Apply rule labels after query labels. #9421
* Scrape: Resolve conflicts between multiple exported label
prefixes. #9479 #9518
* Scrape: Restart scrape loops when __scrape_interval__ is
changed. #9551
* TSDB: Fix memory leak in samples deletion. #9151
* UI: Use consistent margin-bottom for all alert kinds. #9318
- Upgrade to upstream version 2.30.3
+ Bugfixes:
* TSDB: Fix panic on failed snapshot replay. #9438
* TSDB: Don't fail snapshot replay with exemplar storage
disabled when the snapshot contains exemplars. #9438
- Upgrade to upstream version 2.30.2
+ Bugfix:
* TSDB: Don't error on overlapping m-mapped chunks during WAL
replay. #9381
- Upgrade to upstream version 2.30.1
+ Enhancements:
* Remote Write: Redact remote write URL when used for metric
label. #9383
* UI: Redact remote write URL and proxy URL passwords in the
/config page. #9408
+ Bugfixes:
* promtool rules backfill: Prevent creation of data before the
start time. #9339
* promtool rules backfill: Do not query after the end time.
* Azure SD: Fix panic when no computername is set. #9387
- Upgrade to upstream version 2.30.0
+ Features:
* experimental TSDB: Snapshot in-memory chunks on shutdown for
faster restarts. #7229
* experimental Scrape: Configure scrape interval and scrape
timeout via relabeling using __scrape_interval__ and
__scrape_timeout__ labels respectively. #8911
* Scrape: Add scrape_timeout_seconds and scrape_sample_limit
metric. #9247 #9295
+ Enhancements:
* Scrape: Add --scrape.timestamp-tolerance flag to adjust
scrape timestamp tolerance when enabled via
--scrape.adjust-timestamps. #9283
* Remote Write: Improve throughput when sending exemplars.
* TSDB: Optimise WAL loading by removing extra map and caching
min-time #9160
* promtool: Speed up checking for duplicate rules. #9262/#9306
* Scrape: Reduce allocations when parsing the metrics. #9299
* docker_sd: Support host network mode #9125
+ Bugfixes:
* Exemplars: Fix panic when resizing exemplar storage from 0 to
a non-zero size. #9286
* TSDB: Correctly decrement
prometheus_tsdb_head_active_appenders when the append has no
samples. #9230
* promtool rules backfill: Return 1 if backfill was
unsuccessful. #9303
* promtool rules backfill: Avoid creation of overlapping
blocks. #9324
* config: Fix a panic when reloading configuration with a null
relabel action. #9224
- Upgrade to upstream version 2.29.2
+ Bugfixes:
* Fix Kubernetes SD failing to discover Ingress in
Kubernetes v1.22. #9205
* Fix data race in loading write-ahead-log (WAL). #9259
- Upgrade to upstream version 2.29.1
+ Bugfixes:
* TSDB: align atomically accessed int64 to prevent panic in
32-bit archs. #9192
- Upgrade to upstream version 2.29.0
+ Changes:
* Promote --storage.tsdb.allow-overlapping-blocks flag to
stable. #9117
* Promote --storage.tsdb.retention.size flag to stable. #9004
+ Features:
* Add Kuma service discovery. #8844
* Add present_over_time PromQL function. #9097
* Allow configuring exemplar storage via file and make it
reloadable. #8974
* UI: Allow selecting time range with mouse drag. #8977
* promtool: Add feature flags flag --enable-feature. #8958
* promtool: Add file_sd file validation. #8950
+ Enhancements:
* Reduce blocking of outgoing remote write requests from series
garbage collection. #9109
* Improve write-ahead-log decoding performance. #9106
* Improve append performance in TSDB by reducing mutexes usage.
* Allow configuring max_samples_per_send for remote write
metadata. #8959
* Add __meta_gce_interface_ipv4_<name> meta label to GCE
discovery. #8978
* Add __meta_ec2_availability_zone_id meta label to EC2
discovery. #8896
* Add __meta_azure_machine_computer_name meta label to Azure
discovery. #9112
* Add __meta_hetzner_hcloud_labelpresent_<labelname> meta label
to Hetzner discovery. #9028
* promtool: Add compaction efficiency to promtool tsdb analyze
reports. #8940
* promtool: Allow configuring max block duration for
backfilling via --max-block-duration flag. #8919
* UI: Add sorting and filtering to flags page. #8988
* UI: Improve alerts page rendering performance. #9005
+ Bugfixes:
* Log when total symbol size exceeds 2^32 bytes, causing
compaction to fail, and skip compaction. #9104
* Fix incorrect target_limit reloading of zero value. #9120
* Fix head GC and pending readers race condition. #9081
* Fix timestamp handling in OpenMetrics parser. #9008
* Fix potential duplicate metrics in /federate endpoint when
specifying multiple matchers. #8885
* Fix server configuration and validation for authentication
via client cert. #9123
* Allow start and end again as label names in PromQL queries.
They were disallowed since the introduction of @ timestamp
feature. #9119
- Upgrade to upstream version 2.28.1
+ Bugfixes:
* HTTP SD: Allow charset specification in Content-Type header.
* HTTP SD: Fix handling of disappeared target groups. #9019
* Fix incorrect log-level handling after moving to go-kit/log.
- Upgrade to upstream version 2.28.0
+ Change:
* UI: Make the new experimental PromQL editor the default.
+ Features:
* Linode SD: Add Linode service discovery. #8846
* HTTP SD: Add generic HTTP-based service discovery. #8839
* Kubernetes SD: Allow configuring API Server access via a
kubeconfig file. #8811
* UI: Add exemplar display support to the graphing interface.
* Consul SD: Add namespace support for Consul Enterprise. #8900
+ Enhancements:
* Promtool: Allow silencing output when importing / backfilling
data. #8917
* Consul SD: Support reading tokens from file. #8926
* Rules: Add a new .ExternalURL alert field templating
variable, containing the external URL of the Prometheus
server. #8878
* Scrape: Add experimental body_size_limit scrape configuration
setting to limit the allowed response body size for target
scrapes. #8833 #8886
* Kubernetes SD: Add ingress class name label for ingress
discovery. #8916
* UI: Show a startup screen with progress bar when the TSDB is
not ready yet. #8662 #8908 #8909 #8946
* SD: Add a target creation failure counter
prometheus_target_sync_failed_total and improve target
creation failure handling. #8786
* TSDB: Improve validation of exemplar label set length. #8816
* TSDB: Add a prometheus_tsdb_clean_start metric that indicates
whether a TSDB lockfile from a previous run still existed
upon startup. #8824
+ Bugfixes:
* UI: In the experimental PromQL editor, fix autocompletion and
parsing for special float values and improve series metadata
fetching. #8856
* TSDB: When merging chunks, split resulting chunks if they
would contain more than the maximum of 120 samples. #8582
* SD: Fix the computation of the
prometheus_sd_discovered_targets metric when using multiple
service discoveries. #8828
-------------------------------------------------------------------
Mon Sep 20 14:44:20 UTC 2021 - Johannes Segitz <jsegitz@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package golang-github-prometheus-prometheus
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2017 Silvio Moioli <moio@suse.com>
#
# All modifications and additions to the file contributed by third parties
@ -27,15 +27,14 @@
%endif
Name: golang-github-prometheus-prometheus
Version: 2.27.1
Version: 2.32.1
Release: 0
Summary: The Prometheus monitoring system and time series database
License: Apache-2.0
Group: System/Monitoring
URL: https://prometheus.io/
Source: prometheus-%{version}.tar.gz
# generated after applying Patch3 and running `go mod vendor`
# also includes web assets generated with `make assets`
Source: prometheus-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: prometheus.service
Source3: prometheus.yml
@ -44,8 +43,6 @@ Source5: prometheus.firewall.xml
Patch1: 0001-Do-not-force-the-pure-Go-name-resolver.patch
# Lifted from Debian's prometheus package
Patch2: 0002-Default-settings.patch
# PATCH-FEATURE-OPENSUSE 0003-Add-Uyuni-service-discovery.patch jcavalheiro@suse.de
Patch3: 0003-Add-Uyuni-service-discovery.patch
BuildRequires: fdupes
%if 0%{?suse_version} == 1500 && 0%{?sle_version} < 150300
BuildRequires: firewall-macros

View File

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

3
prometheus-2.32.1.tar.gz Normal file
View File

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

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80645b109a2dbc6b994d5279e1291bfb5e6ba48212b1c13817c43618a2a1e35c
size 10485312
oid sha256:1f3436fa6bd375da1d236c89f3ff2550c670ab33dcc43501fa69c658b866310e
size 10456772