Skip to content

Commit

Permalink
chunks-inspect: print chunk version (format) (#9490)
Browse files Browse the repository at this point in the history
Get the version byte of the current inspecting Loki chunk printed.
  • Loading branch information
agebhar1 authored May 22, 2023
1 parent ac4a442 commit a205dce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/chunks-inspect/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const (
)

type LokiChunk struct {
format byte
encoding Encoding

blocks []LokiBlock
Expand Down Expand Up @@ -149,6 +150,7 @@ func parseLokiChunk(chunkHeader *ChunkHeader, r io.Reader) (*LokiChunk, error) {
metadata = metadata[n:]

lokiChunk := &LokiChunk{
format: f,
encoding: compression,
metadataChecksum: metaChecksum,
computedMetadataChecksum: computedMetaChecksum,
Expand Down
1 change: 1 addition & 0 deletions cmd/chunks-inspect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func printFile(filename string, blockDetails, printLines, storeBlocks bool) {
return
}

fmt.Println("Format (Version):", lokiChunk.format)
fmt.Println("Encoding:", lokiChunk.encoding)
fmt.Print("Blocks Metadata Checksum: ", fmt.Sprintf("%08x", lokiChunk.metadataChecksum))
if lokiChunk.metadataChecksum == lokiChunk.computedMetadataChecksum {
Expand Down

0 comments on commit a205dce

Please sign in to comment.