MCPcopy
hub / github.com/elastic/go-elasticsearch / Stats

Method Stats

_examples/bulk/kafka/producer/producer.go:174–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172}
173
174func (p *Producer) Stats() Stats {
175 if p.writer == nil {
176 return Stats{}
177 }
178
179 duration := time.Since(p.startTime)
180 writerStats := p.writer.Stats()
181
182 p.totalMessages += writerStats.Messages
183 p.totalErrors += writerStats.Errors
184 p.totalBytes += writerStats.Bytes
185
186 rate := float64(p.totalMessages) / duration.Seconds()
187
188 return Stats{
189 Duration: duration,
190 TotalMessages: p.totalMessages,
191 TotalErrors: p.totalErrors,
192 TotalBytes: p.totalBytes,
193 Throughput: rate,
194 }
195}

Callers

nothing calls this directly

Calls 1

StatsMethod · 0.65

Tested by

no test coverage detected