Skip to content

Commit

Permalink
clean up debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddowker committed Jun 6, 2024
1 parent 29f8aea commit 10f1846
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
14 changes: 3 additions & 11 deletions broker/client/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,10 @@ func (r *Reader) Read(p []byte) (n int, err error) {

// If the frame preceding EOF provided a fragment URL, open it directly.
if !r.Request.MetadataOnly && r.Response.Status == pb.Status_OK && r.Response.FragmentUrl != "" {
log.WithFields(log.Fields{
"FragmentUrl": r.Response.FragmentUrl,
}).Warn("reader handle FragmentUrl")
if TransformSignedURLs {
if SkipSignedURLs {
fragURL := r.Response.Fragment.BackingStore.URL()
log.WithFields(log.Fields{
"url": fmt.Sprintf("%+v", fragURL),
"fragment": fmt.Sprintf("%+v", *r.Response.Fragment),
"offset": r.Request.Offset,
}).Warn("reader handle url")
if fragURL.Scheme != "gs" {
return 0, fmt.Errorf("TransformSignedURL unsupported scheme: %s", fragURL.Scheme)
return 0, fmt.Errorf("SkipSignedURL unsupported scheme: %s", fragURL.Scheme)
}
if r.direct, err = OpenUnsignedFragmentURL(r.ctx, *r.Response.Fragment,
r.Request.Offset, fragURL); err == nil {
Expand Down Expand Up @@ -466,7 +458,7 @@ var (
// stores_test.go, which is in broker/fragment, imports broker/client so we cannot import broker/fragment here
// to avoid a cycle. Instead we will repeat a subset of store_gcs.go.

var TransformSignedURLs = false
var SkipSignedURLs = false
var gcs = &gcsBackend{}

type gcsBackend struct {
Expand Down
12 changes: 0 additions & 12 deletions broker/fragment/store_gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ func (s *gcsBackend) SignGet(ep *url.URL, fragment pb.Fragment, d time.Duration)
}

if DisableSignedUrls {
log.WithFields(log.Fields{
"ep": fmt.Sprintf("%+v", *ep),
"fragment": fmt.Sprintf("%+v", fragment),
}).Info("signGet disable signed urls")
u := &url.URL{
Path: fmt.Sprintf("/%s/%s", cfg.bucket, cfg.rewritePath(cfg.prefix, fragment.ContentPath())),
}
Expand All @@ -68,10 +64,6 @@ func (s *gcsBackend) Exists(ctx context.Context, ep *url.URL, fragment pb.Fragme
if err != nil {
return false, err
}
log.WithFields(log.Fields{
"ep": fmt.Sprintf("%+v", *ep),
"fragment": fmt.Sprintf("%+v", fragment),
}).Info("Exists fragment")
_, err = client.Bucket(cfg.bucket).Object(cfg.rewritePath(cfg.prefix, fragment.ContentPath())).Attrs(ctx)
if err == nil {
exists = true
Expand All @@ -86,10 +78,6 @@ func (s *gcsBackend) Open(ctx context.Context, ep *url.URL, fragment pb.Fragment
if err != nil {
return nil, err
}
log.WithFields(log.Fields{
"ep": fmt.Sprintf("%+v", *ep),
"fragment": fmt.Sprintf("%+v", fragment),
}).Info("Open fragment")
return client.Bucket(cfg.bucket).Object(cfg.rewritePath(cfg.prefix, fragment.ContentPath())).NewReader(ctx)
}

Expand Down
10 changes: 5 additions & 5 deletions mainboilerplate/runconsumer/run_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ type Config interface {
type BaseConfig struct {
Consumer struct {
mbp.ServiceConfig
Limit uint32 `long:"limit" env:"LIMIT" default:"32" description:"Maximum number of Shards this consumer process will allocate"`
MaxHotStandbys uint32 `long:"max-hot-standbys" env:"MAX_HOT_STANDBYS" default:"3" description:"Maximum effective hot standbys of any one shard, which upper-bounds its stated hot-standbys."`
WatchDelay time.Duration `long:"watch-delay" env:"WATCH_DELAY" default:"30ms" description:"Delay applied to the application of watched Etcd events. Larger values amortize the processing of fast-changing Etcd keys."`
TransformSignedURLs bool `long:"transform-signed-urls" env:"TRANSFORM_SIGNED_URLS" description:"When a signed URL is received, transform it into an unsigned URL. This is useful when clients do not require the signing."`
Limit uint32 `long:"limit" env:"LIMIT" default:"32" description:"Maximum number of Shards this consumer process will allocate"`
MaxHotStandbys uint32 `long:"max-hot-standbys" env:"MAX_HOT_STANDBYS" default:"3" description:"Maximum effective hot standbys of any one shard, which upper-bounds its stated hot-standbys."`
WatchDelay time.Duration `long:"watch-delay" env:"WATCH_DELAY" default:"30ms" description:"Delay applied to the application of watched Etcd events. Larger values amortize the processing of fast-changing Etcd keys."`
SkipSignedURLs bool `long:"skip-signed-urls" env:"SKIP_SIGNED_URLS" description:"When a signed URL is received, use fragment info instead to retrieve data with auth header. This is useful when clients do not wish/require the signing."`
} `group:"Consumer" namespace:"consumer" env-namespace:"CONSUMER"`

Broker struct {
Expand Down Expand Up @@ -126,7 +126,7 @@ func (sc Cmd) Execute(args []string) error {
mbp.Must(err, "building Server instance")

// Arize avoidance of using signed URLs.
client.TransformSignedURLs = bc.Consumer.TransformSignedURLs
client.SkipSignedURLs = bc.Consumer.SkipSignedURLs

if bc.Broker.Cache.Size <= 0 {
log.Warn("--broker.cache.size is disabled; consider setting > 0")
Expand Down

0 comments on commit 10f1846

Please sign in to comment.