Commit 663a56cb by Torkel Ödegaard Committed by GitHub

Merge pull request #13374 from mjtrangoni/fix-megacheck-issues

Fix megacheck issues
parents a6c438c8 03a2a39a
...@@ -271,9 +271,6 @@ func ChangeUserPassword(cmd *m.ChangeUserPasswordCommand) error { ...@@ -271,9 +271,6 @@ func ChangeUserPassword(cmd *m.ChangeUserPasswordCommand) error {
func UpdateUserLastSeenAt(cmd *m.UpdateUserLastSeenAtCommand) error { func UpdateUserLastSeenAt(cmd *m.UpdateUserLastSeenAtCommand) error {
return inTransaction(func(sess *DBSession) error { return inTransaction(func(sess *DBSession) error {
if cmd.UserId <= 0 {
}
user := m.User{ user := m.User{
Id: cmd.UserId, Id: cmd.UserId,
LastSeenAt: time.Now(), LastSeenAt: time.Now(),
......
...@@ -58,6 +58,7 @@ func (ts *TracingService) parseSettings() { ...@@ -58,6 +58,7 @@ func (ts *TracingService) parseSettings() {
func (ts *TracingService) initGlobalTracer() error { func (ts *TracingService) initGlobalTracer() error {
cfg := jaegercfg.Configuration{ cfg := jaegercfg.Configuration{
ServiceName: "grafana",
Disabled: !ts.enabled, Disabled: !ts.enabled,
Sampler: &jaegercfg.SamplerConfig{ Sampler: &jaegercfg.SamplerConfig{
Type: ts.samplerType, Type: ts.samplerType,
...@@ -78,7 +79,7 @@ func (ts *TracingService) initGlobalTracer() error { ...@@ -78,7 +79,7 @@ func (ts *TracingService) initGlobalTracer() error {
options = append(options, jaegercfg.Tag(tag, value)) options = append(options, jaegercfg.Tag(tag, value))
} }
tracer, closer, err := cfg.New("grafana", options...) tracer, closer, err := cfg.NewTracer(options...)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -56,9 +56,7 @@ func (b *SearchRequestBuilder) Build() (*SearchRequest, error) { ...@@ -56,9 +56,7 @@ func (b *SearchRequestBuilder) Build() (*SearchRequest, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, agg := range aggArray { sr.Aggs = append(sr.Aggs, aggArray...)
sr.Aggs = append(sr.Aggs, agg)
}
} }
} }
...@@ -300,9 +298,7 @@ func (b *aggBuilderImpl) Build() (AggArray, error) { ...@@ -300,9 +298,7 @@ func (b *aggBuilderImpl) Build() (AggArray, error) {
return nil, err return nil, err
} }
for _, childAgg := range childAggs { agg.Aggregation.Aggs = append(agg.Aggregation.Aggs, childAggs...)
agg.Aggregation.Aggs = append(agg.Aggregation.Aggs, childAgg)
}
} }
aggs = append(aggs, agg) aggs = append(aggs, agg)
......
...@@ -92,7 +92,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu ...@@ -92,7 +92,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu
} else { } else {
for _, b := range esAgg.Get("buckets").MustArray() { for _, b := range esAgg.Get("buckets").MustArray() {
bucket := simplejson.NewFromAny(b) bucket := simplejson.NewFromAny(b)
newProps := make(map[string]string, 0) newProps := make(map[string]string)
for k, v := range props { for k, v := range props {
newProps[k] = v newProps[k] = v
...@@ -122,7 +122,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu ...@@ -122,7 +122,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu
for _, bucketKey := range bucketKeys { for _, bucketKey := range bucketKeys {
bucket := simplejson.NewFromAny(buckets[bucketKey]) bucket := simplejson.NewFromAny(buckets[bucketKey])
newProps := make(map[string]string, 0) newProps := make(map[string]string)
for k, v := range props { for k, v := range props {
newProps[k] = v newProps[k] = v
...@@ -314,7 +314,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef ...@@ -314,7 +314,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef
switch metric.Type { switch metric.Type {
case "count": case "count":
addMetricValue(&values, rp.getMetricName(metric.Type), castToNullFloat(bucket.Get("doc_count"))) addMetricValue(&values, rp.getMetricName(metric.Type), castToNullFloat(bucket.Get("doc_count")))
break
case "extended_stats": case "extended_stats":
metaKeys := make([]string, 0) metaKeys := make([]string, 0)
meta := metric.Meta.MustMap() meta := metric.Meta.MustMap()
...@@ -355,7 +354,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef ...@@ -355,7 +354,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef
} }
addMetricValue(&values, metricName, castToNullFloat(bucket.GetPath(metric.ID, "value"))) addMetricValue(&values, metricName, castToNullFloat(bucket.GetPath(metric.ID, "value")))
break
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment