{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ElasticBeanstalk.Types.Latency
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticBeanstalk.Types.Latency where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents the average latency for the slowest X percent of requests
-- over the last 10 seconds.
--
-- /See:/ 'newLatency' smart constructor.
data Latency = Latency'
  { -- | The average latency for the slowest 90 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p10 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 50 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p50 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 25 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p75 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 15 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p85 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 10 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p90 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 5 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p95 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 1 percent of requests over the last
    -- 10 seconds.
    Latency -> Maybe Double
p99 :: Prelude.Maybe Prelude.Double,
    -- | The average latency for the slowest 0.1 percent of requests over the
    -- last 10 seconds.
    Latency -> Maybe Double
p999 :: Prelude.Maybe Prelude.Double
  }
  deriving (Latency -> Latency -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Latency -> Latency -> Bool
$c/= :: Latency -> Latency -> Bool
== :: Latency -> Latency -> Bool
$c== :: Latency -> Latency -> Bool
Prelude.Eq, ReadPrec [Latency]
ReadPrec Latency
Int -> ReadS Latency
ReadS [Latency]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Latency]
$creadListPrec :: ReadPrec [Latency]
readPrec :: ReadPrec Latency
$creadPrec :: ReadPrec Latency
readList :: ReadS [Latency]
$creadList :: ReadS [Latency]
readsPrec :: Int -> ReadS Latency
$creadsPrec :: Int -> ReadS Latency
Prelude.Read, Int -> Latency -> ShowS
[Latency] -> ShowS
Latency -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Latency] -> ShowS
$cshowList :: [Latency] -> ShowS
show :: Latency -> String
$cshow :: Latency -> String
showsPrec :: Int -> Latency -> ShowS
$cshowsPrec :: Int -> Latency -> ShowS
Prelude.Show, forall x. Rep Latency x -> Latency
forall x. Latency -> Rep Latency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Latency x -> Latency
$cfrom :: forall x. Latency -> Rep Latency x
Prelude.Generic)

-- |
-- Create a value of 'Latency' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'p10', 'latency_p10' - The average latency for the slowest 90 percent of requests over the last
-- 10 seconds.
--
-- 'p50', 'latency_p50' - The average latency for the slowest 50 percent of requests over the last
-- 10 seconds.
--
-- 'p75', 'latency_p75' - The average latency for the slowest 25 percent of requests over the last
-- 10 seconds.
--
-- 'p85', 'latency_p85' - The average latency for the slowest 15 percent of requests over the last
-- 10 seconds.
--
-- 'p90', 'latency_p90' - The average latency for the slowest 10 percent of requests over the last
-- 10 seconds.
--
-- 'p95', 'latency_p95' - The average latency for the slowest 5 percent of requests over the last
-- 10 seconds.
--
-- 'p99', 'latency_p99' - The average latency for the slowest 1 percent of requests over the last
-- 10 seconds.
--
-- 'p999', 'latency_p999' - The average latency for the slowest 0.1 percent of requests over the
-- last 10 seconds.
newLatency ::
  Latency
newLatency :: Latency
newLatency =
  Latency'
    { $sel:p10:Latency' :: Maybe Double
p10 = forall a. Maybe a
Prelude.Nothing,
      $sel:p50:Latency' :: Maybe Double
p50 = forall a. Maybe a
Prelude.Nothing,
      $sel:p75:Latency' :: Maybe Double
p75 = forall a. Maybe a
Prelude.Nothing,
      $sel:p85:Latency' :: Maybe Double
p85 = forall a. Maybe a
Prelude.Nothing,
      $sel:p90:Latency' :: Maybe Double
p90 = forall a. Maybe a
Prelude.Nothing,
      $sel:p95:Latency' :: Maybe Double
p95 = forall a. Maybe a
Prelude.Nothing,
      $sel:p99:Latency' :: Maybe Double
p99 = forall a. Maybe a
Prelude.Nothing,
      $sel:p999:Latency' :: Maybe Double
p999 = forall a. Maybe a
Prelude.Nothing
    }

