# ----------------------------------------------------------- #
# Configuration Fragment : Measure Deployment Time            #
# ----------------------------------------------------------- #
# This fragment installs a duration tracker that tracks the   #
# duration in seconds between the beginning and the           #
# completion of every API HTTP request.                       #
# ----------------------------------------------------------- #

# Global test configuration
# ===========================
config:

  # Define the metrics we are measuring
  metrics:
    - name: httpRequestTime
      uuid: d7071b36bb804a3c8df69c2de28ac222
      desc: The time from the HTTP request till the completion of the HTTP response
      summarize:
        - class: summarize.PercentileSummarizer
          name: p50
          percentile: 50
        - class: summarize.PercentileSummarizer
          name: p75
          percentile: 75
        - class: summarize.PercentileSummarizer
          name: p95
          percentile: 95
        - class: summarize.PercentileSummarizer
          name: p98
          percentile: 98
        - class: summarize.PercentileSummarizer
          name: p99
          percentile: 99
        - class: "@mean_err"
        - class: "@min"
        - class: "@max"
      units: sec

  # Define the indicators that can summarise our values
  indicators:

    # Calculate `meanHttpRequestTime` by calculating the normalizing average
    # of all the `deploymentTime` mean values, normalized against each test's
    # normalization expression
    - name: meanHttpRequestTime
      class: indicator.NormalizedMeanMetricIndicator
      metric: httpRequestTime.mean_err
      normalizeto: "{{normalize_to}}"

# Tracker configuration
# ===========================
trackers:

  # Track httpRequestTime as the duration between a deployment request and start
  - class: tracker.DurationTracker
    metric: httpRequestTime
    events:
      start: MarathonDeploymentRequestedEvent
      end: MarathonDeploymentStartedEvent
