mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
339e19048b
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6844 GitOrigin-RevId: 3d808215fc46a79caf85a1c4d964ac874f905029
41 lines
1.2 KiB
Haskell
41 lines
1.2 KiB
Haskell
module Hasura.RQL.DDL.OpenTelemetry
|
|
( runSetOpenTelemetryConfig,
|
|
runSetOpenTelemetryStatus,
|
|
)
|
|
where
|
|
|
|
import Control.Lens ((.~))
|
|
import Hasura.Base.Error
|
|
import Hasura.EncJSON
|
|
import Hasura.Metadata.Class ()
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.Types.Common (successMsg)
|
|
import Hasura.RQL.Types.Metadata
|
|
import Hasura.RQL.Types.Metadata.Object
|
|
import Hasura.RQL.Types.OpenTelemetry
|
|
import Hasura.RQL.Types.SchemaCache.Build
|
|
|
|
-- | Set the OpenTelemetry configuration to the provided value.
|
|
runSetOpenTelemetryConfig ::
|
|
(MonadError QErr m, MetadataM m, CacheRWM m) =>
|
|
OpenTelemetryConfig ->
|
|
m EncJSON
|
|
runSetOpenTelemetryConfig otelConfig = do
|
|
withNewInconsistentObjsCheck $
|
|
buildSchemaCacheFor (MOOpenTelemetry OtelSubobjectAll) $
|
|
MetadataModifier $
|
|
metaOpenTelemetryConfig .~ otelConfig
|
|
pure successMsg
|
|
|
|
-- | Set just the "status" field of the OpenTelemetry configuration.
|
|
runSetOpenTelemetryStatus ::
|
|
(MonadError QErr m, MetadataM m, CacheRWM m) =>
|
|
OtelStatus ->
|
|
m EncJSON
|
|
runSetOpenTelemetryStatus otelStatus = do
|
|
withNewInconsistentObjsCheck $
|
|
buildSchemaCacheFor (MOOpenTelemetry OtelSubobjectAll) $
|
|
MetadataModifier $
|
|
metaOpenTelemetryConfig . ocStatus .~ otelStatus
|
|
pure successMsg
|