Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* [ENHANCEMENT] Implement trace comparison in Vulture [#904](https://github.com/grafana/tempo/pull/904) (@zalegrala)
* [ENHANCEMENT] Dedupe search records while replaying WAL [#940](https://github.com/grafana/tempo/pull/940) (@annanay25)
* [ENHANCEMENT] Add status endpoint to list the available endpoints [#938](https://github.com/grafana/tempo/pull/938) (@zalegrala)
* [ENHANCEMENT] Add search block headers [#943](https://github.com/grafana/tempo/pull/943) (@mdisibio)
* [CHANGE] Renamed CLI flag from `--storage.trace.maintenance-cycle` to `--storage.trace.blocklist_poll`. This is a **breaking change** [#897](https://github.com/grafana/tempo/pull/897) (@mritunjaysharma394)
* [CHANGE] update jsonnet alerts and recording rules to use `job_selectors` and `cluster_selectors` for configurable unique identifier labels [#935](https://github.com/grafana/tempo/pull/935) (@kevinschoonover)
* [CHANGE] Modify generated tag keys in Vulture for easier filtering [#934](https://github.com/grafana/tempo/pull/934) (@zalegrala)
Expand Down
1 change: 1 addition & 0 deletions modules/ingester/instance_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (i *instance) Search(ctx context.Context, req *tempopb.SearchRequest) (*tem
InspectedTraces: sr.TracesInspected(),
InspectedBytes: sr.BytesInspected(),
InspectedBlocks: sr.BlocksInspected(),
SkippedBlocks: sr.BlocksSkipped(),
},
}, nil
}
Expand Down
4 changes: 3 additions & 1 deletion modules/ingester/instance_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/grafana/tempo/pkg/tempopb"
"github.com/grafana/tempo/pkg/util"
"github.com/grafana/tempo/pkg/util/test"
"github.com/grafana/tempo/tempodb/search"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -357,7 +358,8 @@ func TestInstanceSearchMetrics(t *testing.T) {

search := func() *tempopb.SearchMetrics {
sr, err := i.Search(context.Background(), &tempopb.SearchRequest{
Tags: map[string]string{"nomatch": "nomatch"},
// Exhaustive search
Tags: map[string]string{search.SecretExhaustiveSearchTag: "!"},
})
require.NoError(t, err)
return sr.Metrics
Expand Down
1 change: 1 addition & 0 deletions modules/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ func (q *Querier) postProcessSearchResults(req *tempopb.SearchRequest, rr []resp
response.Metrics.InspectedBytes += sr.Metrics.InspectedBytes
response.Metrics.InspectedTraces += sr.Metrics.InspectedTraces
response.Metrics.InspectedBlocks += sr.Metrics.InspectedBlocks
response.Metrics.SkippedBlocks += sr.Metrics.SkippedBlocks
}
}

Expand Down
97 changes: 97 additions & 0 deletions pkg/tempofb/SearchBlockHeader.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions pkg/tempofb/SearchBlockHeader_util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package tempofb

import flatbuffers "github.com/google/flatbuffers/go"

type SearchBlockHeaderBuilder struct {
Tags SearchDataMap
MinDur uint64
MaxDur uint64
}

func NewSearchBlockHeaderBuilder() *SearchBlockHeaderBuilder {
return &SearchBlockHeaderBuilder{
Tags: SearchDataMap{},
}
}

func (s *SearchBlockHeaderBuilder) AddEntry(e *SearchEntry) {

kv := &KeyValues{} //buffer

// Record all unique keyvalues
for i, ii := 0, e.TagsLength(); i < ii; i++ {
e.Tags(kv, i)
for j, jj := 0, kv.ValueLength(); j < jj; j++ {
s.AddTag(string(kv.Key()), string(kv.Value(j)))
}
}

// Record min/max durations
dur := e.EndTimeUnixNano() - e.StartTimeUnixNano()
if s.MinDur == 0 || dur < s.MinDur {
s.MinDur = dur
}
if dur > s.MaxDur {
s.MaxDur = dur
}
}

// AddTag adds the unique tag name and value to the search data. No effect if the pair is already present.
func (s *SearchBlockHeaderBuilder) AddTag(k string, v string) {
s.Tags.Add(k, v)
}

func (s *SearchBlockHeaderBuilder) ToBytes() []byte {
b := flatbuffers.NewBuilder(1024)

tags := s.Tags.WriteToBuilder(b)

SearchBlockHeaderStart(b)
SearchBlockHeaderAddMinDurationNanos(b, s.MinDur)
SearchBlockHeaderAddMaxDurationNanos(b, s.MaxDur)
SearchBlockHeaderAddTags(b, tags)
offset := SearchBlockHeaderEnd(b)
b.Finish(offset)
return b.FinishedBytes()
}
12 changes: 12 additions & 0 deletions pkg/tempofb/tempo.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ table SearchPage {

// Trace entries
entries : [SearchEntry];
}

table SearchBlockHeader {
// This is a rollup of all distinct tags/values in the
// block for quick elimination.
tags : [KeyValues];

// Smallest trace duration in the block
min_duration_nanos: uint64;

// Largest trace duration in the block
max_duration_nanos: uint64;
}
Loading