Community health metrics in Grafana w/ Orbit data source
Tags: api, grafana, monitoring, observability
Published: 2021-12-13 09:07:31

In a [previous post](https://dev.to/floord/github-integration-for-orbit-for-anyone-with-multiple-communities-28he) I wrote how my colleague Daniel Gonzales Lopes and I worked out how to get GitHub send data to Orbit, even though Orbit can't send data to two different workspaces. 

We got that to work, only to find my next pet peeve: Orbit's reports are pretty rudimentary. And I dreamed of being able to view community data with other health metrics for my product, combined in one graph. 

I tagged Marcus Olsson, hoping he'd be interested in scratching that itch. Marcus is a Developer Advocate at Grafana Labs, focused on their plugin ecosystem. 

Turns out Marcus was listening closely. AND the second (official) Grafana internal Hackathon was about to kick off. We teamed up, and because Orbit's CTO and Co-founder Josh Dzielak [commented on the original article](https://dev.to/dzello/comment/1k2d8) hinting things to come in 2022 on this front, we asked him if we could have a call.  

We jumped on a call, the 3 of us, to figure out how we can get timeseries data out of Orbit, and into Grafana. The goal, to plot sentiment against performance. Correlate community activity against... well, really any metrics. And to be able to (in time) annotate spikes (launches, acquisitions, event engagement).  

For every report in the Orbit application there's the option to "view JSON". In the `view_params` bit of that JSON file you can review the visualization type (bar, line, or table).
You can also try some URL manipulation by changing the time period for instance: `relative=this_6_weeks`. 

![view JSON](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgl58naa4ybbg23lw6wo.png)

If you're a Grafana user, chances are that you're using one or multiple plugins to extend Grafana. Plugins have been supported since Grafana 3.0. With over 150 published plugins, it's safe to say the platform is mature. 

## The plugin

In Grafana, add the Orbit data source. Enter your Orbit workspace path, and get your API token from Orbit. Select something like 'last 60 days' to see something useful. Toggle between members / activities. 

![Orbit data source plugin for Grafana](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2ty715a6sj9pwrahq1p.png)
<small>A sneak peek, using test data.</small> 

The plugin is essentially a wrapper over the URL. Marcus mimicked what Orbit does in terms of reports, and added some UI elements on top of that. The plugin is feature complete for now*. 

This all was done using a beta-edition of the [Orbit API](https://docs.orbit.love/reference/about-the-orbit-api) that isn't really documented yet (but should be shortly, or so we were told). 

The cumulative view can take some time to load. Still, Grafana is snappier than Orbit when it comes to serving graphs today.

Marcus recorded a [quick tutorial on configuring the data source in Grafana](https://www.youtube.com/watch?v=pGMIPe6-ytI).

## Next steps

You could consider configuring alerting for your instance - so you can get notified when for instance there's a lot of activity in a certain area. 

Head over to the [repository](https://github.com/grafana/orbit-datasource) to add your suggestions for the plugin. 

*_Orbit is working on a couple of things, including more structured connections between members and organizations, and cities and countries, and we'll update the plugin as those are available. Tags and activity types are bound to get more expressive as well._