{-# 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.Athena.Types.QueryRuntimeStatisticsTimeline
-- 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.Athena.Types.QueryRuntimeStatisticsTimeline 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

-- | Timeline statistics such as query queue time, planning time, execution
-- time, service processing time, and total execution time.
--
-- /See:/ 'newQueryRuntimeStatisticsTimeline' smart constructor.
data QueryRuntimeStatisticsTimeline = QueryRuntimeStatisticsTimeline'
  { -- | The number of milliseconds that the query took to execute.
    QueryRuntimeStatisticsTimeline -> Maybe Integer
engineExecutionTimeInMillis :: Prelude.Maybe Prelude.Integer,
    -- | The number of milliseconds that Athena took to plan the query processing
    -- flow. This includes the time spent retrieving table partitions from the
    -- data source. Note that because the query engine performs the query
    -- planning, query planning time is a subset of engine processing time.
    QueryRuntimeStatisticsTimeline -> Maybe Integer
queryPlanningTimeInMillis :: Prelude.Maybe Prelude.Integer,
    -- | The number of milliseconds that the query was in your query queue
    -- waiting for resources. Note that if transient errors occur, Athena might
    -- automatically add the query back to the queue.
    QueryRuntimeStatisticsTimeline -> Maybe Integer
queryQueueTimeInMillis :: Prelude.Maybe Prelude.Integer,
    -- | The number of milliseconds that Athena took to finalize and publish the
    -- query results after the query engine finished running the query.
    QueryRuntimeStatisticsTimeline -> Maybe Integer
serviceProcessingTimeInMillis :: Prelude.Maybe Prelude.Integer,
    -- | The number of milliseconds that Athena took to run the query.
    QueryRuntimeStatisticsTimeline -> Maybe Integer
totalExecutionTimeInMillis :: Prelude.Maybe Prelude.Integer
  }
  deriving (QueryRuntimeStatisticsTimeline
-> QueryRuntimeStatisticsTimeline -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryRuntimeStatisticsTimeline
-> QueryRuntimeStatisticsTimeline -> Bool
$c/= :: QueryRuntimeStatisticsTimeline
-> QueryRuntimeStatisticsTimeline -> Bool
== :: QueryRuntimeStatisticsTimeline
-> QueryRuntimeStatisticsTimeline -> Bool
$c== :: QueryRuntimeStatisticsTimeline
-> QueryRuntimeStatisticsTimeline -> Bool
Prelude.Eq, ReadPrec [QueryRuntimeStatisticsTimeline]
ReadPrec QueryRuntimeStatisticsTimeline
Int -> ReadS QueryRuntimeStatisticsTimeline
ReadS [QueryRuntimeStatisticsTimeline]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryRuntimeStatisticsTimeline]
$creadListPrec :: ReadPrec [QueryRuntimeStatisticsTimeline]
readPrec :: ReadPrec QueryRuntimeStatisticsTimeline
$creadPrec :: ReadPrec QueryRuntimeStatisticsTimeline
readList :: ReadS [QueryRuntimeStatisticsTimeline]
$creadList :: ReadS [QueryRuntimeStatisticsTimeline]
readsPrec :: Int -> ReadS QueryRuntimeStatisticsTimeline
$creadsPrec :: Int -> ReadS QueryRuntimeStatisticsTimeline
Prelude.Read, Int -> QueryRuntimeStatisticsTimeline -> ShowS
[QueryRuntimeStatisticsTimeline] -> ShowS
QueryRuntimeStatisticsTimeline -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryRuntimeStatisticsTimeline] -> ShowS
$cshowList :: [QueryRuntimeStatisticsTimeline] -> ShowS
show :: QueryRuntimeStatisticsTimeline -> String
$cshow :: QueryRuntimeStatisticsTimeline -> String
showsPrec :: Int -> QueryRuntimeStatisticsTimeline -> ShowS
$cshowsPrec :: Int -> QueryRuntimeStatisticsTimeline -> ShowS
Prelude.Show, forall x.
Rep QueryRuntimeStatisticsTimeline x
-> QueryRuntimeStatisticsTimeline
forall x.
QueryRuntimeStatisticsTimeline
-> Rep QueryRuntimeStatisticsTimeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep QueryRuntimeStatisticsTimeline x
-> QueryRuntimeStatisticsTimeline
$cfrom :: forall x.
QueryRuntimeStatisticsTimeline
-> Rep QueryRuntimeStatisticsTimeline x
Prelude.Generic)

