mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
server/pro: add prometheus metrics for caching
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9140 Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com> GitOrigin-RevId: 945a6e650f8b8f1b04647d6f5a632ce767298229
This commit is contained in:
parent
c664e1fbba
commit
d55c664d83
@ -84,6 +84,16 @@ Current number of active subscriptions, representing the subscription load on th
|
||||
| Type | Gauge |
|
||||
| Labels | none |
|
||||
|
||||
### Hasura Cache requests count
|
||||
|
||||
Tracks cache hit and miss requests, which helps in monitoring and optimizing cache utilization.
|
||||
|
||||
| | |
|
||||
| ------ | ---------------------------- |
|
||||
| Name | `hasura_cache_request_count` |
|
||||
| Type | Counter |
|
||||
| Labels | `status`: hit \| miss |
|
||||
|
||||
### Hasura cron events invocation total
|
||||
|
||||
Total number of cron events invoked, representing the number of invocations made for cron events.
|
||||
|
@ -5,6 +5,7 @@ module Hasura.Server.Prometheus
|
||||
( PrometheusMetrics (..),
|
||||
GraphQLRequestMetrics (..),
|
||||
EventTriggerMetrics (..),
|
||||
CacheRequestMetrics (..),
|
||||
makeDummyPrometheusMetrics,
|
||||
ConnectionsGauge,
|
||||
Connections (..),
|
||||
@ -52,7 +53,8 @@ data PrometheusMetrics = PrometheusMetrics
|
||||
pmActionBytesSent :: Counter,
|
||||
pmScheduledTriggerMetrics :: ScheduledTriggerMetrics,
|
||||
pmSubscriptionMetrics :: SubscriptionMetrics,
|
||||
pmWebsocketMsgQueueTimeSeconds :: Histogram
|
||||
pmWebsocketMsgQueueTimeSeconds :: Histogram,
|
||||
pmCacheRequestMetrics :: CacheRequestMetrics
|
||||
}
|
||||
|
||||
data GraphQLRequestMetrics = GraphQLRequestMetrics
|
||||
@ -102,6 +104,11 @@ data SubscriptionMetrics = SubscriptionMetrics
|
||||
submActiveStreamingPollersInError :: Gauge
|
||||
}
|
||||
|
||||
data CacheRequestMetrics = CacheRequestMetrics
|
||||
{ crmCacheHits :: Counter,
|
||||
crmCacheMisses :: Counter
|
||||
}
|
||||
|
||||
-- | Create dummy mutable references without associating them to a metrics
|
||||
-- store.
|
||||
makeDummyPrometheusMetrics :: IO PrometheusMetrics
|
||||
@ -117,6 +124,7 @@ makeDummyPrometheusMetrics = do
|
||||
pmScheduledTriggerMetrics <- makeDummyScheduledTriggerMetrics
|
||||
pmSubscriptionMetrics <- makeDummySubscriptionMetrics
|
||||
pmWebsocketMsgQueueTimeSeconds <- Histogram.new []
|
||||
pmCacheRequestMetrics <- makeDummyCacheRequestMetrics
|
||||
pure PrometheusMetrics {..}
|
||||
|
||||
makeDummyGraphQLRequestMetrics :: IO GraphQLRequestMetrics
|
||||
@ -170,6 +178,12 @@ makeDummySubscriptionMetrics = do
|
||||
submActiveStreamingPollersInError <- Gauge.new
|
||||
pure SubscriptionMetrics {..}
|
||||
|
||||
makeDummyCacheRequestMetrics :: IO CacheRequestMetrics
|
||||
makeDummyCacheRequestMetrics = do
|
||||
crmCacheHits <- Counter.new
|
||||
crmCacheMisses <- Counter.new
|
||||
pure CacheRequestMetrics {..}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- | A mutable reference for atomically sampling the number of websocket
|
||||
|
Loading…
Reference in New Issue
Block a user