-- | The average latency for the slowest 90 percent of requests over the last
-- 10 seconds.
latency_p10 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p10 :: Lens' Latency (Maybe Double)
latency_p10 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p10 :: Maybe Double
$sel:p10:Latency' :: Latency -> Maybe Double
p10} -> Maybe Double
p10) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p10:Latency' :: Maybe Double
p10 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 50 percent of requests over the last
-- 10 seconds.
latency_p50 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p50 :: Lens' Latency (Maybe Double)
latency_p50 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p50 :: Maybe Double
$sel:p50:Latency' :: Latency -> Maybe Double
p50} -> Maybe Double
p50) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p50:Latency' :: Maybe Double
p50 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 25 percent of requests over the last
-- 10 seconds.
latency_p75 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p75 :: Lens' Latency (Maybe Double)
latency_p75 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p75 :: Maybe Double
$sel:p75:Latency' :: Latency -> Maybe Double
p75} -> Maybe Double
p75) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p75:Latency' :: Maybe Double
p75 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 15 percent of requests over the last
-- 10 seconds.
latency_p85 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p85 :: Lens' Latency (Maybe Double)
latency_p85 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p85 :: Maybe Double
$sel:p85:Latency' :: Latency -> Maybe Double
p85} -> Maybe Double
p85) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p85:Latency' :: Maybe Double
p85 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 10 percent of requests over the last
-- 10 seconds.
latency_p90 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p90 :: Lens' Latency (Maybe Double)
latency_p90 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p90 :: Maybe Double
$sel:p90:Latency' :: Latency -> Maybe Double
p90} -> Maybe Double
p90) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p90:Latency' :: Maybe Double
p90 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 5 percent of requests over the last
-- 10 seconds.
latency_p95 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p95 :: Lens' Latency (Maybe Double)
latency_p95 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p95 :: Maybe Double
$sel:p95:Latency' :: Latency -> Maybe Double
p95} -> Maybe Double
p95) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p95:Latency' :: Maybe Double
p95 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 1 percent of requests over the last
-- 10 seconds.
latency_p99 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p99 :: Lens' Latency (Maybe Double)
latency_p99 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p99 :: Maybe Double
$sel:p99:Latency' :: Latency -> Maybe Double
p99} -> Maybe Double
p99) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p99:Latency' :: Maybe Double
p99 = Maybe Double
a} :: Latency)

-- | The average latency for the slowest 0.1 percent of requests over the
-- last 10 seconds.
latency_p999 :: Lens.Lens' Latency (Prelude.Maybe Prelude.Double)
latency_p999 :: Lens' Latency (Maybe Double)
latency_p999 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Latency' {Maybe Double
p999 :: Maybe Double
$sel:p999:Latency' :: Latency -> Maybe Double
p999} -> Maybe Double
p999) (\s :: Latency
s@Latency' {} Maybe Double
a -> Latency
s {$sel:p999:Latency' :: Maybe Double
p999 = Maybe Double
a} :: Latency)

instance Data.FromXML Latency where
  parseXML :: [Node] -> Either String Latency
parseXML [Node]
x =
    Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Latency
Latency'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P10")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P50")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P75")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P85")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P90")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P95")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P99")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"P999")

instance Prelude.Hashable Latency where
  hashWithSalt :: Int -> Latency -> Int
hashWithSalt Int
_salt Latency' {Maybe Double
p999 :: Maybe Double
p99 :: Maybe Double
p95 :: Maybe Double
p90 :: Maybe Double
p85 :: Maybe Double
p75 :: Maybe Double
p50 :: Maybe Double
p10 :: Maybe Double
$sel:p999:Latency' :: Latency -> Maybe Double
$sel:p99:Latency' :: Latency -> Maybe Double
$sel:p95:Latency' :: Latency -> Maybe Double
$sel:p90:Latency' :: Latency -> Maybe Double
$sel:p85:Latency' :: Latency -> Maybe Double
$sel:p75:Latency' :: Latency -> Maybe Double
$sel:p50:Latency' :: Latency -> Maybe Double
$sel:p10:Latency' :: Latency -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p10
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p50
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p75
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p85
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p90
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p95
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p99
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
p999

instance Prelude.NFData Latency where
  rnf :: Latency -> ()
rnf Latency' {Maybe Double
p999 :: Maybe Double
p99 :: Maybe Double
p95 :: Maybe Double
p90 :: Maybe Double
p85 :: Maybe Double
p75 :: Maybe Double
p50 :: Maybe Double
p10 :: Maybe Double
$sel:p999:Latency' :: Latency -> Maybe Double
$sel:p99:Latency' :: Latency -> Maybe Double
$sel:p95:Latency' :: Latency -> Maybe Double
$sel:p90:Latency' :: Latency -> Maybe Double
$sel:p85:Latency' :: Latency -> Maybe Double
$sel:p75:Latency' :: Latency -> Maybe Double
$sel:p50:Latency' :: Latency -> Maybe Double
$sel:p10:Latency' :: Latency -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p10
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p50
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p75
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p85
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p90
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p95
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p99
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
p999