Skip to content

Commit dbb0893

Browse files
authored
PMM-13967 Add support for ClickHouse and VM URLs in dump service (#3978)
* PMM-13967 Add support for ClickHouse and VM URLs in dump service Enhanced the dump service to accept ClickHouse and VictoriaMetrics URLs. Updated the constructor and related logic to utilize these URLs for exports. Modified initialization in main.go to provide the required URL values. * PMM-13967: Add URLs struct documentation comment Added a comment to document the purpose of the URLs struct in dump.go. This improves code clarity and helps developers understand its usage. * PMM-13967 Update flag name for VictoriaMetrics URL in dump service Renamed the CLI flag from "--vm-url" to "--victoria-metrics-url" to improve clarity and alignment with naming conventions. This change ensures flag names are more descriptive and consistent.
1 parent 4dd578b commit dbb0893

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

managed/cmd/pmm-managed/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,10 @@ func main() { //nolint:maintidx,cyclop
955955
schedulerService := scheduler.New(db, backupService)
956956
versionCache := versioncache.New(db, versioner)
957957

958-
dumpService := dump.New(db)
958+
dumpService := dump.New(db, &dump.URLs{
959+
ClickhouseURL: chURI.String(),
960+
VMURL: *victoriaMetricsURLF,
961+
})
959962

960963
serverParams := &server.Params{
961964
DB: db,

managed/services/dump/dump.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ const (
4545
dumpsDir = "/srv/dump"
4646
)
4747

48+
// URLs contains the URLs for Clickhouse and VictoriaMetrics.
49+
type URLs struct {
50+
ClickhouseURL string
51+
VMURL string
52+
}
53+
4854
// Service represents the dump service.
4955
type Service struct {
5056
l *logrus.Entry
5157

52-
db *reform.DB
58+
db *reform.DB
59+
urls *URLs
5360

5461
running atomic.Bool
5562

@@ -58,10 +65,11 @@ type Service struct {
5865
}
5966

6067
// New creates a new instance of the dump service..
61-
func New(db *reform.DB) *Service {
68+
func New(db *reform.DB, urls *URLs) *Service {
6269
return &Service{
63-
l: logrus.WithField("component", "services/dump"),
64-
db: db,
70+
l: logrus.WithField("component", "services/dump"),
71+
db: db,
72+
urls: urls,
6573
}
6674
}
6775

@@ -109,6 +117,8 @@ func (s *Service) StartDump(params *Params) (string, error) {
109117
pmmDumpBin,
110118
"export",
111119
"--pmm-url=http://127.0.0.1:8080",
120+
"--click-house-url="+s.urls.ClickhouseURL,
121+
"--victoria-metrics-url="+s.urls.VMURL,
112122
fmt.Sprintf("--dump-path=%s", getDumpFilePath(dump.ID)))
113123

114124
if params.APIKey != "" {

0 commit comments

Comments
 (0)