Skip to content
Open
Binary file modified api/descriptor.bin
Binary file not shown.
20 changes: 16 additions & 4 deletions api/management/v1/azure.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/management/v1/azure.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/management/v1/azure.proto
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ message AddAzureDatabaseRequest {
google.protobuf.Duration connection_timeout = 26 [(validate.rules).duration = {
gte: {seconds: 0}
}];
// The pmm-agent identifier which should run agents. Defaults to the PMM Server's own pmm-agent.
string pmm_agent_id = 27;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

message AddAzureDatabaseResponse {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions api/management/v1/json/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
Comment on lines +807 to +809

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Align both descriptions with the enforced eligibility rule.

The current text states that internal nodes must not host user monitoring workloads. The stated behavior permits local-address monitoring. Document the remote-address delegation restriction instead.

  • api/management/v1/json/v1.json#L807-L809: update the ListNodes description.
  • api/management/v1/json/v1.json#L1369-L1371: update the GetNode description.
📍 Affects 1 file
  • api/management/v1/json/v1.json#L807-L809 (this comment)
  • api/management/v1/json/v1.json#L1369-L1371
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/management/v1/json/v1.json` around lines 807 - 809, Update the
is_pmm_internal_node descriptions in ListNodes at
api/management/v1/json/v1.json:807-809 and GetNode at
api/management/v1/json/v1.json:1369-1371 to state that internal nodes must not
receive delegated monitoring for remote addresses, while preserving that
local-address monitoring is permitted.

"x-order": 19
}
}
},
Expand Down Expand Up @@ -1360,6 +1365,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
"x-order": 19
}
},
"x-order": 0
Expand Down Expand Up @@ -7131,6 +7141,11 @@
"description": "Connection timeout for exporter (if set).",
"type": "string",
"x-order": 25
},
"pmm_agent_id": {
"description": "The pmm-agent identifier which should run agents. Defaults to the PMM Server's own pmm-agent.",
"type": "string",
"x-order": 26
}
}
}
Expand Down
19 changes: 15 additions & 4 deletions api/management/v1/node.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/management/v1/node.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/management/v1/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ message UniversalNode {
string instance_id = 18;
// True if this node is a PMM Server node (HA mode).
bool is_pmm_server_node = 19;
// True if this node belongs to the internal infrastructure of a PMM deployment
// (e.g. the HA persistence layer) and must not host user monitoring workloads.
bool is_pmm_internal_node = 20;
}

message ListNodesRequest {
Expand Down
15 changes: 15 additions & 0 deletions api/swagger/swagger-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -22326,6 +22326,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
"x-order": 19
}
}
},
Expand Down Expand Up @@ -22883,6 +22888,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
"x-order": 19
}
},
"x-order": 0
Expand Down Expand Up @@ -28654,6 +28664,11 @@
"description": "Connection timeout for exporter (if set).",
"type": "string",
"x-order": 25
},
"pmm_agent_id": {
"description": "The pmm-agent identifier which should run agents. Defaults to the PMM Server's own pmm-agent.",
"type": "string",
"x-order": 26
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -21353,6 +21353,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
"x-order": 19
}
}
},
Expand Down Expand Up @@ -21910,6 +21915,11 @@
"description": "True if this node is a PMM Server node (HA mode).",
"type": "boolean",
"x-order": 18
},
"is_pmm_internal_node": {
"description": "True if this node belongs to the internal infrastructure of a PMM deployment\n(e.g. the HA persistence layer) and must not host user monitoring workloads.",
"type": "boolean",
"x-order": 19
}
},
"x-order": 0
Expand Down Expand Up @@ -27681,6 +27691,11 @@
"description": "Connection timeout for exporter (if set).",
"type": "string",
"x-order": 25
},
"pmm_agent_id": {
"description": "The pmm-agent identifier which should run agents. Defaults to the PMM Server's own pmm-agent.",
"type": "string",
"x-order": 26
Comment on lines +27695 to +27698

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Describe the selected exporter in pmm_agent_id.

pmm_agent_id selects the PMM agent that runs Azure exporters. The current description says “should run agents,” which can mislead API clients. Update the source .proto description, then regenerate this file.

As per path instructions, generated Swagger files must not be edited manually; update the source .proto and regenerate them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/swagger/swagger.json` around lines 27695 - 27698, Update the source
.proto field corresponding to pmm_agent_id so its description clearly states
that it identifies the selected PMM agent running Azure exporters, then
regenerate api/swagger/swagger.json using the project’s prescribed generation
process; do not edit the generated Swagger file directly.

Source: Path instructions

}
}
}
Expand Down
21 changes: 21 additions & 0 deletions managed/cmd/pmm-managed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ type gRPCServerDeps struct {
versionCache *versioncache.Service
vmdb *victoriametrics.Service
vmalert *vmalert.Service
internalNodePrefixes []string
}

