Skip to content

Commit

Permalink
Merge branch 'main' into configure-index-daltalayout-and-frequency
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Tan <jian.tan@daocloud.io>
  • Loading branch information
JaredTan95 committed Sep 6, 2024
2 parents 4ce1b97 + ad6af7a commit 037f479
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/jaeger/config-elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ extensions:
elasticsearch:
indices:
spans:
index_prefix: "jaeger-main"
prefix: "jaeger-main"
date_layout: "2006-01-02"
rollover_frequency: "day"
shards: 5
replicas: 1
services:
index_prefix: "jaeger-main"
prefix: "jaeger-main"
date_layout: "2006-01-02"
rollover_frequency: "day"
shards: 5
replicas: 1
dependencies:
index_prefix: "jaeger-main"
prefix: "jaeger-main"
date_layout: "2006-01-02"
rollover_frequency: "day"
shards: 5
Expand All @@ -48,7 +48,7 @@ extensions:
elasticsearch:
indices:
spans:
index_prefix: "jaeger-archive"
prefix: "jaeger-archive"

receivers:
otlp:
Expand Down
12 changes: 11 additions & 1 deletion plugin/storage/memory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@

package memory

// Configuration describes the options to customize the storage behavior
import "github.com/asaskevich/govalidator"

// Configuration describes the options to customize the storage behavior.
type Configuration struct {
// MaxTraces is the maximum amount of traces to store in memory.
// If multi-tenancy is enabled, this limit applies per tenant.
// Zero value (default) means no limit (Warning: memory usage will be unbounded).
MaxTraces int `mapstructure:"max_traces"`
}

func (c *Configuration) Validate() error {
_, err := govalidator.ValidateStruct(c)
return err
}
35 changes: 35 additions & 0 deletions plugin/storage/memory/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package memory

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestValidate_DoesNotReturnErrorWhenValid(t *testing.T) {
tests := []struct {
name string
config *Configuration
}{
{
name: "non-required fields not set",
config: &Configuration{},
},
{
name: "all fields are set",
config: &Configuration{
MaxTraces: 100,
},
},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
err := test.config.Validate()
require.NoError(t, err)
})
}
}

0 comments on commit 037f479

Please sign in to comment.