@khulnasoft/cdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.46 • Public • Published

Kengine CDK

Documentation Latest Release License

Kengine CDK offers the most effective approach to adding observability to a serverless CDK application.

kengine.Config.init(stack, {
  apiKey: 'xxxxxx',
});

new Alert("service-errors", {
  parameters: {
    query: {
      filters: [
        filter.inArray("LogLevel", ["ERROR", "WARN"]),
      ],
    },
    channels: [{ type: "slack", targets: ["kengine-alerts"] }]
  },
});

Installation

npm i @khulnasoft/cdk

Usage

Get your kengine api key from the Kengine console or using the Kengine CLI with the command kengine iam.

// Initialize Config, you must do this in a construct before adding querys, alerts and dashboards.
kengine.Config.init(stack, {
  apiKey: 'xxxxxx',
});

// Create Query
const query = new kengine.Query("ColdStarts", {
  description: "optional",
  parameters: {
    datasets: [
      "lambda-logs",
    ],
    calculations: [
      max("@initDuration"),
      p90("@initDuration"),
      min("@initDuration"),
    ],
    filters: [
      eq("@type", "REPORT"),
    ],
  }
});

// Add an alert
query.addAlert({
  enabled: true,
  parameters: {
    frequency: '30mins',
    threshold: gt(500),
    window: '1 hour',
  },
  channels: [{ targets: ['kengine-alerts'], type: 'slack' }],
});

// Create Dashboard
new kengine.Dashboard('ServiceHealth', {
  parameters: {
    widgets: [{ query, type: WidgetType.TIMESERIES}],
  },
});

License

© Kengine Limited, 2023

Distributed under MIT License (The MIT License).

See LICENSE for more information.

Package Sidebar

Install

npm i @khulnasoft/cdk

Weekly Downloads

1

Version

0.0.46

License

MIT

Unpacked Size

107 kB

Total Files

54

Last publish

Collaborators

  • nextlinux