Skip to content

Conversation

nantiferov
Copy link
Contributor

@nantiferov nantiferov commented Aug 28, 2025

  • Add include-go-runtime-metrics flag to enable Go runtime metrics, default disabled
  • Add test suite for inclGoRuntimeMetrics to main_test.go
  • Fix description for redisMetricsOnly flag

Fix #1034

@nantiferov nantiferov marked this pull request as draft August 28, 2025 20:50
@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 32edc40 to 32b83c3 Compare August 28, 2025 20:53
@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 32b83c3 to 0b6d145 Compare August 28, 2025 20:57
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.96%. Comparing base (7632b7b) to head (02b2548).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
main.go 70.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1035      +/-   ##
==========================================
- Coverage   82.11%   81.96%   -0.15%     
==========================================
  Files          19       19              
  Lines        3013     3017       +4     
==========================================
- Hits         2474     2473       -1     
- Misses        427      431       +4     
- Partials      112      113       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coveralls
Copy link

coveralls commented Aug 28, 2025

Pull Request Test Coverage Report for Build 17541633306

Details

  • 7 of 10 (70.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 85.757%

Changes Missing Coverage Covered Lines Changed/Added Lines %
main.go 7 10 70.0%
Totals Coverage Status
Change from base Build 17511383157: -0.01%
Covered Lines: 2595
Relevant Lines: 3026

💛 - Coveralls

@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 0b6d145 to 2e15fe2 Compare September 2, 2025 18:43
@nantiferov nantiferov marked this pull request as ready for review September 2, 2025 18:44
README.md Outdated
@@ -186,7 +186,8 @@ scrape_configs:
| connection-timeout | REDIS_EXPORTER_CONNECTION_TIMEOUT | Timeout for connection to Redis instance, defaults to "15s" (in Golang duration format) |
| web.listen-address | REDIS_EXPORTER_WEB_LISTEN_ADDRESS | Address to listen on for web interface and telemetry, defaults to `0.0.0.0:9121`. |
| web.telemetry-path | REDIS_EXPORTER_WEB_TELEMETRY_PATH | Path under which to expose metrics, defaults to `/metrics`. |
| redis-only-metrics | REDIS_EXPORTER_REDIS_ONLY_METRICS | Whether to also export go runtime metrics, defaults to false. |
| redis-only-metrics | REDIS_EXPORTER_REDIS_ONLY_METRICS | Whether to export only Redis metrics (omit Go runtime metrics), defaults to false. |
| extended-go-metrics | REDIS_EXPORTER_EXTENDED_GO_METRICS | Whether to export all Go runtime metrics, defaults to false. |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard 😅

Wdyt if this option renamed to enable-go-runtime-metrics or include-go-runtime-metrics or go-runtime-metrics?

I don't think they're extended. We're basically either collecting redis_exporter process metrics, which are technically Go runtime metrics, but they could be called just process metrics.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! i like that.
you're right, we got Golang runtime metrics, and then we got "process metrics"

I like include-go-runtime-metrics - what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think it sounds good.

Changed PR with renamed variables, PTAL when have time.

@oliver006
Copy link
Owner

Thanks for this PR - I'm super swamped this week but will try to review it as soon as possible.

@nantiferov
Copy link
Contributor Author

Thank you. No worries, it's not urgent.

Copy link
Owner

@oliver006 oliver006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your thinking about runtime metrics (instead of "extended") vs process metrics, that makes sense, let's do that

code change itself looks good

main.go Outdated
@@ -124,15 +124,19 @@ func setupLogging(isDebug bool, logLevel, logFormat string) error {
}

// createPrometheusRegistry creates and configures a Prometheus registry
func createPrometheusRegistry(redisMetricsOnly bool) *prometheus.Registry {
func createPrometheusRegistry(redisMetricsOnly, extendedGoMetrics bool) *prometheus.Registry {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotta rename this if we go with "runtime metrics"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, done

@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 2e15fe2 to 68f9414 Compare September 7, 2025 20:20
@nantiferov nantiferov changed the title Feature: add extendedGoMetrics flag to include all Go runtime metrics Feature: add include-go-runtime-metrics flag to enable Go runtime metrics Sep 7, 2025
@@ -209,9 +210,9 @@ scrape_configs:
| check-key-groups | REDIS_EXPORTER_CHECK_KEY_GROUPS | Comma separated list of [LUA regexes](https://www.lua.org/pil/20.1.html) for classifying keys into groups. The regexes are applied in specified order to individual keys, and the group name is generated by concatenating all capture groups of the first regex that matches a key. A key will be tracked under the `unclassified` group if none of the specified regexes matches it. |
| max-distinct-key-groups | REDIS_EXPORTER_MAX_DISTINCT_KEY_GROUPS | Maximum number of distinct key groups that can be tracked independently *per Redis database*. If exceeded, only key groups with the highest memory consumption within the limit will be tracked separately, all remaining key groups will be tracked under a single `overflow` key group. |
| config-command | REDIS_EXPORTER_CONFIG_COMMAND | What to use for the CONFIG command, defaults to `CONFIG`, , set to "-" to skip config metrics extraction. |
| basic-auth-username | REDIS_EXPORTER_BASIC_AUTH_USERNAME | Username for Basic Authentication with the redis exporter needs to be set together with basic-auth-password to be effective
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is related to trailing spaces I think. My editor automatically removed them.
Can rollback this one if needed.

@@ -378,4 +379,3 @@ Or you can bring up the stack, run the tests, and then tear down the stack, all
## Communal effort

Open an issue or PR if you have more suggestions, questions or ideas about what to add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editor also removed extra newline here. Can rollback as well.

@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 68f9414 to 14e32f5 Compare September 7, 2025 20:26
README.md Outdated
@@ -186,7 +186,8 @@ scrape_configs:
| connection-timeout | REDIS_EXPORTER_CONNECTION_TIMEOUT | Timeout for connection to Redis instance, defaults to "15s" (in Golang duration format) |
| web.listen-address | REDIS_EXPORTER_WEB_LISTEN_ADDRESS | Address to listen on for web interface and telemetry, defaults to `0.0.0.0:9121`. |
| web.telemetry-path | REDIS_EXPORTER_WEB_TELEMETRY_PATH | Path under which to expose metrics, defaults to `/metrics`. |
| redis-only-metrics | REDIS_EXPORTER_REDIS_ONLY_METRICS | Whether to also export go runtime metrics, defaults to false. |
| redis-only-metrics | REDIS_EXPORTER_REDIS_ONLY_METRICS | Whether to export only Redis metrics (omit Go process+runtime metrics), defaults to false. |
| include-go-runtime-metrics | REDIS_INCLUDE_GO_RUNTIME_METRICS | Whether to include Go runtime metrics, defaults to false. |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REDIS_INCLUDE_GO_RUNTIME_METRICS -> REDIS_EXPORTER_INCLUDE_GO_RUNTIME_METRICS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you 👍

main.go Outdated
@@ -174,7 +178,8 @@ func main() {
exportClientList = flag.Bool("export-client-list", getEnvBool("REDIS_EXPORTER_EXPORT_CLIENT_LIST", false), "Whether to scrape Client List specific metrics")
exportClientPort = flag.Bool("export-client-port", getEnvBool("REDIS_EXPORTER_EXPORT_CLIENT_PORT", false), "Whether to include the client's port when exporting the client list. Warning: including the port increases the number of metrics generated and will make your Prometheus server take up more memory")
showVersion = flag.Bool("version", false, "Show version information and exit")
redisMetricsOnly = flag.Bool("redis-only-metrics", getEnvBool("REDIS_EXPORTER_REDIS_ONLY_METRICS", false), "Whether to also export go runtime metrics")
redisMetricsOnly = flag.Bool("redis-only-metrics", getEnvBool("REDIS_EXPORTER_REDIS_ONLY_METRICS", false), "Whether to export only Redis metrics (omit Go process+runtime metrics)")
inclGoRuntimeMetrics = flag.Bool("include-go-runtime-metrics", getEnvBool("REDIS_INCLUDE_GO_RUNTIME_METRICS", false), "Whether to include Go runtime metrics")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

REDIS_EXPORTER_INCLUDE_GO_RUNTIME_METRICS

@oliver006
Copy link
Owner

PR looks good, just change REDIS_INCLUDE_GO_RUNTIME_METRICS to REDIS_EXPORTER_INCLUDE_GO_RUNTIME_METRICS
and we should be good to go.

@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from 14e32f5 to adb19af Compare September 8, 2025 06:08
@nantiferov nantiferov requested a review from oliver006 September 8, 2025 06:08
…rics

* Add include-go-runtime-metrics flag to enable Go runtime metrics, default disabled
* Add test suite for inclGoRuntimeMetrics to main_test.go
* Fix description for redisMetricsOnly flag

Fix oliver006#1034
@nantiferov nantiferov force-pushed the Feature--add-extendedGoMetrics-flag-to-include-all-Go-runtime-metrics branch from adb19af to 02b2548 Compare September 8, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add separate cmdline flag to include all Go runtime metrics
3 participants