Skip to content

Commit

Permalink
Merge pull request #75 from intergral/retention_moni
Browse files Browse the repository at this point in the history
chore(tracing): add spans for retainTenant
  • Loading branch information
Umaaz authored Nov 30, 2023
2 parents 8c4f86b + 2a7ef3d commit 83ad04d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- 1.0.3 START -->
# 1.0.3 (xx/xx/2023)
- **[CHANGE]**: add/improve monitoring for retention [#75](https://github.com/intergral/deep/pull/75) [@Umaaz](https://github.com/Umaaz)
- **[CHANGE]**: add docs for run books [#74](https://github.com/intergral/deep/pull/74) [@Umaaz](https://github.com/Umaaz)
- **[CHANGE]**: unify metric namespaces and subsystems [#73](https://github.com/intergral/deep/pull/73) [@Umaaz](https://github.com/Umaaz)
- **[CHANGE]**: unify span tags for tenant [#70](https://github.com/intergral/deep/pull/70) [@Umaaz](https://github.com/Umaaz)
Expand Down
8 changes: 7 additions & 1 deletion pkg/deepdb/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"context"
"time"

"github.com/opentracing/opentracing-go"

"github.com/go-kit/log/level"

"github.com/intergral/deep/pkg/boundedwaitgroup"
Expand Down Expand Up @@ -55,6 +57,10 @@ func (rw *readerWriter) doRetention(ctx context.Context) {
}

func (rw *readerWriter) retainTenant(ctx context.Context, tenantID string) {
span, ctx := opentracing.StartSpanFromContext(ctx, "rw.retainTenant")
span.SetTag("tenantID", tenantID)
defer span.Finish()

start := time.Now()
defer func() { metricRetentionDuration.Observe(time.Since(start).Seconds()) }()

Expand Down Expand Up @@ -101,7 +107,7 @@ func (rw *readerWriter) retainTenant(ctx context.Context, tenantID string) {
case <-ctx.Done():
return
default:
level.Info(rw.logger).Log("owns", rw.compactorSharder.Owns(b.BlockID.String()), "blockID", b.BlockID, "tenantID", tenantID)
level.Info(rw.logger).Log("owns", rw.compactorSharder.Owns(b.BlockID.String()), "blockID", b.BlockID, "tenantID", tenantID, "cutoff", cutoff, "compacted", b.CompactedTime, "iscut", b.CompactedTime.Before(cutoff))
if b.CompactedTime.Before(cutoff) && rw.compactorSharder.Owns(b.BlockID.String()) {
level.Info(rw.logger).Log("msg", "deleting block", "blockID", b.BlockID, "tenantID", tenantID)
err := rw.c.ClearBlock(b.BlockID, tenantID)
Expand Down

0 comments on commit 83ad04d

Please sign in to comment.