Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused metric #2492

Merged
merged 2 commits into from
Jan 25, 2024
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
11 changes: 0 additions & 11 deletions internal/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const (

// Metrics
var (
totalBacklog atomic.Int32
totalNonRmAds atomic.Int64
totalRmAds atomic.Int64
workersActive atomic.Int32
Expand Down Expand Up @@ -165,9 +164,6 @@ type Ingester struct {
mirror adMirror
mhsFromMirror atomic.Uint64

// Metrics
backlogs map[peer.ID]int32

// Ingest rates
ingestRates *rate.Map
}
Expand Down Expand Up @@ -201,8 +197,6 @@ func NewIngester(cfg config.Ingest, h host.Host, idxr indexer.Interface, reg *re

minKeyLen: cfg.MinimumKeyLength,

backlogs: make(map[peer.ID]int32),

ingestRates: rate.NewMap(),
}

Expand Down Expand Up @@ -1043,11 +1037,9 @@ func (ing *Ingester) processRawAdChain(ctx context.Context, syncFinished dagsync
go func(provID peer.ID) {
ing.providersBeingProcessedMu.Lock()
provBusy := ing.providersBeingProcessed[provID]
ing.backlogs[provID]++
ing.providersBeingProcessedMu.Unlock()

stats.Record(ctx,
metrics.AdIngestBacklog.M(int64(totalBacklog.Add(1))),
metrics.AdIngestQueued.M(int64(workersQueued.Add(1))))
// Wait until the no workers are doing work for the provider
// before notifying that another work assignment is available.
Expand Down Expand Up @@ -1075,14 +1067,11 @@ func (ing *Ingester) processRawAdChain(ctx context.Context, syncFinished dagsync
func (ing *Ingester) handleWorkReady(ctx context.Context, provider peer.ID) {
ing.providersBeingProcessedMu.Lock()
provBusy := ing.providersBeingProcessed[provider]
n := ing.backlogs[provider]
delete(ing.backlogs, provider)
// Pull out the assignment for this provider, which was populated by processAdChain.
wa := ing.providerWorkAssignment[provider]
ing.providersBeingProcessedMu.Unlock()

stats.Record(context.Background(),
metrics.AdIngestBacklog.M(int64(totalBacklog.Add(-n))),
metrics.AdIngestQueued.M(int64(workersQueued.Add(-1))),
metrics.AdIngestActive.M(int64(workersActive.Add(1))))

Expand Down
6 changes: 0 additions & 6 deletions internal/metrics/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var (
AdIngestLatency = stats.Float64("ingest/adsynclatency", "latency of syncAdEntries completed successfully", stats.UnitDimensionless)
AdIngestErrorCount = stats.Int64("ingest/adingestError", "Number of errors encountered while processing an ad", stats.UnitDimensionless)
AdIngestQueued = stats.Int64("ingest/adingestqueued", "Number of queued advertisements", stats.UnitDimensionless)
AdIngestBacklog = stats.Int64("ingest/adbacklog", "Queued backlog of adverts", stats.UnitDimensionless)
AdIngestActive = stats.Int64("ingest/adactive", "Active ingest workers", stats.UnitDimensionless)
AdIngestSuccessCount = stats.Int64("ingest/adingestSuccess", "Number of successful ad ingest", stats.UnitDimensionless)
AdIngestSkippedCount = stats.Int64("ingest/adingestSkipped", "Number of ads skipped during ingest", stats.UnitDimensionless)
Expand Down Expand Up @@ -71,10 +70,6 @@ var (
Measure: AdIngestQueued,
Aggregation: view.Count(),
}
adIngestBacklog = &view.View{
Measure: AdIngestBacklog,
Aggregation: view.Distribution(0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024),
}
adIngestActive = &view.View{
Measure: AdIngestActive,
Aggregation: view.Distribution(0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024),
Expand Down Expand Up @@ -118,7 +113,6 @@ func Start(views []*view.View) http.Handler {
adIngestLatencyView,
adIngestError,
adIngestQueued,
adIngestBacklog,
adIngestActive,
adIngestSkipped,
adIngestSuccess,
Expand Down
2 changes: 1 addition & 1 deletion ipni-gc/cmd/ipnigc/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func runGC(ctx context.Context, grim *reaper.Reaper, pc *pcache.ProviderCache, e
err := grim.Reap(ctx, pid)
if err != nil {
if errors.Is(err, context.Canceled) {
log.Info("GC shutdown while processing provider", "provider", pid)
log.Infow("GC shutdown while processing provider", "provider", pid)
return
}
log.Errorw("Failed GC for provider", "err", err, "provider", pid)
Expand Down
2 changes: 1 addition & 1 deletion server/find/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (s *Server) getIndexes(w http.ResponseWriter, mhs []multihash.Multihash, st
defer func() {
msecPerMh := coremetrics.MsecSince(startTime) / float64(len(mhs))
_ = stats.RecordWithOptions(context.Background(),
stats.WithTags(tag.Insert(metrics.Method, "http"), tag.Insert(metrics.Found, fmt.Sprintf("%v", found))),
stats.WithTags(tag.Insert(metrics.Found, fmt.Sprintf("%v", found))),
stats.WithMeasurements(metrics.FindLatency.M(msecPerMh)))
}()

Expand Down