fixed NaN response from Druid during span aggregates results

This commit is contained in:
Ankit Nayan 2021-04-26 23:19:34 +05:30
parent 44304229cb
commit 584215b186

View File

@ -254,19 +254,18 @@ func SearchSpansAggregate(client *godruid.Client, queryParams *model.SpanSearchA
return nil, clientErr
}
// fmt.Println("response", client.LastResponse)
fmt.Println("response", client.LastResponse)
reveivedResponse := new([]SpanSearchAggregatesDuratonReceivedItem)
err = json.Unmarshal([]byte(client.LastResponse), reveivedResponse)
if err != nil {
receivedResponse := new([]SpanSearchAggregatesDuratonReceivedItem)
err = json.Unmarshal([]byte(client.LastResponse), receivedResponse)
if err != nil && len(*receivedResponse) == 0 {
zap.S().Error(err)
return nil, fmt.Errorf("Error in unmarshalling response from druid")
}
var response []SpanSearchAggregatesResponseItem
for _, elem := range *reveivedResponse {
for _, elem := range *receivedResponse {
value := elem.Result.Value
timeObj, _ := time.Parse(time.RFC3339Nano, elem.Timestamp)