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

0.0.46 • Public • Published

Baselime CDK

Documentation Latest Release License

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

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

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

Installation

npm i @baselime/cdk

Usage

Get your baselime api key from the Baselime console or using the Baselime CLI with the command baselime iam.

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

// Create Query
const query = new baselime.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: ['baselime-alerts'], type: 'slack' }],
});

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

License

© Baselime Limited, 2023

Distributed under MIT License (The MIT License).

See LICENSE for more information.

Package Sidebar

Install

npm i @baselime/cdk

Weekly Downloads

11

Version

0.0.46

License

MIT

Unpacked Size

108 kB

Total Files

53

Last publish

Collaborators

  • ta_baselime
  • boristane