server: add tenant policy to enable/disable otel exporter

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9928
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
Co-authored-by: Toan Nguyen  <1615675+hgiasac@users.noreply.github.com>
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: Daniele Cammareri <5709409+dancamma@users.noreply.github.com>
GitOrigin-RevId: 56c6903691353875f87bf417c332ac89cdda1279
This commit is contained in:
Puru Gupta 2023-07-26 18:18:31 +05:30 committed by hasura-bot
parent bae14c70d4
commit b3a128065f

View File

@ -18,6 +18,7 @@ module Hasura.Server.Types
ApolloFederationStatus (..), ApolloFederationStatus (..),
isApolloFederationEnabled, isApolloFederationEnabled,
GranularPrometheusMetricsState (..), GranularPrometheusMetricsState (..),
OpenTelemetryExporterState (..),
CloseWebsocketsOnMetadataChangeStatus (..), CloseWebsocketsOnMetadataChangeStatus (..),
isCloseWebsocketsOnMetadataChangeStatusEnabled, isCloseWebsocketsOnMetadataChangeStatusEnabled,
MonadGetPolicies (..), MonadGetPolicies (..),
@ -186,6 +187,25 @@ instance ToJSON GranularPrometheusMetricsState where
GranularMetricsOff -> Bool False GranularMetricsOff -> Bool False
GranularMetricsOn -> Bool True GranularMetricsOn -> Bool True
-- | Whether or not to enable OpenTelemetry Exporter.
--
-- `OpenTelemetryExporterOn` will enable exporting of traces & metrics via the OTel Exporter.
-- `OpenTelemetryExporterOff` will disable exporting of traces & metrics via the OTel Exporter.
data OpenTelemetryExporterState
= OpenTelemetryExporterOff
| OpenTelemetryExporterOn
deriving (Eq, Show)
instance FromJSON OpenTelemetryExporterState where
parseJSON = withBool "OpenTelemetryExporterState" $ \case
False -> pure OpenTelemetryExporterOff
True -> pure OpenTelemetryExporterOn
instance ToJSON OpenTelemetryExporterState where
toJSON = \case
OpenTelemetryExporterOff -> Bool False
OpenTelemetryExporterOn -> Bool True
-- | Whether or not to close websocket connections on metadata change. -- | Whether or not to close websocket connections on metadata change.
data CloseWebsocketsOnMetadataChangeStatus = CWMCEnabled | CWMCDisabled data CloseWebsocketsOnMetadataChangeStatus = CWMCEnabled | CWMCDisabled
deriving stock (Show, Eq, Ord, Generic) deriving stock (Show, Eq, Ord, Generic)