mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Copy vparquet3 to vparquet4 folder * Create initial vParquet4 encoding * vParquet4: handle unsupported / dropped attributes (#3123) * Count dropped attributes and store them in separate column * Remove current support for arrays and kv-lists * Store per-trace service statistics in vparquet4 blocks (#2941) * Add support for attributes with array values (#3221) * Implement single values as arrays and introduce type column * Add support for array attributes * Tests more array values and fix attribute conversion * Use a combination of snappy and delta for ValueType * Vendor module google/go-cmp/cmp/cmpopts * Use all types of array attributes in TestTraceToParquet * Improve TestFieldsAreCleared * links and events schema changes (#3163) * Add attributes to instrumentation scope (#3322) * Fix typo in vParquet4 event name enconding (#3336) * Precalculate and reuse the vParquet4 schema before opening blocks * Convert block in vparquet4/test-data directory * CHANGELOG.md * Update test cases in BenchmarkBackendBlockTraceQL * Unsupported attribute values are no longer dropped * Replace ValueType column with IsArray column * Skip service stats map allocation when none are present --------- Signed-off-by: Andreas Gerstmayr <[email protected]> Co-authored-by: Andreas Gerstmayr <[email protected]> Co-authored-by: Jennie Pham <[email protected]> Co-authored-by: Andreas Gerstmayr <[email protected]>
49 lines
864 B
Go
49 lines
864 B
Go
package vparquet4
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"sort"
|
|
|
|
"github.com/grafana/tempo/tempodb/encoding/common"
|
|
)
|
|
|
|
type index struct {
|
|
lastID common.ID
|
|
dirty bool
|
|
RowGroups []common.ID `json:"rowGroups"`
|
|
}
|
|
|
|
func (i *index) Add(id common.ID) {
|
|
i.lastID = id
|
|
i.dirty = true
|
|
}
|
|
|
|
func (i *index) Flush() {
|
|
if i.dirty {
|
|
i.RowGroups = append(i.RowGroups, i.lastID)
|
|
i.dirty = false
|
|
}
|
|
}
|
|
|
|
func (i *index) Marshal() ([]byte, error) {
|
|
return json.Marshal(i)
|
|
}
|
|
|
|
func (i *index) Find(id common.ID) int {
|
|
n := sort.Search(len(i.RowGroups), func(j int) bool {
|
|
return bytes.Compare(id, i.RowGroups[j]) <= 0
|
|
})
|
|
if n >= len(i.RowGroups) {
|
|
// Beyond the last row group. This is the only
|
|
// area where presence can be ruled out.
|
|
return -1
|
|
}
|
|
return n
|
|
}
|
|
|
|
func unmarshalIndex(b []byte) (*index, error) {
|
|
i := &index{}
|
|
return i, json.Unmarshal(b, i)
|
|
}
|