-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
todosomething for futuresomething for future
Description
Why? you can, for example, write metrics in Prometheus or organize your own custom processing.
Writer callbacks
// call after write to tmp buffer
func onWrite(view cx.View) {}
// call after write batch to Clickhouse
func onWriteClickhouse(view cx.View, count uint64) {}
// call if write to clickhouse return error
// if this function has called, then repeated attempts are not enabled
func onWriteClickhouseError(err error, batch *cx.Batch) {}Retry callbacks
// call after batch push to retry queue
func onRetryPush() {}
// call after rerty successfully handle
func onRetryComplete(view cx.View, countAttempt uint8) {}
// call if retry batch fails
func onRetryFail(err error, batch *retry.Retry)examples:
// note: there is a pseudocode
func onWriteClickhouse(view cx.View, count uint64) {
prometheus.WithLabelValues("clickhouse", view.Table).Add(count)
}
func onWriteClickhouseError(err error, batch *cx.Batch) {
// code
prometheus.WithLabelValues("clickhouse", batch.View().Table, getErrorHumanableCode(err)).Inc()
// save batch to athoner storange, for example file
_ = failservice.Encode(batch).Write(ctx)
// other code
}Metadata
Metadata
Assignees
Labels
todosomething for futuresomething for future