How to use the @aws-cdk/aws-cloudwatch.GraphWidget function in @aws-cdk/aws-cloudwatch

To help you get started, we’ve selected a few @aws-cdk/aws-cloudwatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eladb / cdk-watchful / lib / api-gateway.ts View on Github external
private createCallGraphWidget(opts?: WatchedOperation, alarmThreshold?: number) {
    const leftAnnotations: HorizontalAnnotation[] = alarmThreshold
      ? [{ value: alarmThreshold, color: '#ff0000', label: '5XX Errors Alarm' }]
      : [];

    return new GraphWidget({
      title: `${opts ? `${opts.httpMethod} ${opts.resourcePath}` : 'Overall'} Calls/min`,
      width: 12,
      stacked: false,
      left: [
        this.createApiGatewayMetric(ApiGatewayMetric.Count, opts, { label: 'Calls', statistic: 'sum', color: '#1f77b4' }),
        this.createApiGatewayMetric(ApiGatewayMetric.FourHundredError, opts, { label: 'HTTP 4XX', statistic: 'sum', color: '#ff7f0e' }),
        this.createApiGatewayMetric(ApiGatewayMetric.FiveHundredError, opts, { label: 'HTTP 5XX', statistic: 'sum', color: '#d62728' }),
      ],
      leftAnnotations
    });
  }
github eladb / cdk-watchful / lib / api-gateway.ts View on Github external
private createLatencyGraphWidget(metric: ApiGatewayMetric, opts?: WatchedOperation) {
    return new GraphWidget({
      title: `${opts ? `${opts.httpMethod} ${opts.resourcePath}` : 'Overall'} ${metric} (1-minute periods)`,
      width: 12,
      stacked: false,
      left: ['min', 'avg', 'p90', 'p99', 'max'].map(statistic =>
        this.createApiGatewayMetric(metric, opts, { label: statistic, statistic })),
    });
  }
github eladb / cdk-watchful / lib / api-gateway.ts View on Github external
private createCacheGraphWidget(opts?: WatchedOperation) {
    return new GraphWidget({
      title: `${opts ? `${opts.httpMethod} ${opts.resourcePath}` : 'Overall'} Cache/min`,
      width: 12,
      stacked: false,
      left: [
        this.createApiGatewayMetric(ApiGatewayMetric.Count, opts, { label: 'Calls', statistic: 'sum', color: '#1f77b4' }),
        this.createApiGatewayMetric(ApiGatewayMetric.CacheHitCount, opts, { label: 'Cache Hit', statistic: 'sum', color: '#2ca02c' }),
        this.createApiGatewayMetric(ApiGatewayMetric.CacheMissCount, opts, { label: 'Cache Miss', statistic: 'sum', color: '#d62728' }),
      ],
    });
  }