Skip to content

Commit

Permalink
Merge branch 'main' into cassendra
Browse files Browse the repository at this point in the history
  • Loading branch information
hellspawn679 authored Jun 3, 2024
2 parents 91626c3 + 3f82224 commit 19057a9
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 72 deletions.
9 changes: 0 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,12 @@ linters-settings:
# enable after cleanup
- name: early-return
disabled: true
# enable after cleanup
- name: bare-return
disabled: true
# enable after cleanup
- name: empty-lines
disabled: true
# investigate, could be real bugs. But didn't recent Go version changed loop variables semantics?
- name: range-val-address
disabled: true
# enable after cleanup
- name: confusing-results
disabled: true
# we do use dot imports, but not a bad idea to make it explicit
- name: dot-imports
disabled: true
# enable after cleanup: "tag on not-exported field"
- name: struct-tag
disabled: true
Expand Down
1 change: 0 additions & 1 deletion cmd/collector/app/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func (c *Collector) Start(options *flags.CollectorOptions) error {
return fmt.Errorf("could not start Zipkin receiver: %w", err)
}
c.zipkinReceiver = zipkinReceiver

}

if options.OTLP.Enabled {
Expand Down
1 change: 0 additions & 1 deletion cmd/query/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func createHTTPServer(
return nil, err
}
server.TLSConfig = tlsCfg

}

server.staticHandlerCloser = RegisterStaticHandler(r, logger, queryOpts, querySvc.GetCapabilities())
Expand Down
2 changes: 0 additions & 2 deletions cmd/query/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,7 @@ func TestServerHTTPTLS(t *testing.T) {
if conn != nil {
clientClose = conn.Close
}

} else {

conn, err1 := net.DialTimeout("tcp", "localhost:"+fmt.Sprintf("%d", ports.QueryHTTP), 2*time.Second)
clientError = err1
clientClose = nil
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/xdg-go/scram v1.1.2
Expand Down Expand Up @@ -150,7 +150,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.101.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down Expand Up @@ -386,8 +386,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
30 changes: 15 additions & 15 deletions internal/metrics/prometheus/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

. "github.com/jaegertracing/jaeger/internal/metrics/prometheus"
promMetrics "github.com/jaegertracing/jaeger/internal/metrics/prometheus"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/testutils"
)

func TestOptions(t *testing.T) {
f1 := New()
f1 := promMetrics.New()
assert.NotNil(t, f1)
}

