Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiangreco committed Nov 25, 2024
1 parent 51b632c commit 36f503e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ func (c *ConnectionInfo) Start(ctx context.Context) error {
return err
}

var providerName, providerRegion, dbInstanceIdentifier string
var (
providerName = "unknown"
providerRegion = "unknown"
dbInstanceIdentifier = "unknown"
)

host, _, err := net.SplitHostPort(cfg.Addr)
if err == nil && host != "" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestConnectionInfo(t *testing.T) {
{
name: "generic dsn",
dsn: "user:pass@tcp(localhost:3306)/db",
expectedMetrics: fmt.Sprintf(baseExpectedMetrics, "", "", ""),
expectedMetrics: fmt.Sprintf(baseExpectedMetrics, "unknown", "unknown", "unknown"),
},
{
name: "AWS/RDS dsn",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (c *QuerySample) Start(ctx context.Context) error {
for {
if err := c.fetchQuerySamples(c.ctx); err != nil {
level.Error(c.logger).Log("msg", "collector stopping due to error", "err", err)
c.Stop()
break
}

Expand All @@ -83,7 +84,6 @@ func (c *QuerySample) Start(ctx context.Context) error {
}
}()

c.Stop()
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (c *SchemaTable) Start(ctx context.Context) error {
for {
if err := c.extractSchema(c.ctx); err != nil {
level.Error(c.logger).Log("msg", "collector stopping due to error", "err", err)
c.Stop()
break
}

Expand All @@ -114,7 +115,6 @@ func (c *SchemaTable) Start(ctx context.Context) error {
}
}()

c.Stop()
return nil
}

Expand Down

0 comments on commit 36f503e

Please sign in to comment.