Monitoring a Voyager Server

Voyager Server can expose a variety of useful metrics that can be consumed and visualised by the Mobile Metrics service. (Prometheus for data collection and Grafana for Visualisation).

The @aerogear/voyager-metrics module can be used to mount a metrics middleware, exposing a metrics endpoint that can be consumed by prometheus (default: /metrics).

Enabling Metrics in Voyager Server

  1. Import the @aerogear/voyager-metrics module.

    const metrics = require('@aerogear/voyager-metrics')
  2. Apply the metrics middleware to your Express app. This will expose metrics at the given endpoint.

    const app = express()
    metrics.applyMetricsMiddlewares(app, { path: '/metrics' })
  3. Inject the metrics module into Voyager Server. This will ensure metrics at the GraphQL level can be exposed.

    const voyagerConfig = {
      metrics
    }
    const server = VoyagerServer(apolloConfig, voyagerConfig)

The Metrics Example Server Guide has an example server based off the instructions above and shows all of the steps needed to get it running.

Monitoring a Voyager Server Application

Prerequisites
  • You have provisioned the Mobile Metrics service.

  • You have provisioned your Data Sync service.

  • You have enabled metrics in Voyager Server.

The Mobile Metrics Service and your Voyager Server application must be provisioned in the same OpenShift project to access data.

Overview

As there can be multiple Voyager Server applications in a namespace, Voyager Server application provisioning procedure creates a new Grafana dashboard for the Voyager Server application that is being provisioned.

After the Mobile Metrics Service (includes Grafana for visualization and the Prometheus monitoring system) and your Voyager Server application are provisioned, you should be able to see the "Data Sync Metrics - <your app name>" in the list of available dashboards (navigate to Grafana’s exposed URL → Log in → Home → Select Data Sync Metrics - <your app name>).

Dashboard panel descriptions

The Data Sync dashboard consists of several panels which give you an overview of the specific events and resources, such as memory usage, CPU usage, resolved operation count etc.

The dashboard is separated into 2 section. "Client" section shows some basic metrics about the clients and users and the "Server" secion shows some metrics about the server status.

Below you will find a detailed description of each panel and its values.

Singlestat Panels

Singlestat panels show you the main summary of a single data series.

  • CPU Usage: CPU usage percentage of the Voyager Server application used currently.

  • Memory Usage: The amount of memory currently used by the Voyager Server application.

Graph panels

Used to show how certain values change over time, e.g. the number of operations resolved.

  • Unique Clients Over Time: Overview of the number of unique clients over the selected time range. Note that a "client" is a an application installation on a device. The client id is reset when the application is reinstalled on the same device.

  • Unique Users Over Time: Overview of the number of unique users over the selected time range. Note that a "user" is a user who is authenticated with the Identity Management.

  • Memory Usage in Time: The amount of memory used by the Voyager Server application over time.

  • CPU Usage in Time: The percentage of CPU used by the Voyager Server application over time.

  • Queries/Mutations Resolved: Overview of the resolved queries and mutations over time.

  • Resolver Timings: Overview of the how long it took to resolve operations over time.

  • Server Response Time: Overview of the how long it took the server to respond the requests.

  • Operations vs Conflicts: Overview of the resolver executions and the conflicts happened.

  • Conflicts Over Time per Operation: Overview of the conflicts and what operation caused them.

Additional resources