enableEnhancedMonitoring method

Future<EnhancedMonitoringOutput> enableEnhancedMonitoring({
  1. required List<MetricsName> shardLevelMetrics,
  2. required String streamName,
})

Enables enhanced Kinesis data stream monitoring for shard-level metrics.

May throw InvalidArgumentException. May throw LimitExceededException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter shardLevelMetrics : List of shard-level metrics to enable.

The following are the valid shard-level metrics. The value "ALL" enables every metric.

  • IncomingBytes
  • IncomingRecords
  • OutgoingBytes
  • OutgoingRecords
  • WriteProvisionedThroughputExceeded
  • ReadProvisionedThroughputExceeded
  • IteratorAgeMilliseconds
  • ALL
For more information, see Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch in the Amazon Kinesis Data Streams Developer Guide.

Parameter streamName : The name of the stream for which to enable enhanced monitoring.

Implementation

Future<EnhancedMonitoringOutput> enableEnhancedMonitoring({
  required List<MetricsName> shardLevelMetrics,
  required String streamName,
}) async {
  ArgumentError.checkNotNull(shardLevelMetrics, 'shardLevelMetrics');
  ArgumentError.checkNotNull(streamName, 'streamName');
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Kinesis_20131202.EnableEnhancedMonitoring'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ShardLevelMetrics': shardLevelMetrics.map((e) => e.toValue()).toList(),
      'StreamName': streamName,
    },
  );

  return EnhancedMonitoringOutput.fromJson(jsonResponse.body);
}