Skip to content

Commit

Permalink
Fix span query bug (erda-project#3202) (erda-project#3203)
Browse files Browse the repository at this point in the history
* Fix span query bug

* compatible trace_id.raw

* Rename span index_patterns types to spans

* Fix es should query

* Query one day service active

Co-authored-by: liuhaoyang <liuhaoyang1221@hotmail.com>
  • Loading branch information
erda-bot and liuhaoyang authored Nov 27, 2021
1 parent e3f0473 commit 50abce9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conf/monitor/streaming/span_index_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"mappings": {
"spot": {
"spans": {
"date_detection": false,
"dynamic_templates": [
{
Expand Down
4 changes: 2 additions & 2 deletions modules/msp/apm/trace/storage/elasticsearch/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (

func (p *provider) getSearchSource(sel *storage.Selector) *elastic.SearchSource {
searchSource := elastic.NewSearchSource()
// TODO: use query := elastic.NewBoolQuery().Filter(elastic.NewTermQuery("trace_id", sel.TraceId))
query := elastic.NewBoolQuery().Filter(elastic.NewQueryStringQuery("trace_id:" + sel.TraceId))
// TODO: range query [start ... end]
query := elastic.NewBoolQuery().Should(elastic.NewTermQuery("trace_id", sel.TraceId), elastic.NewTermQuery("trace_id.raw", sel.TraceId))
return searchSource.Query(query)
}

Expand Down
4 changes: 2 additions & 2 deletions modules/msp/tenant/project/project_statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *projectService) getProjectsStatistics(projects Projects) error {
}
endMillSeconds := time.Now().UnixNano() / int64(time.Millisecond)
oneDayAgoMillSeconds := endMillSeconds - int64(24*time.Hour/time.Millisecond)
sevenDayAgoMillSeconds := endMillSeconds - int64(7*24*time.Hour/time.Millisecond)
//sevenDayAgoMillSeconds := endMillSeconds - int64(7*24*time.Hour/time.Millisecond)

projectIdList, _ := structpb.NewList(projects.
Select(func(item *pb.Project) interface{} { return item.Id }))
Expand All @@ -101,7 +101,7 @@ func (s *projectService) getProjectsStatistics(projects Projects) error {

// get services count and last active time
req := &metricpb.QueryWithInfluxFormatRequest{
Start: strconv.FormatInt(sevenDayAgoMillSeconds, 10),
Start: strconv.FormatInt(oneDayAgoMillSeconds, 10),
End: strconv.FormatInt(endMillSeconds, 10),
Filters: []*metricpb.Filter{
{
Expand Down

0 comments on commit 50abce9

Please sign in to comment.