Skip to content

Commit

Permalink
Handled empty types array
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrytfleung committed Jun 27, 2024
1 parent 730cfc9 commit 999a7ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions collector/receiver/telemetryapireceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ func (r *telemetryAPIReceiver) Start(ctx context.Context, host component.Host) e
}()

telemetryClient := telemetryapi.NewClient(r.logger)
_, err := telemetryClient.Subscribe(ctx, r.types, r.extensionID, fmt.Sprintf("http://%s/", address))
if err != nil {
r.logger.Info("Listening for requests", zap.String("address", address), zap.String("extensionID", r.extensionID))
return err
if len(r.types) > 0 {
_, err := telemetryClient.Subscribe(ctx, r.types, r.extensionID, fmt.Sprintf("http://%s/", address))
if err != nil {
r.logger.Info("Listening for requests", zap.String("address", address), zap.String("extensionID", r.extensionID))
return err
}
}
return nil
}
Expand Down

0 comments on commit 999a7ce

Please sign in to comment.