---
version: v1
display_name: AWS DynamoDB Operations
namespace: AWS/DynamoDB
disabled: true   # deep-grain profile ({TableName, Operation}); opt in with rules[].profiles.include
query:
  period: 1m
instance:
  dimensions:
    - name: TableName
      label: table_name
    - name: Operation
      label: operation
metrics:
  - id: successful_request_latency
    metric_name: SuccessfulRequestLatency
    statistics: [average]
  - id: system_errors
    metric_name: SystemErrors
    statistics: [sum]
    rate: true
  - id: throttled_requests
    metric_name: ThrottledRequests
    statistics: [sum]
    rate: true
  - id: returned_item_count
    metric_name: ReturnedItemCount
    statistics: [sum]
    rate: true
  # ----------------------------------------------------------------------------------------
  # Opt-in metrics (disabled by default). Select them through rules[].metrics.
  # All are published at the
  # {TableName, Operation} grain, so no other change is needed.
  # ----------------------------------------------------------------------------------------
  - id: fault_injection_errors
    disabled: true
    metric_name: FaultInjectionServiceInducedErrors
    statistics: [sum]
    rate: true
  # See: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/metrics-dimensions.html
template:
  family: DynamoDB Operations
  context_namespace: dynamodb_operation
  chart_defaults:
    instances:
      by_labels: [account_id, region, table_name, operation]
  charts:
    - id: aws_cloudwatch_ddb_op_latency
      context: successful_request_latency
      title: DynamoDB Successful Request Latency
      family: Latency
      units: milliseconds
      algorithm: absolute
      dimensions:
        - selector: successful_request_latency_average
          name: latency
    - id: aws_cloudwatch_ddb_op_system_errors
      context: system_errors
      title: DynamoDB System Errors
      family: Errors
      units: errors/s
      algorithm: absolute
      dimensions:
        - selector: system_errors_sum
          name: system_errors
    - id: aws_cloudwatch_ddb_op_throttled_requests
      context: throttled_requests
      title: DynamoDB Throttled Requests
      family: Throttling
      units: requests/s
      algorithm: absolute
      dimensions:
        - selector: throttled_requests_sum
          name: throttled
    - id: aws_cloudwatch_ddb_op_returned_items
      context: returned_item_count
      title: DynamoDB Returned Items
      family: Items
      units: items/s
      algorithm: absolute
      dimensions:
        - selector: returned_item_count_sum
          name: returned
    # ----------------------------------------------------------------------------------------
    # Charts for the opt-in metrics above.
    # ----------------------------------------------------------------------------------------
    - id: aws_cloudwatch_ddb_op_fault_injection
      context: fault_injection_errors
      title: DynamoDB Fault Injection Errors
      family: Errors
      units: errors/s
      algorithm: absolute
      dimensions:
        - selector: fault_injection_errors_sum
          name: injected
