Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion models/agent_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import (

//go:generate reform

// AgentType represents Agent type as stored in database.
// AgentType represents Agent type as stored in databases:
// pmm-managed's PostgreSQL, qan-api's ClickHouse, and Prometheus.
type AgentType string

// Agent types (in the same order as in agents.proto).
Expand Down
3 changes: 2 additions & 1 deletion models/node_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import (

//go:generate reform

// NodeType represents Node type as stored in database.
// NodeType represents Node type as stored in databases:
// pmm-managed's PostgreSQL, qan-api's ClickHouse, and Prometheus.
type NodeType string

// Node types (in the same order as in nodes.proto).
Expand Down
3 changes: 2 additions & 1 deletion models/service_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (

//go:generate reform

// ServiceType represents Service type as stored in database.
// ServiceType represents Service type as stored in databases:
// pmm-managed's PostgreSQL, qan-api's ClickHouse, and Prometheus.
type ServiceType string

// Service types (in the same order as in services.proto).
Expand Down
9 changes: 7 additions & 2 deletions services/qan/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func mergeLabels(node *models.Node, service *models.Service, agent *models.Agent
return res, nil
}

// Collect adds custom labels to the data from pmm-agent and sends it to qan-api.
// Collect adds labels to the data from pmm-agent and sends it to qan-api.
func (c *Client) Collect(ctx context.Context, req *qanpb.CollectRequest) error {
// TODO That code is simple, but performance will be very bad for any non-trivial load.
// https://jira.percona.com/browse/PMM-3894
Expand Down Expand Up @@ -137,11 +137,16 @@ func (c *Client) Collect(ctx context.Context, req *qanpb.CollectRequest) error {
"region": &m.Region,
"node_model": &m.NodeModel,
"container_name": &m.ContainerName,
"agent_id": &m.AgentId,
} {
value := labels[labelName]
delete(labels, labelName)
if *field != "" {
c.l.Errorf("%q wasn't empty: overwriting %q with %q.", labelName, *field, value)
if *field == value {
c.l.Debugf("%q is not empty, but has the same value %q.", labelName, *field)
} else {
c.l.Warnf("%q is not empty: overwriting %q with %q.", labelName, *field, value)
}
}
*field = value
}
Expand Down