mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
server: add active_livequeries, active_streaming_subscriptions EKG metrics
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5627 GitOrigin-RevId: 3f010dbe29f78ba9e79f545acc26a6a56e0b5d28
This commit is contained in:
parent
0bdfd3ae39
commit
a4c06deba3
@ -205,6 +205,7 @@ addLiveQuery
|
|||||||
|
|
||||||
liftIO $ EKG.Gauge.inc $ smActiveSubscriptions serverMetrics
|
liftIO $ EKG.Gauge.inc $ smActiveSubscriptions serverMetrics
|
||||||
liftIO $ Prometheus.Gauge.inc $ pmActiveSubscriptions prometheusMetrics
|
liftIO $ Prometheus.Gauge.inc $ pmActiveSubscriptions prometheusMetrics
|
||||||
|
liftIO $ EKG.Gauge.inc $ smActiveLiveQueries serverMetrics
|
||||||
|
|
||||||
pure $ SubscriberDetails handlerId cohortKey subscriberId
|
pure $ SubscriberDetails handlerId cohortKey subscriberId
|
||||||
where
|
where
|
||||||
@ -294,6 +295,7 @@ addStreamSubscriptionQuery
|
|||||||
|
|
||||||
liftIO $ EKG.Gauge.inc $ smActiveSubscriptions serverMetrics
|
liftIO $ EKG.Gauge.inc $ smActiveSubscriptions serverMetrics
|
||||||
liftIO $ Prometheus.Gauge.inc $ pmActiveSubscriptions prometheusMetrics
|
liftIO $ Prometheus.Gauge.inc $ pmActiveSubscriptions prometheusMetrics
|
||||||
|
liftIO $ EKG.Gauge.inc $ smActiveStreamingSubscriptions serverMetrics
|
||||||
|
|
||||||
pure $ SubscriberDetails handlerId (cohortKey, cohortCursorTVar) subscriberId
|
pure $ SubscriberDetails handlerId (cohortKey, cohortCursorTVar) subscriberId
|
||||||
where
|
where
|
||||||
@ -332,6 +334,7 @@ removeLiveQuery logger serverMetrics prometheusMetrics lqState lqId@(SubscriberD
|
|||||||
sequence_ mbCleanupIO
|
sequence_ mbCleanupIO
|
||||||
liftIO $ EKG.Gauge.dec $ smActiveSubscriptions serverMetrics
|
liftIO $ EKG.Gauge.dec $ smActiveSubscriptions serverMetrics
|
||||||
liftIO $ Prometheus.Gauge.dec $ pmActiveSubscriptions prometheusMetrics
|
liftIO $ Prometheus.Gauge.dec $ pmActiveSubscriptions prometheusMetrics
|
||||||
|
liftIO $ EKG.Gauge.dec $ smActiveLiveQueries serverMetrics
|
||||||
where
|
where
|
||||||
lqMap = _ssLiveQueryMap lqState
|
lqMap = _ssLiveQueryMap lqState
|
||||||
|
|
||||||
@ -390,6 +393,7 @@ removeStreamingQuery logger serverMetrics prometheusMetrics subscriptionState (S
|
|||||||
sequence_ mbCleanupIO
|
sequence_ mbCleanupIO
|
||||||
liftIO $ EKG.Gauge.dec $ smActiveSubscriptions serverMetrics
|
liftIO $ EKG.Gauge.dec $ smActiveSubscriptions serverMetrics
|
||||||
liftIO $ Prometheus.Gauge.dec $ pmActiveSubscriptions prometheusMetrics
|
liftIO $ Prometheus.Gauge.dec $ pmActiveSubscriptions prometheusMetrics
|
||||||
|
liftIO $ EKG.Gauge.dec $ smActiveStreamingSubscriptions serverMetrics
|
||||||
where
|
where
|
||||||
streamQMap = _ssStreamQueryMap subscriptionState
|
streamQMap = _ssStreamQueryMap subscriptionState
|
||||||
|
|
||||||
|
@ -67,6 +67,18 @@ data
|
|||||||
"schema_cache_metadata_resource_version"
|
"schema_cache_metadata_resource_version"
|
||||||
'GaugeType
|
'GaugeType
|
||||||
()
|
()
|
||||||
|
-- | Current number active live queries
|
||||||
|
ActiveLiveQueries ::
|
||||||
|
ServerMetricsSpec
|
||||||
|
"active_livequeries"
|
||||||
|
'GaugeType
|
||||||
|
()
|
||||||
|
-- | Current number of streaming subscriptions
|
||||||
|
ActiveStreaming ::
|
||||||
|
ServerMetricsSpec
|
||||||
|
"active_streaming_subscriptions"
|
||||||
|
'GaugeType
|
||||||
|
()
|
||||||
|
|
||||||
-- | Mutable references for the server metrics. See `ServerMetricsSpec` for a
|
-- | Mutable references for the server metrics. See `ServerMetricsSpec` for a
|
||||||
-- description of each metric.
|
-- description of each metric.
|
||||||
@ -77,7 +89,9 @@ data ServerMetrics = ServerMetrics
|
|||||||
smNumEventsFetchedPerBatch :: !Distribution,
|
smNumEventsFetchedPerBatch :: !Distribution,
|
||||||
smNumEventHTTPWorkers :: !Gauge,
|
smNumEventHTTPWorkers :: !Gauge,
|
||||||
smEventQueueTime :: !Distribution,
|
smEventQueueTime :: !Distribution,
|
||||||
smSchemaCacheMetadataResourceVersion :: !Gauge
|
smSchemaCacheMetadataResourceVersion :: !Gauge,
|
||||||
|
smActiveLiveQueries :: !Gauge,
|
||||||
|
smActiveStreamingSubscriptions :: !Gauge
|
||||||
}
|
}
|
||||||
|
|
||||||
createServerMetrics :: Store ServerMetricsSpec -> IO ServerMetrics
|
createServerMetrics :: Store ServerMetricsSpec -> IO ServerMetrics
|
||||||
@ -89,4 +103,6 @@ createServerMetrics store = do
|
|||||||
smNumEventHTTPWorkers <- createGauge NumEventHTTPWorkers () store
|
smNumEventHTTPWorkers <- createGauge NumEventHTTPWorkers () store
|
||||||
smEventQueueTime <- createDistribution EventQueueTime () store
|
smEventQueueTime <- createDistribution EventQueueTime () store
|
||||||
smSchemaCacheMetadataResourceVersion <- createGauge SchemaCacheMetadataResourceVersion () store
|
smSchemaCacheMetadataResourceVersion <- createGauge SchemaCacheMetadataResourceVersion () store
|
||||||
|
smActiveLiveQueries <- createGauge ActiveLiveQueries () store
|
||||||
|
smActiveStreamingSubscriptions <- createGauge ActiveStreaming () store
|
||||||
pure ServerMetrics {..}
|
pure ServerMetrics {..}
|
||||||
|
Loading…
Reference in New Issue
Block a user