Skip to content
Open
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
9 changes: 5 additions & 4 deletions api-tests/inventory/agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ func TestAgents(t *testing.T) {
require.NotEmpty(t, resByAgent.Payload.MysqldExporter, "There should be at least one service")
assertMySQLExporterExists(t, resByAgent, mySqldExporterID)

resByNode, err := client.Default.AgentsService.ListAgents(&agents.ListAgentsParams{
NodeID: pointer.ToString(nodeID),
resAgent, err := client.Default.AgentsService.GetAgent(&agents.GetAgentParams{
AgentID: pmmAgentID,
Context: pmmapitests.Context,
})
require.NoError(t, err)
require.NotNil(t, resByNode)
assertPMMAgentExists(t, resByNode, pmmAgentID)
require.NotNil(t, resAgent)
require.NotNil(t, resAgent.Payload.PMMAgent)
assert.Equal(t, pmmAgentID, resAgent.Payload.PMMAgent.AgentID)
})

t.Run("FilterList", func(t *testing.T) {
Expand Down
10 changes: 9 additions & 1 deletion managed/services/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package telemetry

import (
"context"
"regexp"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -103,13 +104,20 @@ func (s *Service) LocateTelemetryDataSource(name string) (DataSource, error) {
return s.dsRegistry.LocateTelemetryDataSource(name)
}

// Run start sending telemetry to SaaS.
// releaseVersionRe matches only clean release versions like "3.7.0" or "3.7".
var releaseVersionRe = regexp.MustCompile(`^\d+\.\d+(\.\d+)?$`)

// Run sends telemetry.
func (s *Service) Run(ctx context.Context) {
if !s.config.Enabled {
s.l.Warn("service is disabled, skip Run")
return
}

if !releaseVersionRe.MatchString(s.pmmVersion) {
return
}

ticker := time.NewTicker(s.config.Reporting.Interval)
defer ticker.Stop()

Expand Down
2 changes: 1 addition & 1 deletion managed/services/telemetry/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func TestRunTelemetryService(t *testing.T) {
start: tt.fields.start,
config: tt.fields.config,
dsRegistry: registry,
pmmVersion: "",
pmmVersion: tt.fields.pmmVersion,
os: tt.fields.os,
sDistributionMethod: 0,
tDistributionMethod: 0,
Expand Down
Loading