-
Notifications
You must be signed in to change notification settings - Fork 156
PMM-12575 change api for agents #4066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3
Are you sure you want to change the base?
Conversation
- Added validation rules for the new fields in the corresponding validation files. - Improved error handling and logging for agent configuration changes. - Updated related tests to cover new functionality and ensure proper behavior.
Simplified agent parameter updates by replacing `ChangeAgentByType` with `ChangeAgent`. Updated related tests to ensure proper functionality for various agent options and persistence in the database.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v3 #4066 +/- ##
==========================================
+ Coverage 44.16% 45.35% +1.18%
==========================================
Files 369 386 +17
Lines 45306 47390 +2084
==========================================
+ Hits 20009 21492 +1483
- Misses 23610 24136 +526
- Partials 1687 1762 +75
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…andling - Consolidated client mutex locking to ensure thread safety during test server setup. - Simplified the client initialization process for better readability and maintainability.
…e make() for clarity and consistency.
…change agent test files for cleaner code.
…ct format and year for consistency across the codebase.
Replaced redundant `len(*customLabels) > 0` with `len(*customLabels) != 0` for consistency. Removed unnecessary compound conditions to simplify code and improve readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adjust custom labels handling across commands, introduce a new PostgreSQL exporter connection limit flag, and enhance template utilities.
- Refactored
ParseCustomLabels
to accept and return pointers, updating all command usages. - Added
MaxExporterConnections
flag toAddAgentPostgresExporterCommand
. - Extended
base.go
withFormatLogLevel
andFormatCustomLabels
template functions (addedsort
import).
Reviewed Changes
Copilot reviewed 104 out of 104 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
admin/commands/inventory/add_service_external.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_node_remote_rds.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_node_remote.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_node_generic.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_node_container.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_rds_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_qan_postgres_pgstatmonitor_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_qan_postgres_pgstatements_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_qan_mysql_slowlog_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_qan_mysql_perfschema_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_qan_mongodb_profiler_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_proxysql_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_postgres_exporter.go | Updated ParseCustomLabels call; added new flag |
admin/commands/inventory/add_agent_pmm_agent.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_node_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_mysqld_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_mongodb_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/inventory/add_agent_external_exporter.go | Updated ParseCustomLabels call to use pointer |
admin/commands/base_test.go | Adapted tests for pointer-based ParseCustomLabels |
admin/commands/base.go | Changed ParseCustomLabels signature; added imports and template functions |
Comments suppressed due to low confidence (3)
admin/commands/base.go:27
- The new
FormatCustomLabels
function usesfmt.Sprintf
butfmt
is not imported; add"fmt"
to the imports to avoid compilation errors.
import (
admin/commands/base.go:221
- The new
FormatCustomLabels
(andFormatLogLevel
) functions lack unit tests. Consider adding tests to cover these formatting helpers to prevent regressions.
func FormatCustomLabels(labels interface{}) string {
admin/commands/base.go:161
- [nitpick] Using
*map[string]string
is uncommon in Go since maps are reference types. Consider returning amap[string]string
and usingnil
to represent absence for a more idiomatic API.
func ParseCustomLabels(labels *map[string]string) *map[string]string {
PMM-12575
Link to the Feature Build: SUBMODULES-0
If this PR adds or removes or alters one or more API endpoints, please review and add or update the relevant API documents as well:
If this PR is related to some other PRs in this or other repositories, please provide links to those PRs: