graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Server.Telemetry

Description

Send anonymized metrics to the telemetry server regarding usage of various features of Hasura.

The general workflow for telemetry is as follows:

  1. We generate metrics for each backend in the graphql-engine code and send it to telemetryUrl. The relevant types can be found in Hasura.Server.Telemetry.Types.
  2. The telemetryUrl endpoint is handled by code in: https://github.com/hasura/hasura-analytics/tree/hge-upgrade, specifically manager/main.go and manager/analytics.go. This server endpoint receives the telemetry payload and sends it to another graphql-engine which runs locally and is backed by a postgres database. The database schema for the telemetry endpoint can also be found in the same repo under hge/migrations/.
  3. The information from the postgres db can be viewed in Metabase: https://metabase.telemetry.hasura.io/browse/2/schema/public.

For more information about telemetry in general, visit the user-facing docs on the topic: https://hasura.io/docs/latest/graphql/core/guides/telemetry.

Synopsis

Logging and error handling

data TelemetryLog Source #

Logging related

Constructors

TelemetryLog 

data TelemetryHttpError Source #

Constructors

TelemetryHttpError 

Fields

Endpoint

Execution

runTelemetry Source #

Arguments

:: Logger Hasura 
-> Manager 
-> IO SchemaCache

an action that always returns the latest schema cache

-> MetadataDbId 
-> InstanceId 
-> PGVersion 
-> IO void 

An infinite loop that sends updated telemetry data (Metrics) every 24 hours. The send time depends on when the server was started and will naturally drift.

Generate metrics

mkTelemetryPayload :: forall (b :: BackendType). HasTag b => MetadataDbId -> InstanceId -> Version -> PGVersion -> Maybe CI -> ServiceTimingMetrics -> RemoteSchemaMap -> ActionCache -> SourceInfo b -> TelemetryPayload Source #

Generate a telemetry payload for a specific source by computing their relevant metrics. Additional information that may not be relevant to a particular source such as service timing, remote schemas and actions, will be reported only with the default source.

computeMetrics :: forall (b :: BackendType). SourceInfo b -> Maybe ServiceTimingMetrics -> Maybe RemoteSchemaMap -> Maybe ActionCache -> Metrics Source #

Compute the relevant metrics for a specific source.

computeActionsMetrics :: ActionCache -> ActionMetric Source #

Compute the relevant metrics for actions from the action cache.

versionToTopic :: Version -> Topic Source #

Decide which topic (telemetry table) we should use based on the version.