You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by "woblerr (via GitHub)" <gi...@apache.org> on 2026/04/13 11:54:35 UTC

[PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

woblerr opened a new pull request, #87:
URL: https://github.com/apache/cloudberry-backup/pull/87

   Added `gpbackup_exporter` - a Prometheus exporter for collecting metrics from the gpbackup history database (`gpbackup_history.db`).
   
   It is based on the original [gpbackup_exporter](https://github.com/woblerr/gpbackup_exporter) project and has been adapted for integration into the cloudberry-backup repository.
   
   ## Motivation
   
   gpbackup does not expose built-in Prometheus metrics. `gpbackup_exporter` fills this gap. This allows integrating backup health monitoring into existing Prometheus/Grafana stacks.
   
   ## Features
   
   `gpbackup_exporter` exposes the following Prometheus metrics:
   
   **Backup metrics:**
   - `gpbackup_backup_status` — backup status (success / failure);
   - `gpbackup_backup_deletion_status` — backup deletion status;
   - `gpbackup_backup_info` —  backup info (version, compression, plugin, etc.);
   - `gpbackup_backup_duration_seconds` — backup duration in seconds.
   
   **Last backup metrics:**
   - `gpbackup_backup_since_last_completion_seconds` — seconds elapsed since the last completed backup per database and backup type.
   
   **Exporter self-metrics:**
   - `gpbackup_exporter_status` — gpbackup exporter get data status;
   - `gpbackup_exporter_build_info` — information about gpbackup exporter.
   
   **Filtering flags:**
   - `--gpbackup.db-include` / `--gpbackup.db-exclude` — limit collection to specific databases;
   - `--gpbackup.backup-type` — limit collection to a specific backup type;
   - `--gpbackup.collect-deleted` / `--gpbackup.collect-failed` — include deleted / failed backups;
   - `--collect.depth` — collect metrics only for backups not older than N days;
   - `--web.config.file` — TLS and basic authentication support via the Prometheus exporter toolkit.
   
   ## Verification
   
   Unit tests pass without errors:
   
   ```bash
   $ make unit
   
   [1776080594] TOC Suite - 45/45 specs ••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 2.217417ms PASS
   [1776080594] testutils tests - 8/8 specs •••••••• SUCCESS! 552.083µs PASS
   [1776080594] Textmsg Suite - 14/14 specs •••••••••••••• SUCCESS! 604.292µs PASS
   [1776080594] Gpbckpconfig Suite - 47/47 specs ••••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 1.909583ms PASS
   [1776080594] utils tests - 118/118 specs •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 103.433167ms PASS
   [1776080594] restore tests - 118/118 specs •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• SUCCESS! 85.166959ms PASS
   [1776080594] Cmd Suite - 14/14 specs •••••••••••••• SUCCESS! 3.561667ms PASS
   [1776080594] Filepath Suite - 31/31 specs ••••••••••••••••••••••••••••••• SUCCESS! 2.903958ms PASS
   [1776080594] Options Suite - 27/27 specs ••••••••••••••••••••••••••• SUCCESS! 6.135125ms PASS
   [1776080594] Exporter Suite - 37/37 specs ••••••••••••••••••••••••••••••••••••• SUCCESS! 18.97375ms PASS
   [1776080594] History Suite - 8/8 specs •••••••• SUCCESS! 15.766416ms PASS
   [1776080594] Report Suite - 34/34 specs •••••••••••••••••••••••••••••••••• SUCCESS! 9.29725ms PASS
   [1776080594] s3_plugin tests - 32/32 specs •••••••••••••••••••••••••••••••• SUCCESS! 4.222791ms PASS
   [1776080594] backup tests - 585/586 specs •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••S••••••••••••••••••••••P••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••S•• SUCCESS! 172.169042ms PASS
   
   Ginkgo ran 14 suites in 10.961838459s
   Test Suite Passed
   ```
   
   ## Open Questions
   
   1. The exporter uses `promslog` for logging, which outputs in `logfmt` or `json` format — the standard for Prometheus exporters. Other tools in this repository use `gplog` from `cloudberry-go-libs`. Should `gpbackup_exporter` be migrated to `gplog` for consistency, or is it acceptable to keep the Prometheus logger?
   
   2. The exporter's `Makefile` targets use additional `-ldflags` (`GIT_REVISION`, `GIT_BRANCH`, `BUILD_DATE`) injected into `github.com/prometheus/common/version`. This is required by the Prometheus exporter convention to populate `gpbackup_exporter_build_info` metric. Other tools in the repo use a simpler single `-X version=...` flag pattern. Is this acceptable?
   
   ## Related links
   
   - https://github.com/apache/cloudberry-backup/issues/80#issuecomment-4170215979
   - Original project: [gpbackup_exporter](https://github.com/woblerr/gpbackup_exporter)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3163777644


##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,189 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty; aborting exporter startup", "endpoint", webEndpoint)
+			os.Exit(1)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())
+		if webEndpoint != "/" {
+			landingConfig := web.LandingConfig{
+				Name:        "cloudberry-backup exporter",
+				Description: "Prometheus exporter for Apache Cloudberry (Incubating) backup utility",
+				HeaderColor: "#476b6b",
+				Version:     version,
+				Profiling:   "false",
+				Links: []web.LandingLinks{
+					{
+						Address: webEndpoint,
+						Text:    "Metrics",
+					},
+				},
+			}
+			landingPage, err := web.NewLandingPage(landingConfig)
+			if err != nil {
+				logger.Error("Error creating landing page", "err", err)
+				os.Exit(1)
+			}
+			http.Handle("/", landingPage)
+		}
+		server := &http.Server{
+			ReadHeaderTimeout: 5 * time.Second,
+		}
+		if err := web.ListenAndServe(server, &webFlagsConfig, logger); err != nil {
+			logger.Error("Run web endpoint failed", "err", err)
+			os.Exit(1)
+		}
+	}(logger)
+}
+
+// GetGPBackupInfo get and parse gpbackup history database.
+func GetGPBackupInfo(historyFile, backupType string, collectDeleted, collectFailed bool, dbInclude, dbExclude []string, collectDepth int, logger *slog.Logger) {
+	// The flag indicates whether it was possible to get data from the gpbackup history.
+	// By default, it's set to true.
+	getDataSuccessStatus := true
+	// To calculate the time elapsed since the last completed backup for specific database.
+	// For all databases values are calculated relative to one value.
+	currentTime := time.Now()
+	currentUnixTime := currentTime.Unix()
+	// Calculate metrics collection depth.
+	// For backups with timestamp older than this - metrics doesn't collect.
+	collectDepthTime := currentTime.AddDate(0, 0, -collectDepth)
+	// The backup number can be reduced using filters for deleted and failed backups.
+	backupConfigs, err := parseBackupData(historyFile, collectDeleted, collectFailed, logger)
+	if err != nil {
+		logger.Error("Get data failed", "err", err)
+		getDataSuccessStatus = false
+	}
+	// Reset metrics.
+	resetMetrics()
+	if len(backupConfigs) != 0 {
+		// Like lastbackups["testDB"]["full"] = time
+		lastBackups := make(lastBackupMap)
+		dbStatus := make(dbStatusMap)
+		for i := 0; i < len(backupConfigs); i++ {
+			db := backupConfigs[i].DatabaseName
+			// If the same database is specified in include and exclude list,
+			// then metrics for this database will not be collected.
+			if !dbInList(db, dbExclude) {
+				if listEmpty(dbInclude) || dbInList(db, dbInclude) {
+					dbStatus[db] = getDataSuccessStatus
+					bckpType, err := gpbckpconfig.GetBackupType(backupConfigs[i])
+					if err != nil {
+						logger.Error("Parse backup type value failed", "err", err)
+					}
+					// Check backup type and compare with backup type filter.
+					if backupType == "" || backupType == bckpType {
+						// History file contains backup timestamp and endtime with timezone information.
+						// It is necessary to take this into account when calculating time intervals.
+						// With a high probability, the exporter will work in the same timezone as Greenplum cluster.
+						// If this is not the case, then there are many questions about the backup process.
+						bckpStartTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].Timestamp, time.Local)
+						if err != nil {
+							logger.Error("Parse backup timestamp value failed", "err", err)
+						}
+						bckpStopTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].EndTime, time.Local)
+						if err != nil {
+							logger.Error("Parse backup end time value failed", "err", err)
+						}
+						// Only if set correct value for collectDepth.
+						if collectDepth > 0 {
+							// gpbackup_history.db is sorted by timestamp values.
+							// The data of the most recent backup is always located at the beginning.
+							// So as soon as we get the first value that is older than collectDepthTime,
+							// the cycle can be broken.
+							// If this behavior ever changes, then this code needs to be refactored.
+							if collectDepthTime.Before(bckpStartTime) {
+								getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+							} else {
+								break
+							}
+						} else {
+							getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+						}
+						if backupConfigs[i].Status == history.BackupStatusSucceed {
+							// Check specific database key already exist.
+							if dbLastBackups, ok := lastBackups[db]; ok {
+								// Check specific backup type key already exist.
+								if _, ok := dbLastBackups[bckpType]; !ok {
+									dbLastBackups[bckpType] = bckpStopTime
+								}
+								// A small note on the code above.
+								// Since the history file is already sorted, the first occurrence will be the last backup.
+								// However, if sorting is suddenly removed in the future, the code should be something like this:
+								//	if curLastTime, ok := dbLastBackups[bckpType]; ok {
+								//		if curLastTime.Before(bckpStopTime) {
+								//			dbLastBackups[bckpType] = bckpStopTime
+								//		}
+								//	} else {
+								//		dbLastBackups[bckpType] = bckpStopTime
+								//	}
+							} else {
+								lastBackups[db] = backupMap{bckpType: bckpStopTime}
+							}
+						}
+					}
+				}
+			} else if dbInList(db, dbInclude) {
+				// When db is specified in both include and exclude lists, a warning is displayed in the log
+				// and data for this db is not collected.
+				// It is necessary to set zero metric value for this db.
+				getDataSuccessStatus = false
+				dbStatus[db] = getDataSuccessStatus
+				logger.Warn("DB is specified in include and exclude lists", "DB", db)
+			}
+		}
+		if len(lastBackups) != 0 {
+			getBackupLastMetrics(lastBackups, currentUnixTime, setUpMetricValue, logger)
+		} else {
+			logger.Warn("No succeed backups")
+		}
+		getExporterStatusMetrics(dbStatus, setUpMetricValue, logger)
+	} else {
+		logger.Warn("No backup data returned")

Review Comment:
   In case of an error when receiving data or empty information, we do not generate metrics.
   
   This suggests that there is a problem with getting data or with data itself. 
   In this case we don't provide metrics, except  `gpbackup_exporter_build_info` metric.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "tuhaihe (via GitHub)" <gi...@apache.org>.
tuhaihe commented on PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#issuecomment-4419670405

   Hi @MisterRaindrop @woblerr could you see this PR again? I saw some errors returned in the unit tests. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "liang8283 (via GitHub)" <gi...@apache.org>.
liang8283 commented on PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#issuecomment-4340863004

   ## Verification
   
   | Step | Result |
   | --- | --- |
   | `make BIN_DIR=/tmp/pr87-bin build` | ✅ all 6 binaries compile, no warnings |
   | `gpbackup_exporter --version` | ✅ exit 0, prints `version=2.2.0`, `branch=add_gpbackup_exporter`, `revision=6a29090`, `goversion=go1.24.13`, `tags=gpbackup_exporter` |
   | `gpbackup_exporter --help` | ✅ exit 0, all documented flags present |
   | `ginkgo -r exporter/` | ✅ 37/37 specs pass in 0.09s (matches PR body claim) |
   | live scrape vs real `/data0/master/gpseg-1/gpbackup_history.db` (8 prior `metadata-only` backups) | ✅ 177-line `/metrics`, 8× each of `gpbackup_backup_{status,info,duration_seconds,deletion_status}`, 1× `gpbackup_backup_since_last_completion_seconds`, 1× `gpbackup_exporter_status{database_name="perf_acl_test"} 1`, 1× `gpbackup_exporter_build_info` populated. Durations and labels match `gpbackman back up-info` output. |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "tuhaihe (via GitHub)" <gi...@apache.org>.
tuhaihe merged PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#issuecomment-4347575909

   The description for `gpbackup_exporter_status metric` metric has been updated in https://github.com/apache/cloudberry-backup/pull/87/commits/de77f35068fe9ab914023f86eeafccbccfc2d497 to match the current behaviour.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#issuecomment-4423708174

   Failed test is fixed. Thanks 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3140308563


##########
gpbackup_exporter.go:
##########
@@ -0,0 +1,172 @@
+//go:build gpbackup_exporter
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 main
+
+import (
+	"log/slog"
+	"os"
+	"os/signal"
+	"path/filepath"
+	"strings"
+	"syscall"
+	"time"
+
+	"github.com/alecthomas/kingpin/v2"
+	"github.com/apache/cloudberry-backup/exporter"
+	"github.com/prometheus/client_golang/prometheus"
+	version_collector "github.com/prometheus/client_golang/prometheus/collectors/version"
+	"github.com/prometheus/common/promslog"
+	"github.com/prometheus/common/promslog/flag"
+	"github.com/prometheus/common/version"
+	"github.com/prometheus/exporter-toolkit/web/kingpinflag"
+)
+
+const exporterName = "gpbackup_exporter"
+
+func main() {
+	var (
+		webPath = kingpin.Flag(
+			"web.telemetry-path",
+			"Path under which to expose metrics.",
+		).Default("/metrics").String()
+		webAdditionalToolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":19854")
+		collectionInterval        = kingpin.Flag(
+			"collect.interval",
+			"Collecting metrics interval in seconds.",
+		).Default("600").Int()
+		collectionDepth = kingpin.Flag(
+			"collect.depth",
+			"Metrics depth collection in days. Metrics for backup older than this interval will not be collected. 0 - disable.",
+		).Default("0").Int()
+		gpbckpHistoryFilePath = kingpin.Flag(
+			"gpbackup.history-file",
+			"Path to gpbackup_history.db.",
+		).Default("").String()
+		gpbckpIncludeDB = kingpin.Flag(
+			"gpbackup.db-include",
+			"Specific db for collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpExcludeDB = kingpin.Flag(
+			"gpbackup.db-exclude",
+			"Specific db to exclude from collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpBackupType = kingpin.Flag(
+			"gpbackup.backup-type",
+			"Specific backup type for collecting metrics. One of: [full, incremental, data-only, metadata-only].",
+		).Default("").String()
+		gpbckpBackupCollectDeleted = kingpin.Flag(
+			"gpbackup.collect-deleted",
+			"Collecting metrics for deleted backups.",
+		).Default("false").Bool()
+		gpbckpBackupCollectFailed = kingpin.Flag(
+			"gpbackup.collect-failed",
+			"Collecting metrics for failed backups.",
+		).Default("false").Bool()
+	)
+	// Set logger config.
+	promslogConfig := &promslog.Config{}
+	// Add flags log.level and log.format from promslog package.
+	flag.AddFlags(kingpin.CommandLine, promslogConfig)
+	kingpin.Version(version.Print(exporterName))
+	// Add short help flag.
+	kingpin.HelpFlag.Short('h')
+	// Load command line arguments.
+	kingpin.Parse()
+	// Setup signal catching.
+	sigs := make(chan os.Signal, 1)
+	// Catch listed signals.
+	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+	// Set logger.
+	logger := promslog.New(promslogConfig)
+	// Method invoked upon seeing signal.
+	go func(logger *slog.Logger) {
+		s := <-sigs
+		logger.Warn(
+			"Stopping exporter",
+			"name", filepath.Base(os.Args[0]),
+			"signal", s)
+		os.Exit(1)

Review Comment:
   yes, os.Exit(0)  looks better, fixed in https://github.com/apache/cloudberry-backup/pull/87/commits/21d0b83647189f16ff44eedb7d2eac64e8ce20c7



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "MisterRaindrop (via GitHub)" <gi...@apache.org>.
MisterRaindrop commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3145317589


##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,189 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty; aborting exporter startup", "endpoint", webEndpoint)
+			os.Exit(1)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())
+		if webEndpoint != "/" {
+			landingConfig := web.LandingConfig{
+				Name:        "cloudberry-backup exporter",
+				Description: "Prometheus exporter for Apache Cloudberry (Incubating) backup utility",
+				HeaderColor: "#476b6b",
+				Version:     version,
+				Profiling:   "false",
+				Links: []web.LandingLinks{
+					{
+						Address: webEndpoint,
+						Text:    "Metrics",
+					},
+				},
+			}
+			landingPage, err := web.NewLandingPage(landingConfig)
+			if err != nil {
+				logger.Error("Error creating landing page", "err", err)
+				os.Exit(1)
+			}
+			http.Handle("/", landingPage)
+		}
+		server := &http.Server{
+			ReadHeaderTimeout: 5 * time.Second,
+		}
+		if err := web.ListenAndServe(server, &webFlagsConfig, logger); err != nil {
+			logger.Error("Run web endpoint failed", "err", err)
+			os.Exit(1)
+		}
+	}(logger)
+}
+
+// GetGPBackupInfo get and parse gpbackup history database.
+func GetGPBackupInfo(historyFile, backupType string, collectDeleted, collectFailed bool, dbInclude, dbExclude []string, collectDepth int, logger *slog.Logger) {
+	// The flag indicates whether it was possible to get data from the gpbackup history.
+	// By default, it's set to true.
+	getDataSuccessStatus := true
+	// To calculate the time elapsed since the last completed backup for specific database.
+	// For all databases values are calculated relative to one value.
+	currentTime := time.Now()
+	currentUnixTime := currentTime.Unix()
+	// Calculate metrics collection depth.
+	// For backups with timestamp older than this - metrics doesn't collect.
+	collectDepthTime := currentTime.AddDate(0, 0, -collectDepth)
+	// The backup number can be reduced using filters for deleted and failed backups.
+	backupConfigs, err := parseBackupData(historyFile, collectDeleted, collectFailed, logger)
+	if err != nil {
+		logger.Error("Get data failed", "err", err)
+		getDataSuccessStatus = false
+	}
+	// Reset metrics.
+	resetMetrics()
+	if len(backupConfigs) != 0 {
+		// Like lastbackups["testDB"]["full"] = time
+		lastBackups := make(lastBackupMap)
+		dbStatus := make(dbStatusMap)
+		for i := 0; i < len(backupConfigs); i++ {
+			db := backupConfigs[i].DatabaseName
+			// If the same database is specified in include and exclude list,
+			// then metrics for this database will not be collected.
+			if !dbInList(db, dbExclude) {
+				if listEmpty(dbInclude) || dbInList(db, dbInclude) {
+					dbStatus[db] = getDataSuccessStatus
+					bckpType, err := gpbckpconfig.GetBackupType(backupConfigs[i])
+					if err != nil {
+						logger.Error("Parse backup type value failed", "err", err)
+					}
+					// Check backup type and compare with backup type filter.
+					if backupType == "" || backupType == bckpType {
+						// History file contains backup timestamp and endtime with timezone information.
+						// It is necessary to take this into account when calculating time intervals.
+						// With a high probability, the exporter will work in the same timezone as Greenplum cluster.
+						// If this is not the case, then there are many questions about the backup process.
+						bckpStartTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].Timestamp, time.Local)
+						if err != nil {
+							logger.Error("Parse backup timestamp value failed", "err", err)
+						}
+						bckpStopTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].EndTime, time.Local)
+						if err != nil {
+							logger.Error("Parse backup end time value failed", "err", err)
+						}
+						// Only if set correct value for collectDepth.
+						if collectDepth > 0 {
+							// gpbackup_history.db is sorted by timestamp values.
+							// The data of the most recent backup is always located at the beginning.
+							// So as soon as we get the first value that is older than collectDepthTime,
+							// the cycle can be broken.
+							// If this behavior ever changes, then this code needs to be refactored.
+							if collectDepthTime.Before(bckpStartTime) {
+								getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+							} else {
+								break
+							}
+						} else {
+							getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+						}
+						if backupConfigs[i].Status == history.BackupStatusSucceed {
+							// Check specific database key already exist.
+							if dbLastBackups, ok := lastBackups[db]; ok {
+								// Check specific backup type key already exist.
+								if _, ok := dbLastBackups[bckpType]; !ok {
+									dbLastBackups[bckpType] = bckpStopTime
+								}
+								// A small note on the code above.
+								// Since the history file is already sorted, the first occurrence will be the last backup.
+								// However, if sorting is suddenly removed in the future, the code should be something like this:
+								//	if curLastTime, ok := dbLastBackups[bckpType]; ok {
+								//		if curLastTime.Before(bckpStopTime) {
+								//			dbLastBackups[bckpType] = bckpStopTime
+								//		}
+								//	} else {
+								//		dbLastBackups[bckpType] = bckpStopTime
+								//	}
+							} else {
+								lastBackups[db] = backupMap{bckpType: bckpStopTime}
+							}
+						}
+					}
+				}
+			} else if dbInList(db, dbInclude) {
+				// When db is specified in both include and exclude lists, a warning is displayed in the log
+				// and data for this db is not collected.
+				// It is necessary to set zero metric value for this db.
+				getDataSuccessStatus = false
+				dbStatus[db] = getDataSuccessStatus
+				logger.Warn("DB is specified in include and exclude lists", "DB", db)
+			}
+		}
+		if len(lastBackups) != 0 {
+			getBackupLastMetrics(lastBackups, currentUnixTime, setUpMetricValue, logger)
+		} else {
+			logger.Warn("No succeed backups")
+		}
+		getExporterStatusMetrics(dbStatus, setUpMetricValue, logger)
+	} else {
+		logger.Warn("No backup data returned")

Review Comment:
   ```
   backupConfigs, err := parseBackupData(...)
     if err != nil {
         logger.Error("Get data failed", "err", err)
         getDataSuccessStatus = false              // dead on this path
     }
     resetMetrics()
     if len(backupConfigs) != 0 {
         ...
         getExporterStatusMetrics(dbStatus, ...)   // only called here
     } else {
         logger.Warn("No backup data returned")    // log only, no metric
     }
   ```
   
   log only, no metric



##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,189 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty; aborting exporter startup", "endpoint", webEndpoint)
+			os.Exit(1)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())
+		if webEndpoint != "/" {
+			landingConfig := web.LandingConfig{
+				Name:        "cloudberry-backup exporter",
+				Description: "Prometheus exporter for Apache Cloudberry (Incubating) backup utility",
+				HeaderColor: "#476b6b",
+				Version:     version,
+				Profiling:   "false",
+				Links: []web.LandingLinks{
+					{
+						Address: webEndpoint,
+						Text:    "Metrics",
+					},
+				},
+			}
+			landingPage, err := web.NewLandingPage(landingConfig)
+			if err != nil {
+				logger.Error("Error creating landing page", "err", err)
+				os.Exit(1)
+			}
+			http.Handle("/", landingPage)
+		}
+		server := &http.Server{
+			ReadHeaderTimeout: 5 * time.Second,
+		}
+		if err := web.ListenAndServe(server, &webFlagsConfig, logger); err != nil {
+			logger.Error("Run web endpoint failed", "err", err)
+			os.Exit(1)
+		}
+	}(logger)
+}
+
+// GetGPBackupInfo get and parse gpbackup history database.
+func GetGPBackupInfo(historyFile, backupType string, collectDeleted, collectFailed bool, dbInclude, dbExclude []string, collectDepth int, logger *slog.Logger) {
+	// The flag indicates whether it was possible to get data from the gpbackup history.
+	// By default, it's set to true.
+	getDataSuccessStatus := true
+	// To calculate the time elapsed since the last completed backup for specific database.
+	// For all databases values are calculated relative to one value.
+	currentTime := time.Now()
+	currentUnixTime := currentTime.Unix()
+	// Calculate metrics collection depth.
+	// For backups with timestamp older than this - metrics doesn't collect.
+	collectDepthTime := currentTime.AddDate(0, 0, -collectDepth)
+	// The backup number can be reduced using filters for deleted and failed backups.
+	backupConfigs, err := parseBackupData(historyFile, collectDeleted, collectFailed, logger)
+	if err != nil {
+		logger.Error("Get data failed", "err", err)
+		getDataSuccessStatus = false
+	}
+	// Reset metrics.
+	resetMetrics()
+	if len(backupConfigs) != 0 {
+		// Like lastbackups["testDB"]["full"] = time
+		lastBackups := make(lastBackupMap)
+		dbStatus := make(dbStatusMap)
+		for i := 0; i < len(backupConfigs); i++ {
+			db := backupConfigs[i].DatabaseName
+			// If the same database is specified in include and exclude list,
+			// then metrics for this database will not be collected.
+			if !dbInList(db, dbExclude) {
+				if listEmpty(dbInclude) || dbInList(db, dbInclude) {
+					dbStatus[db] = getDataSuccessStatus
+					bckpType, err := gpbckpconfig.GetBackupType(backupConfigs[i])
+					if err != nil {
+						logger.Error("Parse backup type value failed", "err", err)
+					}
+					// Check backup type and compare with backup type filter.
+					if backupType == "" || backupType == bckpType {
+						// History file contains backup timestamp and endtime with timezone information.
+						// It is necessary to take this into account when calculating time intervals.
+						// With a high probability, the exporter will work in the same timezone as Greenplum cluster.
+						// If this is not the case, then there are many questions about the backup process.
+						bckpStartTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].Timestamp, time.Local)
+						if err != nil {
+							logger.Error("Parse backup timestamp value failed", "err", err)
+						}
+						bckpStopTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].EndTime, time.Local)
+						if err != nil {
+							logger.Error("Parse backup end time value failed", "err", err)
+						}
+						// Only if set correct value for collectDepth.
+						if collectDepth > 0 {
+							// gpbackup_history.db is sorted by timestamp values.
+							// The data of the most recent backup is always located at the beginning.
+							// So as soon as we get the first value that is older than collectDepthTime,
+							// the cycle can be broken.
+							// If this behavior ever changes, then this code needs to be refactored.
+							if collectDepthTime.Before(bckpStartTime) {
+								getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+							} else {
+								break
+							}
+						} else {
+							getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+						}
+						if backupConfigs[i].Status == history.BackupStatusSucceed {
+							// Check specific database key already exist.
+							if dbLastBackups, ok := lastBackups[db]; ok {
+								// Check specific backup type key already exist.
+								if _, ok := dbLastBackups[bckpType]; !ok {
+									dbLastBackups[bckpType] = bckpStopTime
+								}
+								// A small note on the code above.
+								// Since the history file is already sorted, the first occurrence will be the last backup.
+								// However, if sorting is suddenly removed in the future, the code should be something like this:
+								//	if curLastTime, ok := dbLastBackups[bckpType]; ok {
+								//		if curLastTime.Before(bckpStopTime) {
+								//			dbLastBackups[bckpType] = bckpStopTime
+								//		}
+								//	} else {
+								//		dbLastBackups[bckpType] = bckpStopTime
+								//	}
+							} else {
+								lastBackups[db] = backupMap{bckpType: bckpStopTime}
+							}
+						}
+					}
+				}
+			} else if dbInList(db, dbInclude) {
+				// When db is specified in both include and exclude lists, a warning is displayed in the log
+				// and data for this db is not collected.
+				// It is necessary to set zero metric value for this db.
+				getDataSuccessStatus = false

Review Comment:
   getDataSuccessStatus lives for the whole loop. Once an include/exclude conflict flips it to false, every later healthy DB read at
     L114 (dbStatus[db] = getDataSuccessStatus) is also recorded as failed, producing spurious gpbackup_exporter_status = 0 and false



##########
end_to_end/exporter_test.go:
##########
@@ -0,0 +1,143 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 end_to_end_test
+
+import (
+	"fmt"
+	"io"
+	"net"
+	"net/http"
+	"os"
+	"os/exec"
+	"regexp"
+	"strings"
+	"time"
+
+	. "github.com/onsi/ginkgo/v2"
+	. "github.com/onsi/gomega"
+)
+
+func getFreeTCPPort() int {
+	listener, err := net.Listen("tcp", "127.0.0.1:0")
+	Expect(err).NotTo(HaveOccurred())
+	port := listener.Addr().(*net.TCPAddr).Port
+	listener.Close()
+	return port
+}
+
+type exporterMetricCheck struct {
+	pattern string
+	count   int
+}
+
+func validateExporterMetrics(body string, checks []exporterMetricCheck) {
+	lines := strings.Split(body, "\n")
+	for _, em := range checks {
+		re := regexp.MustCompile(em.pattern)
+		count := 0
+		for _, line := range lines {
+			if re.MatchString(line) {
+				count++
+			}
+		}
+		Expect(count).To(Equal(em.count),
+			fmt.Sprintf("metric pattern %q: got %d, want %d", em.pattern, count, em.count))
+	}
+}
+
+func fetchMetrics(url string, client *http.Client) (string, error) {
+	if client == nil {
+		client = &http.Client{Timeout: 5 * time.Second}
+	}
+	resp, err := client.Get(url)
+	if err != nil {
+		return "", err
+	}
+	defer resp.Body.Close()
+	body, err := io.ReadAll(resp.Body)
+	if err != nil {
+		return "", err
+	}
+	if resp.StatusCode != http.StatusOK {
+		return string(body), fmt.Errorf("unexpected status code: %d", resp.StatusCode)
+	}
+	return string(body), nil
+}
+
+var _ = Describe("gpbackup_exporter end to end tests", func() {
+	BeforeEach(func() {
+		if useOldBackupVersion {
+			Skip("exporter tests are not applicable in old backup version mode")
+		}
+		if _, err := os.Stat(exporterPath); os.IsNotExist(err) {
+			Skip("gpbackup_exporter binary not found, skipping exporter e2e tests")
+		}
+	})
+
+	It("collects and exposes metrics without web config", func() {
+		expectedMetrics := []exporterMetricCheck{
+			{`^gpbackup_backup_deletion_status\{`, 3},
+			{`^gpbackup_backup_duration_seconds\{`, 3},
+			{`^gpbackup_backup_info\{`, 3},
+			{`^gpbackup_backup_status\{`, 3},
+			{`^gpbackup_backup_status\{.*\} 0$`, 3},
+			{`^gpbackup_backup_duration_seconds\{.*object_filtering="none",plugin="none".*\}`, 3},
+			{`^gpbackup_backup_info\{.*database_name="testdb".*\}`, 3},
+			{`^gpbackup_backup_since_last_completion_seconds\{`, 3},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="full",database_name="testdb".*\}`, 1},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="incremental",database_name="testdb".*\}`, 1},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="metadata-only",database_name="testdb".*\}`, 1},
+			{`^gpbackup_exporter_status\{database_name="testdb"\} 1$`, 1},
+			{`^gpbackup_exporter_build_info\{.*\} 1$`, 1},
+		}
+		end_to_end_setup()
+		defer end_to_end_teardown()
+		historyDB := getHistoryDBPathForCluster()
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--leaf-partition-data")
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--incremental",
+			"--leaf-partition-data")
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--metadata-only")
+		port := getFreeTCPPort()
+		cmd := exec.Command(exporterPath,
+			"--gpbackup.history-file", historyDB,
+			"--collect.interval", "600",
+			"--web.listen-address", fmt.Sprintf("127.0.0.1:%d", port),
+		)
+		cmd.Start()

Review Comment:
   is better `Expect(cmd.Start()).To(Succeed())`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3163747286


##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,189 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty; aborting exporter startup", "endpoint", webEndpoint)
+			os.Exit(1)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())
+		if webEndpoint != "/" {
+			landingConfig := web.LandingConfig{
+				Name:        "cloudberry-backup exporter",
+				Description: "Prometheus exporter for Apache Cloudberry (Incubating) backup utility",
+				HeaderColor: "#476b6b",
+				Version:     version,
+				Profiling:   "false",
+				Links: []web.LandingLinks{
+					{
+						Address: webEndpoint,
+						Text:    "Metrics",
+					},
+				},
+			}
+			landingPage, err := web.NewLandingPage(landingConfig)
+			if err != nil {
+				logger.Error("Error creating landing page", "err", err)
+				os.Exit(1)
+			}
+			http.Handle("/", landingPage)
+		}
+		server := &http.Server{
+			ReadHeaderTimeout: 5 * time.Second,
+		}
+		if err := web.ListenAndServe(server, &webFlagsConfig, logger); err != nil {
+			logger.Error("Run web endpoint failed", "err", err)
+			os.Exit(1)
+		}
+	}(logger)
+}
+
+// GetGPBackupInfo get and parse gpbackup history database.
+func GetGPBackupInfo(historyFile, backupType string, collectDeleted, collectFailed bool, dbInclude, dbExclude []string, collectDepth int, logger *slog.Logger) {
+	// The flag indicates whether it was possible to get data from the gpbackup history.
+	// By default, it's set to true.
+	getDataSuccessStatus := true
+	// To calculate the time elapsed since the last completed backup for specific database.
+	// For all databases values are calculated relative to one value.
+	currentTime := time.Now()
+	currentUnixTime := currentTime.Unix()
+	// Calculate metrics collection depth.
+	// For backups with timestamp older than this - metrics doesn't collect.
+	collectDepthTime := currentTime.AddDate(0, 0, -collectDepth)
+	// The backup number can be reduced using filters for deleted and failed backups.
+	backupConfigs, err := parseBackupData(historyFile, collectDeleted, collectFailed, logger)
+	if err != nil {
+		logger.Error("Get data failed", "err", err)
+		getDataSuccessStatus = false
+	}
+	// Reset metrics.
+	resetMetrics()
+	if len(backupConfigs) != 0 {
+		// Like lastbackups["testDB"]["full"] = time
+		lastBackups := make(lastBackupMap)
+		dbStatus := make(dbStatusMap)
+		for i := 0; i < len(backupConfigs); i++ {
+			db := backupConfigs[i].DatabaseName
+			// If the same database is specified in include and exclude list,
+			// then metrics for this database will not be collected.
+			if !dbInList(db, dbExclude) {
+				if listEmpty(dbInclude) || dbInList(db, dbInclude) {
+					dbStatus[db] = getDataSuccessStatus
+					bckpType, err := gpbckpconfig.GetBackupType(backupConfigs[i])
+					if err != nil {
+						logger.Error("Parse backup type value failed", "err", err)
+					}
+					// Check backup type and compare with backup type filter.
+					if backupType == "" || backupType == bckpType {
+						// History file contains backup timestamp and endtime with timezone information.
+						// It is necessary to take this into account when calculating time intervals.
+						// With a high probability, the exporter will work in the same timezone as Greenplum cluster.
+						// If this is not the case, then there are many questions about the backup process.
+						bckpStartTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].Timestamp, time.Local)
+						if err != nil {
+							logger.Error("Parse backup timestamp value failed", "err", err)
+						}
+						bckpStopTime, err := time.ParseInLocation(gpbckpconfig.Layout, backupConfigs[i].EndTime, time.Local)
+						if err != nil {
+							logger.Error("Parse backup end time value failed", "err", err)
+						}
+						// Only if set correct value for collectDepth.
+						if collectDepth > 0 {
+							// gpbackup_history.db is sorted by timestamp values.
+							// The data of the most recent backup is always located at the beginning.
+							// So as soon as we get the first value that is older than collectDepthTime,
+							// the cycle can be broken.
+							// If this behavior ever changes, then this code needs to be refactored.
+							if collectDepthTime.Before(bckpStartTime) {
+								getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+							} else {
+								break
+							}
+						} else {
+							getBackupMetrics(backupConfigs[i], setUpMetricValue, logger)
+						}
+						if backupConfigs[i].Status == history.BackupStatusSucceed {
+							// Check specific database key already exist.
+							if dbLastBackups, ok := lastBackups[db]; ok {
+								// Check specific backup type key already exist.
+								if _, ok := dbLastBackups[bckpType]; !ok {
+									dbLastBackups[bckpType] = bckpStopTime
+								}
+								// A small note on the code above.
+								// Since the history file is already sorted, the first occurrence will be the last backup.
+								// However, if sorting is suddenly removed in the future, the code should be something like this:
+								//	if curLastTime, ok := dbLastBackups[bckpType]; ok {
+								//		if curLastTime.Before(bckpStopTime) {
+								//			dbLastBackups[bckpType] = bckpStopTime
+								//		}
+								//	} else {
+								//		dbLastBackups[bckpType] = bckpStopTime
+								//	}
+							} else {
+								lastBackups[db] = backupMap{bckpType: bckpStopTime}
+							}
+						}
+					}
+				}
+			} else if dbInList(db, dbInclude) {
+				// When db is specified in both include and exclude lists, a warning is displayed in the log
+				// and data for this db is not collected.
+				// It is necessary to set zero metric value for this db.
+				getDataSuccessStatus = false

Review Comment:
   Fixed in https://github.com/apache/cloudberry-backup/pull/87/commits/1e0a7842bb2794294d5b2dc5acc5b8482db61160
   
   Clarifying the logic of inclusion/exclusion processing:
   * DB present in both dbInclude and dbExclude - warn and emit gpbackup_exporter_status=0.
   * DB only in dbExclude - skip, emit no metrics.
   * dbInclude empty or DB in dbInclude -  process and emit full backup metrics.
   
   Also added additional unit tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3163750659


##########
end_to_end/exporter_test.go:
##########
@@ -0,0 +1,143 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 end_to_end_test
+
+import (
+	"fmt"
+	"io"
+	"net"
+	"net/http"
+	"os"
+	"os/exec"
+	"regexp"
+	"strings"
+	"time"
+
+	. "github.com/onsi/ginkgo/v2"
+	. "github.com/onsi/gomega"
+)
+
+func getFreeTCPPort() int {
+	listener, err := net.Listen("tcp", "127.0.0.1:0")
+	Expect(err).NotTo(HaveOccurred())
+	port := listener.Addr().(*net.TCPAddr).Port
+	listener.Close()
+	return port
+}
+
+type exporterMetricCheck struct {
+	pattern string
+	count   int
+}
+
+func validateExporterMetrics(body string, checks []exporterMetricCheck) {
+	lines := strings.Split(body, "\n")
+	for _, em := range checks {
+		re := regexp.MustCompile(em.pattern)
+		count := 0
+		for _, line := range lines {
+			if re.MatchString(line) {
+				count++
+			}
+		}
+		Expect(count).To(Equal(em.count),
+			fmt.Sprintf("metric pattern %q: got %d, want %d", em.pattern, count, em.count))
+	}
+}
+
+func fetchMetrics(url string, client *http.Client) (string, error) {
+	if client == nil {
+		client = &http.Client{Timeout: 5 * time.Second}
+	}
+	resp, err := client.Get(url)
+	if err != nil {
+		return "", err
+	}
+	defer resp.Body.Close()
+	body, err := io.ReadAll(resp.Body)
+	if err != nil {
+		return "", err
+	}
+	if resp.StatusCode != http.StatusOK {
+		return string(body), fmt.Errorf("unexpected status code: %d", resp.StatusCode)
+	}
+	return string(body), nil
+}
+
+var _ = Describe("gpbackup_exporter end to end tests", func() {
+	BeforeEach(func() {
+		if useOldBackupVersion {
+			Skip("exporter tests are not applicable in old backup version mode")
+		}
+		if _, err := os.Stat(exporterPath); os.IsNotExist(err) {
+			Skip("gpbackup_exporter binary not found, skipping exporter e2e tests")
+		}
+	})
+
+	It("collects and exposes metrics without web config", func() {
+		expectedMetrics := []exporterMetricCheck{
+			{`^gpbackup_backup_deletion_status\{`, 3},
+			{`^gpbackup_backup_duration_seconds\{`, 3},
+			{`^gpbackup_backup_info\{`, 3},
+			{`^gpbackup_backup_status\{`, 3},
+			{`^gpbackup_backup_status\{.*\} 0$`, 3},
+			{`^gpbackup_backup_duration_seconds\{.*object_filtering="none",plugin="none".*\}`, 3},
+			{`^gpbackup_backup_info\{.*database_name="testdb".*\}`, 3},
+			{`^gpbackup_backup_since_last_completion_seconds\{`, 3},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="full",database_name="testdb".*\}`, 1},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="incremental",database_name="testdb".*\}`, 1},
+			{`^gpbackup_backup_since_last_completion_seconds\{.*backup_type="metadata-only",database_name="testdb".*\}`, 1},
+			{`^gpbackup_exporter_status\{database_name="testdb"\} 1$`, 1},
+			{`^gpbackup_exporter_build_info\{.*\} 1$`, 1},
+		}
+		end_to_end_setup()
+		defer end_to_end_teardown()
+		historyDB := getHistoryDBPathForCluster()
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--leaf-partition-data")
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--incremental",
+			"--leaf-partition-data")
+		gpbackup(gpbackupPath, backupHelperPath,
+			"--backup-dir", backupDir,
+			"--metadata-only")
+		port := getFreeTCPPort()
+		cmd := exec.Command(exporterPath,
+			"--gpbackup.history-file", historyDB,
+			"--collect.interval", "600",
+			"--web.listen-address", fmt.Sprintf("127.0.0.1:%d", port),
+		)
+		cmd.Start()

Review Comment:
   Thanks, fixed in https://github.com/apache/cloudberry-backup/pull/87/commits/40ce32272aa515ae70ee388217cbc25a17c576e5



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3140173045


##########
gpbackup_exporter.go:
##########
@@ -0,0 +1,172 @@
+//go:build gpbackup_exporter
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 main
+
+import (
+	"log/slog"
+	"os"
+	"os/signal"
+	"path/filepath"
+	"strings"
+	"syscall"
+	"time"
+
+	"github.com/alecthomas/kingpin/v2"
+	"github.com/apache/cloudberry-backup/exporter"
+	"github.com/prometheus/client_golang/prometheus"
+	version_collector "github.com/prometheus/client_golang/prometheus/collectors/version"
+	"github.com/prometheus/common/promslog"
+	"github.com/prometheus/common/promslog/flag"
+	"github.com/prometheus/common/version"
+	"github.com/prometheus/exporter-toolkit/web/kingpinflag"
+)
+
+const exporterName = "gpbackup_exporter"
+
+func main() {
+	var (
+		webPath = kingpin.Flag(
+			"web.telemetry-path",
+			"Path under which to expose metrics.",
+		).Default("/metrics").String()
+		webAdditionalToolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":19854")
+		collectionInterval        = kingpin.Flag(
+			"collect.interval",
+			"Collecting metrics interval in seconds.",
+		).Default("600").Int()
+		collectionDepth = kingpin.Flag(
+			"collect.depth",
+			"Metrics depth collection in days. Metrics for backup older than this interval will not be collected. 0 - disable.",
+		).Default("0").Int()
+		gpbckpHistoryFilePath = kingpin.Flag(
+			"gpbackup.history-file",
+			"Path to gpbackup_history.db.",
+		).Default("").String()
+		gpbckpIncludeDB = kingpin.Flag(
+			"gpbackup.db-include",
+			"Specific db for collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpExcludeDB = kingpin.Flag(
+			"gpbackup.db-exclude",
+			"Specific db to exclude from collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpBackupType = kingpin.Flag(
+			"gpbackup.backup-type",
+			"Specific backup type for collecting metrics. One of: [full, incremental, data-only, metadata-only].",
+		).Default("").String()
+		gpbckpBackupCollectDeleted = kingpin.Flag(
+			"gpbackup.collect-deleted",
+			"Collecting metrics for deleted backups.",
+		).Default("false").Bool()
+		gpbckpBackupCollectFailed = kingpin.Flag(
+			"gpbackup.collect-failed",
+			"Collecting metrics for failed backups.",
+		).Default("false").Bool()
+	)
+	// Set logger config.
+	promslogConfig := &promslog.Config{}
+	// Add flags log.level and log.format from promslog package.
+	flag.AddFlags(kingpin.CommandLine, promslogConfig)
+	kingpin.Version(version.Print(exporterName))
+	// Add short help flag.
+	kingpin.HelpFlag.Short('h')
+	// Load command line arguments.
+	kingpin.Parse()
+	// Setup signal catching.
+	sigs := make(chan os.Signal, 1)
+	// Catch listed signals.
+	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+	// Set logger.
+	logger := promslog.New(promslogConfig)
+	// Method invoked upon seeing signal.
+	go func(logger *slog.Logger) {
+		s := <-sigs
+		logger.Warn(
+			"Stopping exporter",
+			"name", filepath.Base(os.Args[0]),
+			"signal", s)
+		os.Exit(1)
+	}(logger)
+	logger.Info(
+		"Starting exporter",
+		"name", filepath.Base(os.Args[0]),
+		"version", version.Info())
+	logger.Info("Build context", "build_context", version.BuildContext())
+	logger.Info(
+		"History database file path",
+		"file", *gpbckpHistoryFilePath)
+	logger.Info(
+		"Collecting metrics for deleted and failed backups",
+		"deleted", *gpbckpBackupCollectDeleted,
+		"failed", *gpbckpBackupCollectFailed,
+	)
+	if *collectionDepth > 0 {
+		logger.Info(
+			"Metrics depth collection in days",
+			"depth", *collectionDepth)
+	}
+	if strings.Join(*gpbckpIncludeDB, "") != "" {
+		for _, db := range *gpbckpIncludeDB {
+			logger.Info(
+				"Collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if strings.Join(*gpbckpExcludeDB, "") != "" {
+		for _, db := range *gpbckpExcludeDB {
+			logger.Info(
+				"Exclude collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if *gpbckpBackupType != "" {
+		logger.Info(
+			"Collecting metrics for specific backup type",
+			"type", *gpbckpBackupType)
+	}
+	// Setup parameters for exporter.
+	exporter.SetPromPortAndPath(*webAdditionalToolkitFlags, *webPath)
+	logger.Info(
+		"Use exporter parameters",
+		"endpoint", *webPath,
+		"config.file", *webAdditionalToolkitFlags.WebConfigFile,
+	)
+	// Exporter build info metric.
+	prometheus.MustRegister(version_collector.NewCollector(exporterName))
+	// Start web server.
+	exporter.StartPromEndpoint(version.Info(), logger)
+	for {
+		// Get information from gpbackup_history.db.
+		exporter.GetGPBackupInfo(
+			*gpbckpHistoryFilePath,
+			*gpbckpBackupType,
+			*gpbckpBackupCollectDeleted,
+			*gpbckpBackupCollectFailed,
+			*gpbckpIncludeDB,
+			*gpbckpExcludeDB,
+			*collectionDepth,
+			logger,
+		)
+		// Sleep for 'collection.interval' seconds.
+		time.Sleep(time.Duration(*collectionInterval) * time.Second)

Review Comment:
   We already catch SIGINT/SIGTERM and call `os.Exit` in the signal goroutine, so the process exits immediately.
   Or did I misunderstand the comment?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "MisterRaindrop (via GitHub)" <gi...@apache.org>.
MisterRaindrop commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3138111065


##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,188 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty", "endpoint", webEndpoint)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())

Review Comment:
   There seems to be an issue here. An error occurred above, yet the execution continues. This will likely cause a panic?



##########
exporter/README.md:
##########
@@ -0,0 +1,122 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+
+# gpbackup_exporter
+
+**gpbackup_exporter** is a Prometheus exporter for collecting metrics from gpbackup history database (`gpbackup_history.db`).
+
+## Metrics
+### Backup metrics
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_backup_status` | backup status | backup_type, database_name, object_filtering, plugin, timestamp | Values description:<br> `0` - success,<br> `1` - failure.|
+| `gpbackup_backup_deletion_status` | backup deletion status | backup_type, database_name, date_deleted, object_filtering, plugin, timestamp | Values description:<br> `0` - backup still exists,<br> `1` - backup was successfully deleted,<br> `2` - the deletion is in progress,<br> `3` - last delete attempt failed to delete backup from plugin storage,<br> `4` - last delete attempt failed to delete backup from local storage.|
+| `gpbackup_backup_info` | backup info | backup_dir, backup_ver, backup_type, compression_type, database_name, database_ver, object_filtering, plugin, plugin_ver, timestamp, with_statistic | Values description:<br> `1` - info about backup is exist.|
+| `gpbackup_backup_duration_seconds` | backup duration in seconds| backup_type, database_name, end_time, object_filtering, plugin, timestamp ||
+
+### Last backup metrics
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_backup_since_last_completion_seconds`| seconds since the last completed backup | backup_type, database_name ||
+
+### Exporter metrics
+
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_exporter_build_info` | information about gpbackup exporter | branch, goarch, goos, goversion, revision, tags, version | |
+| `gpbackup_exporter_status` | gpbackup exporter get data status | database_name | Values description:<br> `0` - errors occurred when fetching information from history database,<br> `1` - information successfully fetched from history database. |
+
+## Getting Started
+Available configuration flags:
+
+```bash
+./gpbackup_exporter --help
+usage: gpbackup_exporter [<flags>]
+
+
+Flags:
+  -h, --[no-]help                Show context-sensitive help (also try --help-long and --help-man).
+      --web.telemetry-path="/metrics"  
+                                 Path under which to expose metrics.
+      --web.listen-address=:19854 ...  

Review Comment:
   in gpbckp_exporter_test.go I see `WebListenAddresses: &([]string{":9854"}),` so 19854 or 9854?



##########
gpbackup_exporter.go:
##########
@@ -0,0 +1,172 @@
+//go:build gpbackup_exporter
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 main
+
+import (
+	"log/slog"
+	"os"
+	"os/signal"
+	"path/filepath"
+	"strings"
+	"syscall"
+	"time"
+
+	"github.com/alecthomas/kingpin/v2"
+	"github.com/apache/cloudberry-backup/exporter"
+	"github.com/prometheus/client_golang/prometheus"
+	version_collector "github.com/prometheus/client_golang/prometheus/collectors/version"
+	"github.com/prometheus/common/promslog"
+	"github.com/prometheus/common/promslog/flag"
+	"github.com/prometheus/common/version"
+	"github.com/prometheus/exporter-toolkit/web/kingpinflag"
+)
+
+const exporterName = "gpbackup_exporter"
+
+func main() {
+	var (
+		webPath = kingpin.Flag(
+			"web.telemetry-path",
+			"Path under which to expose metrics.",
+		).Default("/metrics").String()
+		webAdditionalToolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":19854")
+		collectionInterval        = kingpin.Flag(
+			"collect.interval",
+			"Collecting metrics interval in seconds.",
+		).Default("600").Int()
+		collectionDepth = kingpin.Flag(
+			"collect.depth",
+			"Metrics depth collection in days. Metrics for backup older than this interval will not be collected. 0 - disable.",
+		).Default("0").Int()
+		gpbckpHistoryFilePath = kingpin.Flag(
+			"gpbackup.history-file",
+			"Path to gpbackup_history.db.",
+		).Default("").String()
+		gpbckpIncludeDB = kingpin.Flag(
+			"gpbackup.db-include",
+			"Specific db for collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpExcludeDB = kingpin.Flag(
+			"gpbackup.db-exclude",
+			"Specific db to exclude from collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpBackupType = kingpin.Flag(
+			"gpbackup.backup-type",
+			"Specific backup type for collecting metrics. One of: [full, incremental, data-only, metadata-only].",
+		).Default("").String()
+		gpbckpBackupCollectDeleted = kingpin.Flag(
+			"gpbackup.collect-deleted",
+			"Collecting metrics for deleted backups.",
+		).Default("false").Bool()
+		gpbckpBackupCollectFailed = kingpin.Flag(
+			"gpbackup.collect-failed",
+			"Collecting metrics for failed backups.",
+		).Default("false").Bool()
+	)
+	// Set logger config.
+	promslogConfig := &promslog.Config{}
+	// Add flags log.level and log.format from promslog package.
+	flag.AddFlags(kingpin.CommandLine, promslogConfig)
+	kingpin.Version(version.Print(exporterName))
+	// Add short help flag.
+	kingpin.HelpFlag.Short('h')
+	// Load command line arguments.
+	kingpin.Parse()
+	// Setup signal catching.
+	sigs := make(chan os.Signal, 1)
+	// Catch listed signals.
+	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+	// Set logger.
+	logger := promslog.New(promslogConfig)
+	// Method invoked upon seeing signal.
+	go func(logger *slog.Logger) {
+		s := <-sigs
+		logger.Warn(
+			"Stopping exporter",
+			"name", filepath.Base(os.Args[0]),
+			"signal", s)
+		os.Exit(1)

Review Comment:
   is better os.Exit(0) ? 



##########
gpbackup_exporter.go:
##########
@@ -0,0 +1,172 @@
+//go:build gpbackup_exporter
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 main
+
+import (
+	"log/slog"
+	"os"
+	"os/signal"
+	"path/filepath"
+	"strings"
+	"syscall"
+	"time"
+
+	"github.com/alecthomas/kingpin/v2"
+	"github.com/apache/cloudberry-backup/exporter"
+	"github.com/prometheus/client_golang/prometheus"
+	version_collector "github.com/prometheus/client_golang/prometheus/collectors/version"
+	"github.com/prometheus/common/promslog"
+	"github.com/prometheus/common/promslog/flag"
+	"github.com/prometheus/common/version"
+	"github.com/prometheus/exporter-toolkit/web/kingpinflag"
+)
+
+const exporterName = "gpbackup_exporter"
+
+func main() {
+	var (
+		webPath = kingpin.Flag(
+			"web.telemetry-path",
+			"Path under which to expose metrics.",
+		).Default("/metrics").String()
+		webAdditionalToolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":19854")
+		collectionInterval        = kingpin.Flag(
+			"collect.interval",
+			"Collecting metrics interval in seconds.",
+		).Default("600").Int()
+		collectionDepth = kingpin.Flag(
+			"collect.depth",
+			"Metrics depth collection in days. Metrics for backup older than this interval will not be collected. 0 - disable.",
+		).Default("0").Int()
+		gpbckpHistoryFilePath = kingpin.Flag(
+			"gpbackup.history-file",
+			"Path to gpbackup_history.db.",
+		).Default("").String()
+		gpbckpIncludeDB = kingpin.Flag(
+			"gpbackup.db-include",
+			"Specific db for collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpExcludeDB = kingpin.Flag(
+			"gpbackup.db-exclude",
+			"Specific db to exclude from collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpBackupType = kingpin.Flag(
+			"gpbackup.backup-type",
+			"Specific backup type for collecting metrics. One of: [full, incremental, data-only, metadata-only].",
+		).Default("").String()
+		gpbckpBackupCollectDeleted = kingpin.Flag(
+			"gpbackup.collect-deleted",
+			"Collecting metrics for deleted backups.",
+		).Default("false").Bool()
+		gpbckpBackupCollectFailed = kingpin.Flag(
+			"gpbackup.collect-failed",
+			"Collecting metrics for failed backups.",
+		).Default("false").Bool()
+	)
+	// Set logger config.
+	promslogConfig := &promslog.Config{}
+	// Add flags log.level and log.format from promslog package.
+	flag.AddFlags(kingpin.CommandLine, promslogConfig)
+	kingpin.Version(version.Print(exporterName))
+	// Add short help flag.
+	kingpin.HelpFlag.Short('h')
+	// Load command line arguments.
+	kingpin.Parse()
+	// Setup signal catching.
+	sigs := make(chan os.Signal, 1)
+	// Catch listed signals.
+	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+	// Set logger.
+	logger := promslog.New(promslogConfig)
+	// Method invoked upon seeing signal.
+	go func(logger *slog.Logger) {
+		s := <-sigs
+		logger.Warn(
+			"Stopping exporter",
+			"name", filepath.Base(os.Args[0]),
+			"signal", s)
+		os.Exit(1)
+	}(logger)
+	logger.Info(
+		"Starting exporter",
+		"name", filepath.Base(os.Args[0]),
+		"version", version.Info())
+	logger.Info("Build context", "build_context", version.BuildContext())
+	logger.Info(
+		"History database file path",
+		"file", *gpbckpHistoryFilePath)
+	logger.Info(
+		"Collecting metrics for deleted and failed backups",
+		"deleted", *gpbckpBackupCollectDeleted,
+		"failed", *gpbckpBackupCollectFailed,
+	)
+	if *collectionDepth > 0 {
+		logger.Info(
+			"Metrics depth collection in days",
+			"depth", *collectionDepth)
+	}
+	if strings.Join(*gpbckpIncludeDB, "") != "" {
+		for _, db := range *gpbckpIncludeDB {
+			logger.Info(
+				"Collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if strings.Join(*gpbckpExcludeDB, "") != "" {
+		for _, db := range *gpbckpExcludeDB {
+			logger.Info(
+				"Exclude collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if *gpbckpBackupType != "" {
+		logger.Info(
+			"Collecting metrics for specific backup type",
+			"type", *gpbckpBackupType)
+	}
+	// Setup parameters for exporter.
+	exporter.SetPromPortAndPath(*webAdditionalToolkitFlags, *webPath)
+	logger.Info(
+		"Use exporter parameters",
+		"endpoint", *webPath,
+		"config.file", *webAdditionalToolkitFlags.WebConfigFile,
+	)
+	// Exporter build info metric.
+	prometheus.MustRegister(version_collector.NewCollector(exporterName))
+	// Start web server.
+	exporter.StartPromEndpoint(version.Info(), logger)
+	for {
+		// Get information from gpbackup_history.db.
+		exporter.GetGPBackupInfo(
+			*gpbckpHistoryFilePath,
+			*gpbckpBackupType,
+			*gpbckpBackupCollectDeleted,
+			*gpbckpBackupCollectFailed,
+			*gpbckpIncludeDB,
+			*gpbckpExcludeDB,
+			*collectionDepth,
+			logger,
+		)
+		// Sleep for 'collection.interval' seconds.
+		time.Sleep(time.Duration(*collectionInterval) * time.Second)

Review Comment:
   Should we add a cancel mechanism here



##########
gpbackup_exporter.go:
##########
@@ -0,0 +1,172 @@
+//go:build gpbackup_exporter
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 main
+
+import (
+	"log/slog"
+	"os"
+	"os/signal"
+	"path/filepath"
+	"strings"
+	"syscall"
+	"time"
+
+	"github.com/alecthomas/kingpin/v2"
+	"github.com/apache/cloudberry-backup/exporter"
+	"github.com/prometheus/client_golang/prometheus"
+	version_collector "github.com/prometheus/client_golang/prometheus/collectors/version"
+	"github.com/prometheus/common/promslog"
+	"github.com/prometheus/common/promslog/flag"
+	"github.com/prometheus/common/version"
+	"github.com/prometheus/exporter-toolkit/web/kingpinflag"
+)
+
+const exporterName = "gpbackup_exporter"
+
+func main() {
+	var (
+		webPath = kingpin.Flag(
+			"web.telemetry-path",
+			"Path under which to expose metrics.",
+		).Default("/metrics").String()
+		webAdditionalToolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":19854")
+		collectionInterval        = kingpin.Flag(
+			"collect.interval",
+			"Collecting metrics interval in seconds.",
+		).Default("600").Int()
+		collectionDepth = kingpin.Flag(
+			"collect.depth",
+			"Metrics depth collection in days. Metrics for backup older than this interval will not be collected. 0 - disable.",
+		).Default("0").Int()
+		gpbckpHistoryFilePath = kingpin.Flag(
+			"gpbackup.history-file",
+			"Path to gpbackup_history.db.",
+		).Default("").String()
+		gpbckpIncludeDB = kingpin.Flag(
+			"gpbackup.db-include",
+			"Specific db for collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpExcludeDB = kingpin.Flag(
+			"gpbackup.db-exclude",
+			"Specific db to exclude from collecting metrics. Can be specified several times.",
+		).Default("").PlaceHolder("\"\"").Strings()
+		gpbckpBackupType = kingpin.Flag(
+			"gpbackup.backup-type",
+			"Specific backup type for collecting metrics. One of: [full, incremental, data-only, metadata-only].",
+		).Default("").String()
+		gpbckpBackupCollectDeleted = kingpin.Flag(
+			"gpbackup.collect-deleted",
+			"Collecting metrics for deleted backups.",
+		).Default("false").Bool()
+		gpbckpBackupCollectFailed = kingpin.Flag(
+			"gpbackup.collect-failed",
+			"Collecting metrics for failed backups.",
+		).Default("false").Bool()
+	)
+	// Set logger config.
+	promslogConfig := &promslog.Config{}
+	// Add flags log.level and log.format from promslog package.
+	flag.AddFlags(kingpin.CommandLine, promslogConfig)
+	kingpin.Version(version.Print(exporterName))
+	// Add short help flag.
+	kingpin.HelpFlag.Short('h')
+	// Load command line arguments.
+	kingpin.Parse()
+	// Setup signal catching.
+	sigs := make(chan os.Signal, 1)
+	// Catch listed signals.
+	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+	// Set logger.
+	logger := promslog.New(promslogConfig)
+	// Method invoked upon seeing signal.
+	go func(logger *slog.Logger) {
+		s := <-sigs
+		logger.Warn(
+			"Stopping exporter",
+			"name", filepath.Base(os.Args[0]),
+			"signal", s)
+		os.Exit(1)
+	}(logger)
+	logger.Info(
+		"Starting exporter",
+		"name", filepath.Base(os.Args[0]),
+		"version", version.Info())
+	logger.Info("Build context", "build_context", version.BuildContext())
+	logger.Info(
+		"History database file path",
+		"file", *gpbckpHistoryFilePath)
+	logger.Info(
+		"Collecting metrics for deleted and failed backups",
+		"deleted", *gpbckpBackupCollectDeleted,
+		"failed", *gpbckpBackupCollectFailed,
+	)
+	if *collectionDepth > 0 {
+		logger.Info(
+			"Metrics depth collection in days",
+			"depth", *collectionDepth)
+	}
+	if strings.Join(*gpbckpIncludeDB, "") != "" {
+		for _, db := range *gpbckpIncludeDB {
+			logger.Info(
+				"Collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if strings.Join(*gpbckpExcludeDB, "") != "" {
+		for _, db := range *gpbckpExcludeDB {
+			logger.Info(
+				"Exclude collecting metrics for specific DB",
+				"DB", db)
+		}
+	}
+	if *gpbckpBackupType != "" {
+		logger.Info(
+			"Collecting metrics for specific backup type",
+			"type", *gpbckpBackupType)
+	}
+	// Setup parameters for exporter.
+	exporter.SetPromPortAndPath(*webAdditionalToolkitFlags, *webPath)
+	logger.Info(
+		"Use exporter parameters",
+		"endpoint", *webPath,
+		"config.file", *webAdditionalToolkitFlags.WebConfigFile,
+	)
+	// Exporter build info metric.
+	prometheus.MustRegister(version_collector.NewCollector(exporterName))
+	// Start web server.
+	exporter.StartPromEndpoint(version.Info(), logger)
+	for {
+		// Get information from gpbackup_history.db.
+		exporter.GetGPBackupInfo(
+			*gpbckpHistoryFilePath,
+			*gpbckpBackupType,
+			*gpbckpBackupCollectDeleted,
+			*gpbckpBackupCollectFailed,
+			*gpbckpIncludeDB,
+			*gpbckpExcludeDB,
+			*collectionDepth,
+			logger,
+		)
+		// Sleep for 'collection.interval' seconds.
+		time.Sleep(time.Duration(*collectionInterval) * time.Second)

Review Comment:
   Should we add a cancel mechanism here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3140289549


##########
exporter/README.md:
##########
@@ -0,0 +1,122 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+
+# gpbackup_exporter
+
+**gpbackup_exporter** is a Prometheus exporter for collecting metrics from gpbackup history database (`gpbackup_history.db`).
+
+## Metrics
+### Backup metrics
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_backup_status` | backup status | backup_type, database_name, object_filtering, plugin, timestamp | Values description:<br> `0` - success,<br> `1` - failure.|
+| `gpbackup_backup_deletion_status` | backup deletion status | backup_type, database_name, date_deleted, object_filtering, plugin, timestamp | Values description:<br> `0` - backup still exists,<br> `1` - backup was successfully deleted,<br> `2` - the deletion is in progress,<br> `3` - last delete attempt failed to delete backup from plugin storage,<br> `4` - last delete attempt failed to delete backup from local storage.|
+| `gpbackup_backup_info` | backup info | backup_dir, backup_ver, backup_type, compression_type, database_name, database_ver, object_filtering, plugin, plugin_ver, timestamp, with_statistic | Values description:<br> `1` - info about backup is exist.|
+| `gpbackup_backup_duration_seconds` | backup duration in seconds| backup_type, database_name, end_time, object_filtering, plugin, timestamp ||
+
+### Last backup metrics
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_backup_since_last_completion_seconds`| seconds since the last completed backup | backup_type, database_name ||
+
+### Exporter metrics
+
+| Metric | Description |  Labels | Additional Info |
+| ----------- | ------------------ | ------------- | --------------- |
+| `gpbackup_exporter_build_info` | information about gpbackup exporter | branch, goarch, goos, goversion, revision, tags, version | |
+| `gpbackup_exporter_status` | gpbackup exporter get data status | database_name | Values description:<br> `0` - errors occurred when fetching information from history database,<br> `1` - information successfully fetched from history database. |
+
+## Getting Started
+Available configuration flags:
+
+```bash
+./gpbackup_exporter --help
+usage: gpbackup_exporter [<flags>]
+
+
+Flags:
+  -h, --[no-]help                Show context-sensitive help (also try --help-long and --help-man).
+      --web.telemetry-path="/metrics"  
+                                 Path under which to expose metrics.
+      --web.listen-address=:19854 ...  

Review Comment:
   thanks, fixed in https://github.com/apache/cloudberry-backup/pull/87/commits/131dc823fd4c0e595a91cacddbf14f2cf05d7e29



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] Add gpbackup_exporter — a Prometheus exporter for gpbackup history database. [cloudberry-backup]

Posted by "woblerr (via GitHub)" <gi...@apache.org>.
woblerr commented on code in PR #87:
URL: https://github.com/apache/cloudberry-backup/pull/87#discussion_r3140300969


##########
exporter/gpbckp_exporter.go:
##########
@@ -0,0 +1,188 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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 exporter
+
+import (
+	"log/slog"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/apache/cloudberry-backup/gpbackman/gpbckpconfig"
+	"github.com/apache/cloudberry-backup/history"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	"github.com/prometheus/exporter-toolkit/web"
+)
+
+var (
+	webFlagsConfig web.FlagConfig
+	webEndpoint    string
+)
+
+// SetPromPortAndPath sets HTTP endpoint parameters.
+func SetPromPortAndPath(flagsConfig web.FlagConfig, endpoint string) {
+	webFlagsConfig = flagsConfig
+	webEndpoint = endpoint
+}
+
+// StartPromEndpoint run HTTP endpoint.
+func StartPromEndpoint(version string, logger *slog.Logger) {
+	go func(logger *slog.Logger) {
+		if webEndpoint == "" {
+			logger.Error("Metric endpoint is empty", "endpoint", webEndpoint)
+		}
+		http.Handle(webEndpoint, promhttp.Handler())

Review Comment:
   thanks, fixed in https://github.com/apache/cloudberry-backup/pull/87/commits/6a290903084474c9092c706c4b94c8904c1bfd5d
   
   node_exporter has a similar behavior, but in order not to scare users, it is better to exit correctly, without panic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org