func TestSeparator(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry), WithSeparator(SeparatorColon))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry), promMetrics.WithSeparator(promMetrics.SeparatorColon))
c1 := f1.Namespace(metrics.NSOptions{
Name: "bender",
}).Counter(metrics.Options{
Expand All @@ -52,7 +52,7 @@ func TestSeparator(t *testing.T) {

func TestCounter(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
fDummy := f1.Namespace(metrics.NSOptions{})
f2 := fDummy.Namespace(metrics.NSOptions{
Name: "bender",
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestCounter(t *testing.T) {

func TestCounterDefaultHelp(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
c1 := f1.Counter(metrics.Options{
Name: "rodriguez",
Tags: map[string]string{"x": "y"},
Expand All @@ -109,7 +109,7 @@ func TestCounterDefaultHelp(t *testing.T) {

func TestGauge(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
f2 := f1.Namespace(metrics.NSOptions{
Name: "bender",
Tags: map[string]string{"a": "b"},
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestGauge(t *testing.T) {

func TestGaugeDefaultHelp(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
g1 := f1.Gauge(metrics.Options{
Name: "rodriguez",
Tags: map[string]string{"x": "y"},
Expand All @@ -166,7 +166,7 @@ func TestGaugeDefaultHelp(t *testing.T) {

func TestTimer(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
f2 := f1.Namespace(metrics.NSOptions{
Name: "bender",
Tags: map[string]string{"a": "b"},
Expand Down Expand Up @@ -230,7 +230,7 @@ func TestTimer(t *testing.T) {

func TestTimerDefaultHelp(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
t1 := f1.Timer(metrics.TimerOptions{
Name: "rodriguez",
Tags: map[string]string{"x": "y"},
Expand All @@ -245,7 +245,7 @@ func TestTimerDefaultHelp(t *testing.T) {

func TestTimerCustomBuckets(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry), WithBuckets([]float64{1.5}))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry), promMetrics.WithBuckets([]float64{1.5}))
// dot and dash in the metric name will be replaced with underscore
t1 := f1.Timer(metrics.TimerOptions{
Name: "bender.bending-rodriguez",
Expand All @@ -266,7 +266,7 @@ func TestTimerCustomBuckets(t *testing.T) {

func TestTimerDefaultBuckets(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry), WithBuckets([]float64{1.5, 2}))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry), promMetrics.WithBuckets([]float64{1.5, 2}))
// dot and dash in the metric name will be replaced with underscore
t1 := f1.Timer(metrics.TimerOptions{
Name: "bender.bending-rodriguez",
Expand All @@ -287,7 +287,7 @@ func TestTimerDefaultBuckets(t *testing.T) {

func TestHistogram(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
f2 := f1.Namespace(metrics.NSOptions{
Name: "bender",
Tags: map[string]string{"a": "b"},
Expand Down Expand Up @@ -351,7 +351,7 @@ func TestHistogram(t *testing.T) {

func TestHistogramDefaultHelp(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
t1 := f1.Histogram(metrics.HistogramOptions{
Name: "rodriguez",
Tags: map[string]string{"x": "y"},
Expand All @@ -366,7 +366,7 @@ func TestHistogramDefaultHelp(t *testing.T) {

func TestHistogramCustomBuckets(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry))
// dot and dash in the metric name will be replaced with underscore
t1 := f1.Histogram(metrics.HistogramOptions{
Name: "bender.bending-rodriguez",
Expand All @@ -387,7 +387,7 @@ func TestHistogramCustomBuckets(t *testing.T) {

func TestHistogramDefaultBuckets(t *testing.T) {
registry := prometheus.NewPedanticRegistry()
f1 := New(WithRegisterer(registry), WithBuckets([]float64{1.5}))
f1 := promMetrics.New(promMetrics.WithRegisterer(registry), promMetrics.WithBuckets([]float64{1.5}))
// dot and dash in the metric name will be replaced with underscore
t1 := f1.Histogram(metrics.HistogramOptions{
Name: "bender.bending-rodriguez",
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ require (
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/fswatcher/fswatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func createTestFiles(t *testing.T) (file1 string, file2 string, file3 string) {
err = os.WriteFile(file3, []byte("test data"), 0o600)
require.NoError(t, err)

return
return file1, file2, file3
}

func TestFSWatcherAddFiles(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/gzipfs/gzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ func (f file) Stat() (fs.FileInfo, error) {
}, nil
}

func (f *file) Read(buf []byte) (n int, err error) {
func (f *file) Read(buf []byte) (int, error) {
if len(buf) > len(f.content)-f.offset {
buf = buf[0:len(f.content[f.offset:])]
}

n = copy(buf, f.content[f.offset:])
n := copy(buf, f.content[f.offset:])
if n == len(f.content)-f.offset {
return n, io.EOF
}
f.offset += n
return
return n, nil
}

func (f file) Close() error {
Expand Down
24 changes: 12 additions & 12 deletions pkg/healthcheck/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@ import (

"github.com/stretchr/testify/assert"

. "github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/testutils"
)

func TestStatusString(t *testing.T) {
tests := map[Status]string{
Unavailable: "unavailable",
Ready: "ready",
Broken: "broken",
Status(-1): "unknown",
tests := map[healthcheck.Status]string{
healthcheck.Unavailable: "unavailable",
healthcheck.Ready: "ready",
healthcheck.Broken: "broken",
healthcheck.Status(-1): "unknown",
}
for k, v := range tests {
assert.Equal(t, v, k.String())
}
}

func TestStatusSetGet(t *testing.T) {
hc := New()
assert.Equal(t, Unavailable, hc.Get())
hc := healthcheck.New()
assert.Equal(t, healthcheck.Unavailable, hc.Get())

logger, logBuf := testutils.NewLogger()
hc = New()
hc = healthcheck.New()
hc.SetLogger(logger)
assert.Equal(t, Unavailable, hc.Get())
assert.Equal(t, healthcheck.Unavailable, hc.Get())

hc.Ready()
assert.Equal(t, Ready, hc.Get())
assert.Equal(t, healthcheck.Ready, hc.Get())
assert.Equal(t, map[string]string{"level": "info", "msg": "Health Check state change", "status": "ready"}, logBuf.JSONLine(0))
}

func TestHealthCheck_Handler_ContentType(t *testing.T) {
rec := httptest.NewRecorder()
New().Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/", nil))
healthcheck.New().Handler().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/", nil))
resp := rec.Result()

assert.Equal(t, "application/json", resp.Header.Get("Content-Type"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/httpmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ func (r *requestDurations) buildTimer(metricsFactory metrics.Factory, key record
"method": key.method,
},
})
return
return out
}
6 changes: 2 additions & 4 deletions pkg/kafka/auth/plaintext.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ func (x *scramClient) Begin(userName, password, authzID string) (err error) {

// Step steps client through the SCRAM exchange. It is
// called repeatedly until it errors or `Done` returns true.
func (x *scramClient) Step(challenge string) (response string, err error) {
response, err = x.ClientConversation.Step(challenge)
return
func (x *scramClient) Step(challenge string) (string, error) {
return x.ClientConversation.Step(challenge)
}

// Done should return true when the SCRAM conversation
Expand Down Expand Up @@ -84,7 +83,6 @@ func setPlainTextConfiguration(config *PlainTextConfig, saramaConfig *sarama.Con

default:
return fmt.Errorf("config plaintext.mechanism error: %s, only support 'SCRAM-SHA-256' or 'SCRAM-SHA-512' or 'PLAIN'", config.Mechanism)

}
return nil
}
1 change: 0 additions & 1 deletion plugin/sampling/strategystore/static/strategy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ func (h *strategyStore) parseStrategies(strategies *strategies) {

opS := newStore.serviceStrategies[s.Service].OperationSampling
if opS == nil {

// Service does not have its own per-operation rules, so copy (by value) from the default strategy.
newOpS := *newStore.defaultStrategy.OperationSampling

Expand Down
1 change: 0 additions & 1 deletion plugin/storage/badger/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ func serviceQueries(query *spanstore.TraceQueryParameters, indexSeeks [][]byte)
} else if !tagQueryUsed { // Tag query already reduces the search set with a serviceName
indexSearchKey = append(indexSearchKey, serviceNameIndexKey)
indexSearchKey = append(indexSearchKey, []byte(query.ServiceName)...)

}

if len(indexSearchKey) > 0 {
Expand Down
1 change: 0 additions & 1 deletion plugin/storage/cassandra/spanstore/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ func TestSpanReaderFindTraces(t *testing.T) {
if testCase.queryDuration {
queryParams.DurationMin = time.Minute
queryParams.DurationMax = time.Minute * 3

}
res, err := r.reader.FindTraces(context.Background(), queryParams)
if testCase.expectedError == "" {
Expand Down
1 change: 0 additions & 1 deletion plugin/storage/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ func (st *Store) WriteSpan(ctx context.Context, span *model.Span) error {
// update the ring with the trace id
m.ids[m.index] = &span.TraceID
}

}
m.traces[span.TraceID].Spans = append(m.traces[span.TraceID].Spans, span)

Expand Down
Loading

0 comments on commit 19057a9

Please sign in to comment.