Skip to content

PMM-12832 Add exporter connection timeout to DSN/config based exporters.#5275

Open
JiriCtvrtka wants to merge 19 commits intov3from
PMM-12832-connection-timeout
Open

PMM-12832 Add exporter connection timeout to DSN/config based exporters.#5275
JiriCtvrtka wants to merge 19 commits intov3from
PMM-12832-connection-timeout

Conversation

@JiriCtvrtka
Copy link
Copy Markdown
Contributor

@JiriCtvrtka JiriCtvrtka commented Apr 21, 2026

PMM-12832

FB: Percona-Lab/pmm-submodules#4310

New separated PR for connection timeouts for exporters based on DSN/config.

Support connection timeout configuration for DB-backed exporters where the timeout is applied to DSN generation or exporter DB connection config. This includes MySQL, MongoDB, PostgreSQL, ProxySQL, Valkey, and service flows that propagate the timeout to MySQL/PostgreSQL exporters behind RDS and Azure database monitoring.


Note

Medium Risk
Adds a new connection_timeout field to inventory protobuf APIs and wires it through multiple add/change CLI flows, so mismatched server/client versions or incorrect duration formatting could break exporter provisioning.

Overview
Adds a new optional connection_timeout setting for DB-backed exporters (MySQL, MongoDB, PostgreSQL, ProxySQL, Valkey) and threads it through the pmm-admin add/change agent/service commands.

Introduces a shared DurationString helper (with tests) to serialize Go time.Duration flags into the API-friendly seconds format, and updates generated inventory protobufs/validators to include and validate the new connection_timeout duration field.

Reviewed by Cursor Bugbot for commit 7b1d33f. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 66.55405% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.97%. Comparing base (c350f39) to head (7b1d33f).

Files with missing lines Patch % Lines
managed/models/agent_model.go 76.36% 23 Missing and 3 partials ⚠️
managed/services/inventory/agents.go 69.69% 20 Missing ⚠️
managed/services/converters.go 18.18% 18 Missing ⚠️
admin/commands/management/add_valkey.go 0.00% 8 Missing ⚠️
.../commands/inventory/add_agent_postgres_exporter.go 0.00% 7 Missing ⚠️
...n/commands/inventory/add_agent_mongodb_exporter.go 0.00% 2 Missing ⚠️
...in/commands/inventory/add_agent_mysqld_exporter.go 0.00% 2 Missing ⚠️
.../commands/inventory/add_agent_proxysql_exporter.go 0.00% 2 Missing ⚠️
admin/commands/management/add_mongodb.go 0.00% 2 Missing ⚠️
admin/commands/management/add_mysql.go 0.00% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #5275      +/-   ##
==========================================
+ Coverage   42.10%   42.97%   +0.86%     
==========================================
  Files         410      412       +2     
  Lines       41992    42073      +81     
==========================================
+ Hits        17682    18082     +400     
+ Misses      22526    22148     -378     
- Partials     1784     1843      +59     
Flag Coverage Δ
admin 34.94% <26.82%> (+0.04%) ⬆️
agent 49.22% <ø> (+0.11%) ⬆️
managed 41.93% <72.94%> (+1.30%) ⬆️
vmproxy 72.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread admin/commands/config.go

if cmd.LogLevelFatalFlags.LogLevel != "" {
res = append(res, fmt.Sprintf("--log-level=%s", cmd.LogLevelFatalFlags.LogLevel))
if cmd.LogLevel != "" {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Linter issue from original PR, there and in admin commands.

Comment on lines 121 to +123
int32 max_postgresql_exporter_connections = 33;
// Connection timeout for exporter (if set).
google.protobuf.Duration connection_timeout = 35 [(validate.rules).duration = {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

34 is not missed, it is above.

Comment thread admin/commands/helpers.go
Comment on lines +23 to +29
func DurationString(value *time.Duration) string {
if value == nil {
return ""
}

return strconv.FormatFloat(value.Seconds(), 'f', -1, 64) + "s"
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fix for #5134 (comment)

@JiriCtvrtka
Copy link
Copy Markdown
Contributor Author

Latest comments from Max on original PR are applied: #5134 (comment) and #5134 (comment)

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ca21749. Configure here.

Comment thread admin/commands/inventory/change_agent_mongodb_exporter.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants