Skip to content

Commit

Permalink
use s3 storage type instead strings
Browse files Browse the repository at this point in the history
  • Loading branch information
pollosp committed Jan 24, 2025
1 parent a6c73ad commit 217488e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions exporter/awss3exporter/internal/upload/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ type s3manager struct {
bucket string
builder *PartitionKeyBuilder
uploader *manager.Uploader
storageClass string
storageClass s3types.StorageClass
}

var _ Manager = (*s3manager)(nil)

func NewS3Manager(bucket string, builder *PartitionKeyBuilder, service *s3.Client, storageClass string) Manager {
func NewS3Manager(bucket string, builder *PartitionKeyBuilder, service *s3.Client, storageClass s3types.StorageClass) Manager {
return &s3manager{
bucket: bucket,
builder: builder,
Expand Down Expand Up @@ -60,7 +60,7 @@ func (sw *s3manager) Upload(ctx context.Context, data []byte) error {
Key: aws.String(sw.builder.Build(now)),
Body: content,
ContentEncoding: aws.String(encoding),
StorageClass: s3types.StorageClass(sw.storageClass),
StorageClass: sw.storageClass,
})

return err
Expand Down
3 changes: 2 additions & 1 deletion exporter/awss3exporter/s3_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials/stscreds"
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/aws/aws-sdk-go-v2/service/sts"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awss3exporter/internal/upload"
Expand Down Expand Up @@ -70,6 +71,6 @@ func newUploadManager(
Compression: conf.S3Uploader.Compression,
},
s3.NewFromConfig(cfg, s3Opts...),
conf.S3Uploader.StorageClass,
s3types.StorageClass(conf.S3Uploader.StorageClass),
), nil
}

0 comments on commit 217488e

Please sign in to comment.