add functions to server telemetry (#1500)

This commit is contained in:
Anon Ray 2019-01-28 16:46:44 +00:00 committed by Shahidh K Muhammed
parent 32387ba964
commit 4ae44f7b5d
2 changed files with 9 additions and 6 deletions

View File

@ -33,9 +33,9 @@ Server
~~~~~~ ~~~~~~
The server periodically sends the number of tables, views, relationships, The server periodically sends the number of tables, views, relationships,
permission rules, event triggers and remote schemas tracked by GraphQL Engine, permission rules, custom SQL functions, event triggers and remote schemas
along with randomly generated UUID per database and per instance. The tracked by GraphQL Engine, along with randomly generated UUID per database and
server version is also sent. per instance. The server version is also sent.
Here is a sample row from the telemetry database: Here is a sample row from the telemetry database:
@ -50,6 +50,7 @@ Here is a sample row from the telemetry database:
"metrics": { "metrics": {
"views": 1, "views": 1,
"tables": 2, "tables": 2,
"functions": 1,
"permissions": { "permissions": {
"roles": 1, "roles": 1,
"delete": 2, "delete": 2,

View File

@ -63,6 +63,7 @@ data Metrics
, _mtPermissions :: !PermissionMetric , _mtPermissions :: !PermissionMetric
, _mtEventTriggers :: !Int , _mtEventTriggers :: !Int
, _mtRemoteSchemas :: !Int , _mtRemoteSchemas :: !Int
, _mtFunctions :: !Int
} deriving (Show, Eq) } deriving (Show, Eq)
$(A.deriveJSON (A.aesonDrop 3 A.snakeCase) ''Metrics) $(A.deriveJSON (A.aesonDrop 3 A.snakeCase) ''Metrics)
@ -141,8 +142,9 @@ computeMetrics sc =
evtTriggers = Map.size $ Map.filter (not . Map.null) evtTriggers = Map.size $ Map.filter (not . Map.null)
$ Map.map tiEventTriggerInfoMap usrTbls $ Map.map tiEventTriggerInfoMap usrTbls
rmSchemas = Map.size $ scRemoteResolvers sc rmSchemas = Map.size $ scRemoteResolvers sc
funcs = Map.size $ Map.filter (not . fiSystemDefined) $ scFunctions sc
in Metrics nTables nViews relMetrics permMetrics evtTriggers rmSchemas in Metrics nTables nViews relMetrics permMetrics evtTriggers rmSchemas funcs
where where
usrTbls = Map.filter (not . tiSystemDefined) $ scTables sc usrTbls = Map.filter (not . tiSystemDefined) $ scTables sc
@ -166,7 +168,7 @@ getDbId =
Q.withQE defaultTxErrorHandler Q.withQE defaultTxErrorHandler
[Q.sql| [Q.sql|
SELECT (hasura_uuid :: text) FROM hdb_catalog.hdb_version SELECT (hasura_uuid :: text) FROM hdb_catalog.hdb_version
|] () False |] () False
-- | Logging related -- | Logging related