-- |
-- Create a value of 'QueryRuntimeStatisticsTimeline' 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:
--
-- 'engineExecutionTimeInMillis', 'queryRuntimeStatisticsTimeline_engineExecutionTimeInMillis' - The number of milliseconds that the query took to execute.
--
-- 'queryPlanningTimeInMillis', 'queryRuntimeStatisticsTimeline_queryPlanningTimeInMillis' - The number of milliseconds that Athena took to plan the query processing
-- flow. This includes the time spent retrieving table partitions from the
-- data source. Note that because the query engine performs the query
-- planning, query planning time is a subset of engine processing time.
--
-- 'queryQueueTimeInMillis', 'queryRuntimeStatisticsTimeline_queryQueueTimeInMillis' - The number of milliseconds that the query was in your query queue
-- waiting for resources. Note that if transient errors occur, Athena might
-- automatically add the query back to the queue.
--
-- 'serviceProcessingTimeInMillis', 'queryRuntimeStatisticsTimeline_serviceProcessingTimeInMillis' - The number of milliseconds that Athena took to finalize and publish the
-- query results after the query engine finished running the query.
--
-- 'totalExecutionTimeInMillis', 'queryRuntimeStatisticsTimeline_totalExecutionTimeInMillis' - The number of milliseconds that Athena took to run the query.
newQueryRuntimeStatisticsTimeline ::
  QueryRuntimeStatisticsTimeline
newQueryRuntimeStatisticsTimeline :: QueryRuntimeStatisticsTimeline
newQueryRuntimeStatisticsTimeline =
  QueryRuntimeStatisticsTimeline'
    { $sel:engineExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
engineExecutionTimeInMillis =
        forall a. Maybe a
Prelude.Nothing,
      $sel:queryPlanningTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
queryPlanningTimeInMillis = forall a. Maybe a
Prelude.Nothing,
      $sel:queryQueueTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
queryQueueTimeInMillis = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceProcessingTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
serviceProcessingTimeInMillis =
        forall a. Maybe a
Prelude.Nothing,
      $sel:totalExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
totalExecutionTimeInMillis =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The number of milliseconds that the query took to execute.
queryRuntimeStatisticsTimeline_engineExecutionTimeInMillis :: Lens.Lens' QueryRuntimeStatisticsTimeline (Prelude.Maybe Prelude.Integer)
queryRuntimeStatisticsTimeline_engineExecutionTimeInMillis :: Lens' QueryRuntimeStatisticsTimeline (Maybe Integer)
queryRuntimeStatisticsTimeline_engineExecutionTimeInMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryRuntimeStatisticsTimeline' {Maybe Integer
engineExecutionTimeInMillis :: Maybe Integer
$sel:engineExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
engineExecutionTimeInMillis} -> Maybe Integer
engineExecutionTimeInMillis) (\s :: QueryRuntimeStatisticsTimeline
s@QueryRuntimeStatisticsTimeline' {} Maybe Integer
a -> QueryRuntimeStatisticsTimeline
s {$sel:engineExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
engineExecutionTimeInMillis = Maybe Integer
a} :: QueryRuntimeStatisticsTimeline)

-- | The number of milliseconds that Athena took to plan the query processing
-- flow. This includes the time spent retrieving table partitions from the
-- data source. Note that because the query engine performs the query
-- planning, query planning time is a subset of engine processing time.
queryRuntimeStatisticsTimeline_queryPlanningTimeInMillis :: Lens.Lens' QueryRuntimeStatisticsTimeline (Prelude.Maybe Prelude.Integer)
queryRuntimeStatisticsTimeline_queryPlanningTimeInMillis :: Lens' QueryRuntimeStatisticsTimeline (Maybe Integer)
queryRuntimeStatisticsTimeline_queryPlanningTimeInMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryRuntimeStatisticsTimeline' {Maybe Integer
queryPlanningTimeInMillis :: Maybe Integer
$sel:queryPlanningTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
queryPlanningTimeInMillis} -> Maybe Integer
queryPlanningTimeInMillis) (\s :: QueryRuntimeStatisticsTimeline
s@QueryRuntimeStatisticsTimeline' {} Maybe Integer
a -> QueryRuntimeStatisticsTimeline
s {$sel:queryPlanningTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
queryPlanningTimeInMillis = Maybe Integer
a} :: QueryRuntimeStatisticsTimeline)

-- | The number of milliseconds that the query was in your query queue
-- waiting for resources. Note that if transient errors occur, Athena might
-- automatically add the query back to the queue.
queryRuntimeStatisticsTimeline_queryQueueTimeInMillis :: Lens.Lens' QueryRuntimeStatisticsTimeline (Prelude.Maybe Prelude.Integer)
queryRuntimeStatisticsTimeline_queryQueueTimeInMillis :: Lens' QueryRuntimeStatisticsTimeline (Maybe Integer)
queryRuntimeStatisticsTimeline_queryQueueTimeInMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryRuntimeStatisticsTimeline' {Maybe Integer
queryQueueTimeInMillis :: Maybe Integer
$sel:queryQueueTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
queryQueueTimeInMillis} -> Maybe Integer
queryQueueTimeInMillis) (\s :: QueryRuntimeStatisticsTimeline
s@QueryRuntimeStatisticsTimeline' {} Maybe Integer
a -> QueryRuntimeStatisticsTimeline
s {$sel:queryQueueTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
queryQueueTimeInMillis = Maybe Integer
a} :: QueryRuntimeStatisticsTimeline)

