Skip to content

khulnasoft/cdk

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •