Skip to content

Commit

Permalink
jaegertracing#2048[WIP] - Fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: santosh <bsantosh@thoughtworks.com>
  • Loading branch information
bhiravabhatla committed Dec 5, 2020
1 parent f02553e commit 1af12df
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func newExporter(ctx context.Context, config *Config, params component.ExporterC
return nil, err
}
if config.Primary.IsCreateIndexTemplates() {
spanMapping, serviceMapping := es.GetSpanServiceMappings(esCfg.GetNumShards(), esCfg.GetNumReplicas(), uint(w.esClientVersion()),esCfg.GetIndexPrefix(),esCfg.GetUseILM())
spanMapping, serviceMapping := es.GetSpanServiceMappings(esCfg.GetNumShards(), esCfg.GetNumReplicas(), uint(w.esClientVersion()), esCfg.GetIndexPrefix(), esCfg.GetUseILM())
if err = w.CreateTemplates(ctx, spanMapping, serviceMapping); err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/es/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type Configuration struct {
TLS tlscfg.Options `mapstructure:"tls"`
UseReadWriteAliases bool `mapstructure:"use_aliases"`
CreateIndexTemplates bool `mapstructure:"create_mappings"`
UseILM bool `mapstructure:"-"`
UseILM bool `mapstructure:"-"`
Version uint `mapstructure:"version"`
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/es/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func loadMapping(name string) string {
}

func fixMapping(mapping string, shards, replicas int64, esPrefix string, useILM bool) string {
t, _:= pongo2.FromString(mapping)
t, _ := pongo2.FromString(mapping)
if esPrefix != "" {
esPrefix += "-"
}
Expand Down
20 changes: 10 additions & 10 deletions plugin/storage/es/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ package es
import (
"context"
"errors"
"github.com/flosch/pongo2/v4"
"io/ioutil"
"os"
"testing"

"github.com/flosch/pongo2/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -163,9 +163,9 @@ func TestTagKeysAsFields(t *testing.T) {
}

func TestFactory_LoadMapping(t *testing.T) {
spanMapping5, serviceMapping5 := GetSpanServiceMappings(10, 0, 5,"",false)
spanMapping6, serviceMapping6 := GetSpanServiceMappings(10, 0, 6,"",false)
spanMapping7, serviceMapping7 := GetSpanServiceMappings(10, 0, 7,"test",true)
spanMapping5, serviceMapping5 := GetSpanServiceMappings(10, 0, 5, "", false)
spanMapping6, serviceMapping6 := GetSpanServiceMappings(10, 0, 6, "", false)
spanMapping7, serviceMapping7 := GetSpanServiceMappings(10, 0, 7, "test", true)
dependenciesMapping6 := GetDependenciesMappings(10, 0, 6)
dependenciesMapping7 := GetDependenciesMappings(10, 0, 7)
tests := []struct {
Expand All @@ -189,15 +189,15 @@ func TestFactory_LoadMapping(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, string(b), mapping)
tempMapping, err1 := pongo2.FromString(mapping)
assert.NoError(t,err1)
assert.NoError(t, err1)
if test.name != "/jaeger-service-7.json" && test.name != "/jaeger-span-7.json" {
expectedMapping, err := tempMapping.Execute(pongo2.Context{"NumberOfShards": 10, "NumberOfReplicas": 0, "ESPrefix": "", "UseILM": false})
assert.NoError(t,err)
assert.Equal(t,expectedMapping,fixMapping(mapping, 10, 0, "", false))
}else {
assert.NoError(t, err)
assert.Equal(t, expectedMapping, fixMapping(mapping, 10, 0, "", false))
} else {
expectedMapping, err := tempMapping.Execute(pongo2.Context{"NumberOfShards": 10, "NumberOfReplicas": 0, "ESPrefix": "test-", "UseILM": true})
assert.NoError(t,err)
assert.Equal(t,expectedMapping,fixMapping(mapping, 10, 0, "test", true))
assert.NoError(t, err)
assert.Equal(t, expectedMapping, fixMapping(mapping, 10, 0, "test", true))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions plugin/storage/es/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const (
suffixEnabled = ".enabled"
suffixVersion = ".version"
suffixMaxDocCount = ".max-doc-count"
suffixUseILM = ".use-ilm"
suffixUseILM = ".use-ilm"

// default number of documents to return from a query (elasticsearch allowed limit)
// see search.max_buckets and index.max_result_window
Expand Down Expand Up @@ -260,7 +260,7 @@ func addFlags(flagSet *flag.FlagSet, nsConfig *namespaceConfig) {
flagSet.Bool(
nsConfig.namespace+suffixUseILM,
nsConfig.UseILM,
"Option to enable ILM for jaeger span & service indices. Use this option with use-aliases" +
"Option to enable ILM for jaeger span & service indices. Use this option with use-aliases"+
"It requires an external component to create aliases before startup and then performing its management."+
"ILM policy jaeger-ilm-policy must be manually created in ES before startup")
if nsConfig.namespace == archiveNamespace {
Expand Down
2 changes: 1 addition & 1 deletion plugin/storage/integration/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (s *ESStorageIntegration) initSpanstore(allTagsAsFields, archive bool) erro
return err
}
client := eswrapper.WrapESClient(s.client, bp, esVersion)
spanMapping, serviceMapping := es.GetSpanServiceMappings(5, 1, client.GetVersion(),"",false)
spanMapping, serviceMapping := es.GetSpanServiceMappings(5, 1, client.GetVersion(), "", false)
w := spanstore.NewSpanWriter(
spanstore.SpanWriterParams{
Client: client,
Expand Down

0 comments on commit 1af12df

Please sign in to comment.