-- | The number of milliseconds that Athena took to finalize and publish the
-- query results after the query engine finished running the query.
queryRuntimeStatisticsTimeline_serviceProcessingTimeInMillis :: Lens.Lens' QueryRuntimeStatisticsTimeline (Prelude.Maybe Prelude.Integer)
queryRuntimeStatisticsTimeline_serviceProcessingTimeInMillis :: Lens' QueryRuntimeStatisticsTimeline (Maybe Integer)
queryRuntimeStatisticsTimeline_serviceProcessingTimeInMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryRuntimeStatisticsTimeline' {Maybe Integer
serviceProcessingTimeInMillis :: Maybe Integer
$sel:serviceProcessingTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
serviceProcessingTimeInMillis} -> Maybe Integer
serviceProcessingTimeInMillis) (\s :: QueryRuntimeStatisticsTimeline
s@QueryRuntimeStatisticsTimeline' {} Maybe Integer
a -> QueryRuntimeStatisticsTimeline
s {$sel:serviceProcessingTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
serviceProcessingTimeInMillis = Maybe Integer
a} :: QueryRuntimeStatisticsTimeline)

-- | The number of milliseconds that Athena took to run the query.
queryRuntimeStatisticsTimeline_totalExecutionTimeInMillis :: Lens.Lens' QueryRuntimeStatisticsTimeline (Prelude.Maybe Prelude.Integer)
queryRuntimeStatisticsTimeline_totalExecutionTimeInMillis :: Lens' QueryRuntimeStatisticsTimeline (Maybe Integer)
queryRuntimeStatisticsTimeline_totalExecutionTimeInMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryRuntimeStatisticsTimeline' {Maybe Integer
totalExecutionTimeInMillis :: Maybe Integer
$sel:totalExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
totalExecutionTimeInMillis} -> Maybe Integer
totalExecutionTimeInMillis) (\s :: QueryRuntimeStatisticsTimeline
s@QueryRuntimeStatisticsTimeline' {} Maybe Integer
a -> QueryRuntimeStatisticsTimeline
s {$sel:totalExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: Maybe Integer
totalExecutionTimeInMillis = Maybe Integer
a} :: QueryRuntimeStatisticsTimeline)

instance Data.FromJSON QueryRuntimeStatisticsTimeline where
  parseJSON :: Value -> Parser QueryRuntimeStatisticsTimeline
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QueryRuntimeStatisticsTimeline"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> QueryRuntimeStatisticsTimeline
QueryRuntimeStatisticsTimeline'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EngineExecutionTimeInMillis")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QueryPlanningTimeInMillis")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QueryQueueTimeInMillis")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ServiceProcessingTimeInMillis")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TotalExecutionTimeInMillis")
      )

instance
  Prelude.Hashable
    QueryRuntimeStatisticsTimeline
  where
  hashWithSalt :: Int -> QueryRuntimeStatisticsTimeline -> Int
hashWithSalt
    Int
_salt
    QueryRuntimeStatisticsTimeline' {Maybe Integer
totalExecutionTimeInMillis :: Maybe Integer
serviceProcessingTimeInMillis :: Maybe Integer
queryQueueTimeInMillis :: Maybe Integer
queryPlanningTimeInMillis :: Maybe Integer
engineExecutionTimeInMillis :: Maybe Integer
$sel:totalExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:serviceProcessingTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:queryQueueTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:queryPlanningTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:engineExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
engineExecutionTimeInMillis
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
queryPlanningTimeInMillis
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
queryQueueTimeInMillis
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
serviceProcessingTimeInMillis
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
totalExecutionTimeInMillis

instance
  Prelude.NFData
    QueryRuntimeStatisticsTimeline
  where
  rnf :: QueryRuntimeStatisticsTimeline -> ()
rnf QueryRuntimeStatisticsTimeline' {Maybe Integer
totalExecutionTimeInMillis :: Maybe Integer
serviceProcessingTimeInMillis :: Maybe Integer
queryQueueTimeInMillis :: Maybe Integer
queryPlanningTimeInMillis :: Maybe Integer
engineExecutionTimeInMillis :: Maybe Integer
$sel:totalExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:serviceProcessingTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:queryQueueTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:queryPlanningTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
$sel:engineExecutionTimeInMillis:QueryRuntimeStatisticsTimeline' :: QueryRuntimeStatisticsTimeline -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
engineExecutionTimeInMillis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
queryPlanningTimeInMillis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
queryQueueTimeInMillis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
serviceProcessingTimeInMillis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
totalExecutionTimeInMillis