Skip to content

Commit

Permalink
PMM-12375 follow up on review
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Oct 2, 2023
1 parent de16f65 commit 2c8cdd3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion managed/services/agents/connection_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (c *ConnectionChecker) CheckConnectionToService(ctx context.Context, q *ref
switch service.ServiceType {
case models.MySQLServiceType:
// TODO: remove the whole block after v3 release.
isSibSupported, err := isServiceInfoBrokerSupported(q, pmmAgentID)
isSibSupported, err := isServiceInfoBrokerSupported(agent)
if err != nil {
l.Warnf("Failed to check if SIB is supported: %s.", err)
}
Expand Down
18 changes: 7 additions & 11 deletions managed/services/agents/service_info_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,13 @@ func (c *ServiceInfoBroker) GetInfoFromService(ctx context.Context, q *reform.Qu
}
}()

// External exporters and haproxy do not support this functionality.
if service.ServiceType == models.ExternalServiceType || service.ServiceType == models.HAProxyServiceType {
return nil
}

pmmAgentID := pointer.GetString(agent.PMMAgentID)
isSibSupported, err := isServiceInfoBrokerSupported(q, pmmAgentID)
isSibSupported, err := isServiceInfoBrokerSupported(agent)
if err != nil {
return err
}
Expand All @@ -143,11 +148,6 @@ func (c *ServiceInfoBroker) GetInfoFromService(ctx context.Context, q *reform.Qu
return nil
}

// External exporters and haproxy do not support this functionality.
if service.ServiceType == models.ExternalServiceType || service.ServiceType == models.HAProxyServiceType {
return nil
}

pmmAgent, err := c.r.get(pmmAgentID)
if err != nil {
return err
Expand Down Expand Up @@ -218,11 +218,7 @@ func updateServiceVersion(ctx context.Context, q *reform.Querier, resp agentpb.A
return nil
}

func isServiceInfoBrokerSupported(q *reform.Querier, pmmAgentID string) (bool, error) {
pmmAgent, err := models.FindAgentByID(q, pmmAgentID)
if err != nil {
return false, fmt.Errorf("failed to get PMM Agent: %w", err)
}
func isServiceInfoBrokerSupported(pmmAgent *models.Agent) (bool, error) {
pmmAgentVersion, err := version.Parse(*pmmAgent.Version)
if err != nil {
return false, fmt.Errorf("failed to parse PMM agent version %q: %w", *pmmAgent.Version, err)
Expand Down

0 comments on commit 2c8cdd3

Please sign in to comment.