-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prometheus counter for package imports (#811)
- Loading branch information
Showing
32 changed files
with
361 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
synopsis: Add prometheus counter for package imports | ||
prs: #811 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module Flora.Environment.Env | ||
( FloraEnv (..) | ||
, Metrics (..) | ||
, DeploymentEnv (..) | ||
, MLTP (..) | ||
, FeatureEnv (..) | ||
, BlobStoreImpl (..) | ||
, TestEnv (..) | ||
) where | ||
|
||
import Data.Aeson | ||
import Data.Pool (Pool) | ||
import Data.Text (Text) | ||
import Data.Word | ||
import Database.PostgreSQL.Simple qualified as PG | ||
import Flora.Environment.Config | ||
import GHC.Generics | ||
import Prometheus qualified as P | ||
|
||
-- | The datatype that is used in the application | ||
data FloraEnv = FloraEnv | ||
{ pool :: Pool PG.Connection | ||
, dbConfig :: PoolConfig | ||
, jobsPool :: Pool PG.Connection | ||
, httpPort :: Word16 | ||
, domain :: Text | ||
, mltp :: MLTP | ||
, environment :: DeploymentEnv | ||
, features :: FeatureEnv | ||
, config :: FloraConfig | ||
, assets :: Assets | ||
, metrics :: Metrics | ||
} | ||
deriving stock (Generic) | ||
|
||
data Metrics = Metrics | ||
{ packageImportCounter :: P.Vector P.Label1 P.Counter | ||
} | ||
|
||
data TestEnv = TestEnv | ||
{ pool :: Pool PG.Connection | ||
, dbConfig :: PoolConfig | ||
, httpPort :: Word16 | ||
, mltp :: MLTP | ||
, metrics :: Metrics | ||
} | ||
deriving stock (Generic) | ||
|
||
data BlobStoreImpl = BlobStoreFS FilePath | BlobStorePure | ||
deriving stock (Generic, Show) | ||
|
||
instance ToJSON BlobStoreImpl | ||
|
||
newtype FeatureEnv = FeatureEnv {blobStoreImpl :: Maybe BlobStoreImpl} | ||
deriving stock (Generic, Show) | ||
|
||
instance ToJSON FeatureEnv |
Oops, something went wrong.