Skip to content

Commit

Permalink
Update config option name and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zalegrala committed Apr 12, 2022
1 parent 2f635cb commit 137b9d0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ingesters during the rollout. [#1227](https://github.com/grafana/tempo/pull/1227) (@joe-elliott)
* [FEATURE] Added metrics-generator: an optional components to generate metrics from ingested traces [#1282](https://github.com/grafana/tempo/pull/1282) (@mapno, @kvrhdn)
* [FEATURE] Allow the compaction cycle to be configurable with a default of 30 seconds [#1335](https://github.com/grafana/tempo/pull/1335) (@willdot)
* [FEATURE] Add new config options for setting GCS metadata on new objects [](https://github.com/grafana/tempo/pull/1368) (@zalegrala)
* [ENHANCEMENT] Enterprise jsonnet: add config to create tokengen job explicitly [#1256](https://github.com/grafana/tempo/pull/1256) (@kvrhdn)
* [ENHANCEMENT] Add new scaling alerts to the tempo-mixin [#1292](https://github.com/grafana/tempo/pull/1292) (@mapno)
* [ENHANCEMENT] Improve serverless handler error messages [#1305](https://github.com/grafana/tempo/pull/1305) (@joe-elliott)
Expand Down
20 changes: 11 additions & 9 deletions docs/tempo/website/configuration/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,9 @@ storage:
# Example: "bucket_name: tempo"
[bucket_name: <string>]

# Optional
# Example: "cache_control: "no-cache""
# See the GCS documentation for more detail: https://cloud.google.com/storage/docs/metadata
[cache_control: <string>]

# Buffer size for reads. Default is 10MB
# Example: "chunk_buffer_size: 5_000_000"
[chunk_buffer_size: <int>]
[chunk_buffer_size: <int>]

# Optional
# Api endpoint override
Expand All @@ -391,7 +386,7 @@ storage:
# Optional. Default is false.
# Example: "insecure: true"
# Set to true to enable authentication and certificate checks on gcs requests
[insecure: <bool>]
[insecure: <bool>]

# Optional. Default is 0 (disabled)
# Example: "hedge_requests_at: 500ms"
Expand All @@ -406,9 +401,16 @@ storage:
[hedge_requests_up_to: <int>]

# Optional
# Example: "metadata: "map key value strings for user metadata"]
# Example: "object_cache_control: "no-cache""
# A string to specify the behavior with respect to caching of the objects stored in GCS.
# See the GCS documentation for more detail: https://cloud.google.com/storage/docs/metadata
[object_cache_control: <string>]

# Optional
# Example: "object_metadata: {'key': 'value'}"
# A map key value strings for user metadata to store on the GCS objects.
# See the GCS documentation for more detail: https://cloud.google.com/storage/docs/metadata
[metadata: <map[string]string>]
[object_metadata: <map[string]string>]


# S3 configuration. Will be used only if value of backend is "s3"
Expand Down
16 changes: 8 additions & 8 deletions tempodb/backend/gcs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
)

type Config struct {
BucketName string `yaml:"bucket_name"`
CacheControl string `yaml:"cache_control"`
ChunkBufferSize int `yaml:"chunk_buffer_size"`
Endpoint string `yaml:"endpoint"`
HedgeRequestsAt time.Duration `yaml:"hedge_requests_at"`
HedgeRequestsUpTo int `yaml:"hedge_requests_up_to"`
Insecure bool `yaml:"insecure"`
Metadata map[string]string `yaml:"metadata"`
BucketName string `yaml:"bucket_name"`
ChunkBufferSize int `yaml:"chunk_buffer_size"`
Endpoint string `yaml:"endpoint"`
HedgeRequestsAt time.Duration `yaml:"hedge_requests_at"`
HedgeRequestsUpTo int `yaml:"hedge_requests_up_to"`
Insecure bool `yaml:"insecure"`
ObjectCacheControl string `yaml:"object_cache_control"`
ObjectMetadata map[string]string `yaml:"object_metadata"`
}
8 changes: 4 additions & 4 deletions tempodb/backend/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ func (rw *readerWriter) writer(ctx context.Context, name string) *storage.Writer
w := o.NewWriter(ctx)
w.ChunkSize = rw.cfg.ChunkBufferSize

if rw.cfg.Metadata != nil {
w.Metadata = rw.cfg.Metadata
if rw.cfg.ObjectMetadata != nil {
w.Metadata = rw.cfg.ObjectMetadata
}

if rw.cfg.CacheControl != "" {
w.CacheControl = rw.cfg.CacheControl
if rw.cfg.ObjectCacheControl != "" {
w.CacheControl = rw.cfg.ObjectCacheControl
}

return w
Expand Down
10 changes: 5 additions & 5 deletions tempodb/backend/gcs/gcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ func TestObjectConfigAttributes(t *testing.T) {
server := fakeServerWithObjectAttributes(t, &rawObject)

_, w, _, err := New(&Config{
BucketName: "blerg2",
Endpoint: server.URL,
Insecure: true,
CacheControl: tc.cacheControl,
Metadata: tc.metadata,
BucketName: "blerg2",
Endpoint: server.URL,
Insecure: true,
ObjectCacheControl: tc.cacheControl,
ObjectMetadata: tc.metadata,
})
require.NoError(t, err)

Expand Down

0 comments on commit 137b9d0

Please sign in to comment.