// parseNodeNamePrefixes splits a comma-separated list of Node name prefixes.
func parseNodeNamePrefixes(value string) []string {
var prefixes []string
for p := range strings.SplitSeq(value, ",") {
p = strings.TrimSpace(p)
if p != "" {
prefixes = append(prefixes, p)
}
}

return prefixes
}

// runGRPCServer runs gRPC server until context is canceled, then gracefully stops it.
Expand Down Expand Up @@ -304,6 +318,7 @@ func runGRPCServer(ctx context.Context, deps *gRPCServerDeps) {
deps.db, deps.agentsRegistry, deps.agentsStateUpdater,
deps.connectionCheck, deps.serviceInfoBroker, deps.vmdb,
deps.versionCache, deps.grafanaClient, v1.NewAPI(*deps.vmClient),
deps.internalNodePrefixes,
)

managementv1.RegisterManagementServiceServer(gRPCServer, managementSvc)
Expand Down Expand Up @@ -743,6 +758,11 @@ func main() { //nolint:gocognit,maintidx,cyclop
Default("9762").
Int()

internalNodePrefixesF := kingpin.Flag("internal-node-name-prefixes",
"Comma-separated list of Node name prefixes reserved for the internal infrastructure of this PMM deployment").
Envar("PMM_INTERNAL_NODE_NAME_PREFIXES").
String()

supervisordConfigDirF := kingpin.Flag("supervisord-config-dir", "Supervisord configuration directory").Required().String()

logLevelF := kingpin.Flag("log-level", "Set logging level").Envar("PMM_LOG_LEVEL").Default("info").Enum("trace", "debug", "info", "warn", "error", "fatal")
Expand Down Expand Up @@ -1196,6 +1216,7 @@ func main() { //nolint:gocognit,maintidx,cyclop
grafanaClient: grafanaClient,
handler: agentsHandler,
ha: haService,
internalNodePrefixes: parseNodeNamePrefixes(*internalNodePrefixesF),
jobsService: jobsService,
minioClient: minioClient,
pbmPITRService: pbmPITRService,
Expand Down
14 changes: 14 additions & 0 deletions managed/cmd/pmm-managed/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,17 @@ func formatPkgName(t *testing.T, name string) string {

return name
}

func TestParseNodeNamePrefixes(t *testing.T) {
for _, tc := range []struct {
value string
expected []string
}{
{value: "", expected: nil},
{value: ",,", expected: nil},
{value: "pmm-pmm-ha-pg-db-", expected: []string{"pmm-pmm-ha-pg-db-"}},
{value: " pmm-pmm-ha-pg-db- , pmm-pmm-ha-ch- ", expected: []string{"pmm-pmm-ha-pg-db-", "pmm-pmm-ha-ch-"}},
} {
assert.Equal(t, tc.expected, parseNodeNamePrefixes(tc.value), tc.value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestAddServiceExporterTimeout(t *testing.T) {
vmClient.AssertExpectations(t)
})

s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient)
s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient, nil)
want := durationpb.New(17 * time.Second)

t.Run("MySQL", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion managed/services/management/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func setup(t *testing.T) (context.Context, *ManagementService, func(t *testing.T
vmClient.AssertExpectations(t)
}

s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient)
s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient, nil)

return ctx, s, teardown
}
Expand Down
2 changes: 1 addition & 1 deletion managed/services/management/annotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestAnnotations(t *testing.T) {
vmClient := &mockVictoriaMetricsClient{}
vmClient.Test(t)

s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient)
s := NewManagementService(db, ar, state, cc, sib, vmdb, vc, grafanaClient, vmClient, nil)

teardown := func(t *testing.T) {
t.Helper()
Expand Down
Loading
Loading