Skip to content

Commit

Permalink
Clean up compactor logging after proto change (#4212)
Browse files Browse the repository at this point in the history
* Clean up compactor logging after proto change

* Tidy harder
  • Loading branch information
zalegrala authored Oct 21, 2024
1 parent 27e4b9d commit af88f94
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
19 changes: 17 additions & 2 deletions tempodb/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,22 @@ func (rw *readerWriter) compact(ctx context.Context, blockMetas []*backend.Block

var totalRecords int
for _, blockMeta := range blockMetas {
level.Info(rw.logger).Log("msg", "compacting block", "block", fmt.Sprintf("%+v", blockMeta))
level.Info(rw.logger).Log(
"msg", "compacting block",
"version", blockMeta.Version,
"tenantID", blockMeta.TenantID,
"blockID", blockMeta.BlockID.String(),
"startTime", blockMeta.StartTime.String(),
"endTime", blockMeta.EndTime.String(),
"totalObjects", blockMeta.TotalObjects,
"size", blockMeta.Size_,
"compactionLevel", blockMeta.CompactionLevel,
"encoding", blockMeta.Encoding.String(),
"totalRecords", blockMeta.TotalObjects,
"bloomShardCount", blockMeta.BloomShardCount,
"footerSize", blockMeta.FooterSize,
"replicationFactor", blockMeta.ReplicationFactor,
)
totalRecords += int(blockMeta.TotalObjects)

// Make sure block still exists
Expand Down Expand Up @@ -272,7 +287,7 @@ func (rw *readerWriter) compact(ctx context.Context, blockMetas []*backend.Block
time.Since(startTime),
}
for _, meta := range newCompactedBlocks {
logArgs = append(logArgs, "block", fmt.Sprintf("%+v", meta))
logArgs = append(logArgs, "blockID", meta.BlockID.String())
}
level.Info(rw.logger).Log(logArgs...)

Expand Down
17 changes: 16 additions & 1 deletion tempodb/encoding/vparquet2/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,22 @@ func (c *Compactor) finishBlock(ctx context.Context, block *streamingBlock, l lo
return fmt.Errorf("error completing block: %w", err)
}

level.Info(l).Log("msg", "wrote compacted block", "meta", fmt.Sprintf("%+v", block.meta))
level.Info(l).Log("msg", "wrote compacted block",
"version", block.meta.Version,
"tenantID", block.meta.TenantID,
"blockID", block.meta.BlockID.String(),
"startTime", block.meta.StartTime.String(),
"endTime", block.meta.EndTime.String(),
"totalObjects", block.meta.TotalObjects,
"size", block.meta.Size_,
"compactionLevel", block.meta.CompactionLevel,
"encoding", block.meta.Encoding.String(),
"totalRecords", block.meta.TotalObjects,
"bloomShardCount", block.meta.BloomShardCount,
"footerSize", block.meta.FooterSize,
"replicationFactor", block.meta.ReplicationFactor,
)

compactionLevel := int(block.meta.CompactionLevel) - 1
if c.opts.BytesWritten != nil {
c.opts.BytesWritten(compactionLevel, bytesFlushed)
Expand Down
17 changes: 16 additions & 1 deletion tempodb/encoding/vparquet3/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,22 @@ func (c *Compactor) finishBlock(ctx context.Context, block *streamingBlock, l lo
return fmt.Errorf("error completing block: %w", err)
}

level.Info(l).Log("msg", "wrote compacted block", "meta", fmt.Sprintf("%+v", block.meta))
level.Info(l).Log("msg", "wrote compacted block",
"version", block.meta.Version,
"tenantID", block.meta.TenantID,
"blockID", block.meta.BlockID.String(),
"startTime", block.meta.StartTime.String(),
"endTime", block.meta.EndTime.String(),
"totalObjects", block.meta.TotalObjects,
"size", block.meta.Size_,
"compactionLevel", block.meta.CompactionLevel,
"encoding", block.meta.Encoding.String(),
"totalRecords", block.meta.TotalObjects,
"bloomShardCount", block.meta.BloomShardCount,
"footerSize", block.meta.FooterSize,
"replicationFactor", block.meta.ReplicationFactor,
)

compactionLevel := int(block.meta.CompactionLevel) - 1
if c.opts.BytesWritten != nil {
c.opts.BytesWritten(compactionLevel, bytesFlushed)
Expand Down
16 changes: 15 additions & 1 deletion tempodb/encoding/vparquet4/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,21 @@ func (c *Compactor) finishBlock(ctx context.Context, block *streamingBlock, l lo
return fmt.Errorf("error completing block: %w", err)
}

level.Info(l).Log("msg", "wrote compacted block", "meta", fmt.Sprintf("%+v", block.meta))
level.Info(l).Log("msg", "wrote compacted block",
"version", block.meta.Version,
"tenantID", block.meta.TenantID,
"blockID", block.meta.BlockID.String(),
"startTime", block.meta.StartTime.String(),
"endTime", block.meta.EndTime.String(),
"totalObjects", block.meta.TotalObjects,
"size", block.meta.Size_,
"compactionLevel", block.meta.CompactionLevel,
"encoding", block.meta.Encoding.String(),
"totalRecords", block.meta.TotalObjects,
"bloomShardCount", block.meta.BloomShardCount,
"footerSize", block.meta.FooterSize,
"replicationFactor", block.meta.ReplicationFactor,
)

span.AddEvent("wrote compacted block")
span.SetAttributes(
Expand Down

0 comments on commit af88f94

Please sign in to comment.