yugabyte / yb-tools

Tools for YugabyteDB database maintenance and support
Apache License 2.0
19 stars 18 forks source link

promdump: default tar filename has extra dash in custom metric mode #134

Open ionthegeek opened 4 months ago

ionthegeek commented 4 months ago

When specifying --metric and --out to run in manual mode, the generated tar filename still includes both the dashes that would appear between the node prefix value and the other segments of the filename:

user@host:~$ ./promdump --end_time="2024-07-17T12:34:56Z" --debug --metric='{}' --out=custom
2024/07/16 15:43:34 promdump.go:892: promdump version DEV BUILD from commit POPULATED_BY_BUILD built POPULATED_BY_BUILD
2024/07/16 15:43:34 promdump.go:916: main: using the following flags: --debug=true --end_time=2024-07-17T12:34:56Z --metric={} --out=custom
2024/07/16 15:43:34 promdump.go:919: main: logging to file 'promdump.log'
2024/07/16 15:43:34 promdump.go:1032: Warning: The --node_prefix flag is deprecated. It is recommended to provide a --yba_api_token and use --universe_name or --universe_uuid instead.
2024/07/16 15:43:34 promdump.go:1086: main: not filtering by exported_instance
2024/07/16 15:43:34 promdump.go:205: main: skipping the following Yugabyte metrics: cql_export, master_export, node_export, platform, prometheus, tserver_export, ysql_export
2024/07/16 15:43:34 promdump.go:208: main: collecting the following custom metric: '{}'
2024/07/16 15:43:34 promdump.go:1103: main: tar bundling enabled
2024/07/16 15:43:34 promdump.go:1107: main: no --tar_filename specified; using filename 'promdump--20240716-154334.tar.gz'

The generateDefaultTarFilename() func should be updated to handle this case.