func (p *pstoreHandlerType) Visit( theStore *store.Store, endpointId interface{}) error { hostName := endpointId.(*collector.Endpoint).HostName() port := endpointId.(*collector.Endpoint).Port() appName := p.appList.ByPort(port).Name() iterator, timeLeft := p.namedIterator(theStore, endpointId) if p.maybeNilCoord != nil { // aMetricStore from the consumer exposes the same filtering that // the consumer does internally. aMetricStore := p.ConsumerMetricsStore() // Even though the consumer filters out the records it can't write, // we have to do the same filtering here so that we get an accurate // count of skipped records with timestamps coming before the start // of our lease. iterator = store.NamedIteratorFilter(iterator, aMetricStore) // RemoveFromRecordCount removes skipped records from the total // count of records to write. iterator = store.NamedIteratorCoordinate( iterator, p.maybeNilCoord, kLeaseSpan, aMetricStore.RemoveFromRecordCount) } p.consumer.Write(iterator, hostName, appName) p.visitorMetricsStore.MaybeIncreaseTimeLeft( duration.FromFloat(timeLeft)) return nil }
// Write works like Consumer.Write but does not return an error. func (c *ConsumerWithMetrics) Write( n store.NamedIterator, host, appName string) { c.consumer.Write( store.NamedIteratorFilter(n, c.metricsStore.filterer), host, appName) }