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,
permission rules, event triggers and remote schemas tracked by GraphQL Engine,
along with randomly generated UUID per database and per instance. The
server version is also sent.
permission rules, custom SQL functions, event triggers and remote schemas
tracked by GraphQL Engine, along with randomly generated UUID per database and
per instance. The server version is also sent.
Here is a sample row from the telemetry database:
@ -50,6 +50,7 @@ Here is a sample row from the telemetry database:
"metrics": {
"views": 1,
"tables": 2,
"functions": 1,
"permissions": {
"roles": 1,
"delete": 2,
@ -145,4 +146,4 @@ by the CLI at ``~/.hasura/.config.json`` to perisist the setting.
Privacy Policy
--------------
You can check out our privacy policy `here <https://hasura.io/legal/hasura-privacy-policy>`_.
You can check out our privacy policy `here <https://hasura.io/legal/hasura-privacy-policy>`_.

View File

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