Skip to content

Commit

Permalink
gateway/s3: allow tracing requests to backend service (minio#13189)
Browse files Browse the repository at this point in the history
fixes minio#13089
fixes minio#13133

Co-authored-by: Anis Elleuch <[email protected]>
Co-authored-by: Harshavardhana <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2021
1 parent 03a2a74 commit c2f25b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/gateway-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
SecretKey: globalActiveCred.SecretKey,
})
if err != nil {
globalHTTPServer.Shutdown()
logger.FatalIf(err, "Unable to initialize gateway backend")
}
newObject = NewGatewayLayerWithLocker(newObject)
Expand Down
15 changes: 13 additions & 2 deletions cmd/gateway/s3/gateway-s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"math/rand"
"net/http"
"net/url"
"os"
"strings"
"time"

Expand All @@ -34,9 +35,11 @@ import (
"github.com/minio/minio-go/v7/pkg/s3utils"
"github.com/minio/minio-go/v7/pkg/tags"
minio "github.com/minio/minio/cmd"
"github.com/minio/minio/internal/config"
xhttp "github.com/minio/minio/internal/http"
"github.com/minio/minio/internal/logger"
"github.com/minio/pkg/bucket/policy"
"github.com/minio/pkg/env"
)

func init() {
Expand Down Expand Up @@ -94,12 +97,16 @@ func s3GatewayMain(ctx *cli.Context) {
logger.FatalIf(minio.ValidateGatewayArguments(serverAddr, args.First()), "Invalid argument")

// Start the gateway..
minio.StartGateway(ctx, &S3{args.First()})
minio.StartGateway(ctx, &S3{
host: args.First(),
debug: env.Get("_MINIO_SERVER_DEBUG", config.EnableOff) == config.EnableOn,
})
}

// S3 implements Gateway.
type S3 struct {
host string
host string
debug bool
}

// Name implements Gateway interface.
Expand Down Expand Up @@ -219,6 +226,10 @@ func (g *S3) NewGatewayLayer(creds madmin.Credentials) (minio.ObjectLayer, error
return nil, err
}

if g.debug {
clnt.Client.TraceOn(os.Stderr)
}

probeBucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "probe-bucket-sign-")

// Check if the provided keys are valid.
Expand Down

0 comments on commit c2f25b6

Please sign in to comment.