Controls runtime collection and interval reporting of client statistics.

Example

import { NoSQLClient, StatsControl } from "oracle-nosqldb";

const client = new NoSQLClient({
endpoint: "localhost:8080",
statsProfile: StatsControl.Profile.REGULAR,
statsInterval: 600,
statsPrettyPrint: false,
statsHandler: stats => {
console.log("Got stats:", stats);
}
});

const statsControl = client.getStatsControl();

// Enable observations.
statsControl.start();

// Collect more detail around a selected part of the application.
statsControl.setProfile(StatsControl.Profile.ALL);

// Return to regular request statistics.
statsControl.setProfile(StatsControl.Profile.REGULAR);

// Disable observations.
statsControl.stop();

await client.close();

Hierarchy

  • StatsControl

Constructors

Properties

LOG_PREFIX: "Client stats|"
Profile: {
    ALL: "ALL";
    MORE: "MORE";
    NONE: "NONE";
    REGULAR: "REGULAR";
}

Type declaration

  • Readonly ALL: "ALL"
  • Readonly MORE: "MORE"
  • Readonly NONE: "NONE"
  • Readonly REGULAR: "REGULAR"

Methods

  • Returns the interval, in seconds, used for periodic stats snapshots.

    Returns number

  • Returns whether logged JSON stats snapshots are pretty-printed.

    Returns boolean

  • Returns whether stats observations are currently enabled.

    Returns boolean

  • Controls whether logged JSON stats snapshots are pretty-printed.

    Parameters

    • prettyPrint: boolean

    Returns StatsControl

  • Enables stats observations.

    Returns void

  • Disables new stats observations.

    Returns void

Generated using TypeDoc