Options used by WriteApi .

interface WriteOptions {
    batchSize: number;
    consistency?: "all" | "one" | "any" | "quorum";
    defaultTags?: Record<string, string>;
    exponentialBase: number;
    flushInterval: number;
    gzipThreshold?: number;
    headers?: { [key: string]: string };
    maxBatchBytes: number;
    maxBufferLines: number;
    maxRetries: number;
    maxRetryDelay: number;
    maxRetryTime: number;
    minRetryDelay: number;
    randomRetry: boolean;
    retryJitter: number;
    writeFailed(
        this: WriteApi,
        error: Error,
        lines: string[],
        attempt: number,
        expires: number,
    ): void | Promise<void>;
    writeRetrySkipped(entry: { expires: number; lines: string[] }): void;
    writeSuccess(this: WriteApi, lines: string[]): void;
}

Hierarchy (View Summary, Expand)

Properties

batchSize: number

max number of records/lines to send in a batch

consistency?: "all" | "one" | "any" | "quorum"
defaultTags?: Record<string, string>

default tags, unescaped

exponentialBase: number

base for the exponential retry delay

flushInterval: number

delay between data flushes in milliseconds, at most batch size records are sent during flush

gzipThreshold?: number

When specified, write bodies larger than the threshold are gzipped

headers?: { [key: string]: string }

HTTP headers that will be sent with every write request

maxBatchBytes: number

max size of a batch in bytes

maxBufferLines: number

the maximum size of retry-buffer (in lines)

maxRetries: number

max count of retries after the first write fails

maxRetryDelay: number

maximum delay when retrying write (milliseconds)

maxRetryTime: number

max time (millis) that can be spent with retries

minRetryDelay: number

minimum delay when retrying write (milliseconds)

randomRetry: boolean

randomRetry indicates whether the next retry delay is deterministic (false) or random (true). The deterministic delay starts with minRetryDelay * exponentialBase and it is multiplied by exponentialBase until it exceeds maxRetryDelay. When random is true, the next delay is computed as a random number between next retry attempt (upper) and the lower number in the deterministic sequence. random(retryJitter) is added to every returned value.

retryJitter: number

add random(retryJitter) milliseconds delay when retrying HTTP calls

Methods

  • WriteFailed is called to inform about write errors.

    Parameters

    • this: WriteApi

      the instance of the API that failed

    • error: Error

      write error

    • lines: string[]

      failed lines

    • attempt: number

      count of already failed attempts to write the lines (1 ... maxRetries+1)

    • expires: number

      expiration time for the lines to be retried in millis since epoch

    Returns void | Promise<void>

    a Promise to force the API to use it as a result of the flush operation, void/undefined to continue with default retry mechanism

  • WriteRetrySkipped is informed about lines that were removed from the retry buffer to keep the size of the retry buffer under the configured limit (maxBufferLines).

    Parameters

    • entry: { expires: number; lines: string[] }

      lines that were skipped

    Returns void

MMNEPVFCICPMFPCPTTAAATR