Skip to content

Commit

Permalink
Merge pull request #33 from ipni/revert-32-track-nft-provider
Browse files Browse the repository at this point in the history
Revert "Track NFT provider ingest rate and distance separately"
  • Loading branch information
gammazero authored Sep 27, 2023
2 parents 2359d42 + 5d52c68 commit 67d3d6c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
38 changes: 0 additions & 38 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ type Metrics struct {
fastestMhPerSec int64
slowestMhPerSec int64

nftMhPerSec int64
nftDist int64

slowRates []*IngestRate
slowCount int
ratesMutex sync.Mutex
Expand All @@ -69,9 +66,6 @@ type Metrics struct {
providerSlowestIngestRate api.Int64ObservableGauge
providerSlowCount api.Int64ObservableGauge
providerSlowIngestRate api.Int64ObservableGauge

nftProviderIngestRate api.Int64ObservableGauge
nftProviderDistance api.Int64ObservableGauge
}

func New(listenAddr string, pc *pcache.ProviderCache) *Metrics {
Expand Down Expand Up @@ -194,23 +188,6 @@ func (m *Metrics) Start(slowRate, nSlowest int) error {
return err
}

if m.nftProviderIngestRate, err = meter.Int64ObservableGauge(
namePrefix+"nft_provider_ingest_rate",
api.WithUnit("mh/sec"),
api.WithDescription("Ingest rate for NFT provider"),
api.WithInt64Callback(m.reportNFTProviderRate),
); err != nil {
return err
}
if m.nftProviderDistance, err = meter.Int64ObservableGauge(
namePrefix+"nft_provider_distance",
api.WithUnit("1"),
api.WithDescription("Distance for NFT provider"),
api.WithInt64Callback(m.reportNFTProviderDist),
); err != nil {
return err
}

mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
m.server.Handler = mux
Expand Down Expand Up @@ -261,11 +238,6 @@ func (m *Metrics) UpdateIngestRates(slowRates []*IngestRate, slowCount int, avg,
m.slowestMhPerSec = slowest
}

func (m *Metrics) UpdateNFTInfo(mhPerSec, dist int64) {
m.nftMhPerSec = mhPerSec
m.nftDist = dist
}

func (m *Metrics) reportProviderCount(_ context.Context, observer api.Int64Observer) error {
observer.Observe(int64(m.pcache.Len()))
return nil
Expand Down Expand Up @@ -329,16 +301,6 @@ func (m *Metrics) reportProviderSlowIngestRates(_ context.Context, observer api.
return nil
}

func (m *Metrics) reportNFTProviderRate(_ context.Context, observer api.Int64Observer) error {
observer.Observe(m.nftMhPerSec)
return nil
}

func (m *Metrics) reportNFTProviderDist(_ context.Context, observer api.Int64Observer) error {
observer.Observe(m.nftDist)
return nil
}

func providerAttr(providerID peer.ID) attribute.KeyValue {
return attribute.Key("provider-id").String(providerID.String())
}
Expand Down
13 changes: 0 additions & 13 deletions telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ type Telemetry struct {
bucketIndexes map[peer.ID]int
}

var nftProviderID peer.ID

func init() {
var err error
nftProviderID, err = peer.Decode("QmQzqxhK82kAmKvARFZSkUVS6fo9sySaiogAnx5EnZ6ZmC")
if err != nil {
panic(err.Error())
}
}

func New(adDepthLimit int64, updateIn, updateTo time.Duration, pc *pcache.ProviderCache, met *metrics.Metrics, indexerAdminURLs []string, slowRate, nSlowest int, topic string) (*Telemetry, error) {
indexerURLs := make([]*url.URL, len(indexerAdminURLs))
for i, urlStr := range indexerAdminURLs {
Expand Down Expand Up @@ -153,9 +143,6 @@ func (tel *Telemetry) run(ctx context.Context, updates <-chan dtrack.DistanceUpd
}
rateMap[update.ID] = ingestRate
tel.updateIngestRates(rateMap)
if update.ID == nftProviderID {
tel.metrics.UpdateNFTInfo(ingestRate.MhPerSec, int64(update.Distance))
}
}
}

Expand Down

0 comments on commit 67d3d6c

Please sign in to comment.