Skip to content

Commit

Permalink
[receiver/cloudfoundryreceiver] Move shardID check to validate in the…
Browse files Browse the repository at this point in the history
… config

Co-authored-by: Jose Riguera <[email protected]>
Co-authored-by: Sam Clulow <[email protected]>
  • Loading branch information
3 people committed May 2, 2024
1 parent 73cde8d commit 37b090f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions receiver/cloudfoundryreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/url"
"strings"

"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configopaque"
Expand Down Expand Up @@ -47,6 +48,10 @@ func (c *Config) Validate() error {
return err
}

if strings.TrimSpace(c.RLPGateway.ShardID) == "" {
return errors.New("shardID cannot be empty")
}

err = validateURLOption("uaa.endpoint", c.UAA.Endpoint)
if err != nil {
return err
Expand Down
5 changes: 0 additions & 5 deletions receiver/cloudfoundryreceiver/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"net/http"
"strings"

"code.cloudfoundry.org/go-loggregator"
"code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2"
Expand Down Expand Up @@ -49,10 +48,6 @@ func (rgc *EnvelopeStreamFactory) CreateStream(
ctx context.Context,
shardID string) (loggregator.EnvelopeStream, error) {

if strings.TrimSpace(shardID) == "" {
return nil, errors.New("shardID cannot be empty")
}

stream := rgc.rlpGatewayClient.Stream(ctx, &loggregator_v2.EgressBatchRequest{
ShardId: shardID,
Selectors: []*loggregator_v2.Selector{
Expand Down

0 comments on commit 37b090f

Please sign in to comment.