Skip to content

Singer tap for extracting data from the Statuspage API

Notifications You must be signed in to change notification settings

apollographql/tap-statuspage

Repository files navigation

tap-statuspage

PyPI version Build Status License: GPL v3

A Singer tap for extracting data from the Statuspage REST API v1.

Installation

Since package dependencies tend to conflict between various taps and targets, Singer recommends installing taps and targets into their own isolated virtual environments:

Install Statuspage Tap

$ make prod-env

Configuration

The tap accepts a JSON-formatted configuration file as arguments. This configuration file has three required fields:

  1. token: A valid Statuspage REST API key.
  2. start A date to be used as the default start parameter for all API endpoints that support that parameter.

An bare-bones Statuspage configuration may file may look like the following:

{
  "start": "2019-01-01T00:00:00Z",
  "api_key": <api_key>
}

Streams

The current version of the tap syncs three distinct Streams:

  1. Pages: (Endpoint, Schema)
  2. Incidents: (Endpoint, Schema)
  3. Components: (Endpoint, Schema)
  4. Uptime: (Endpoint, Schema)

Discovery

Singer taps describe the data that a stream supports via a Discovery process. You can run the Statuspage tap in Discovery mode by passing the --discover flag at runtime:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --discover

The tap will generate a Catalog to stdout. To pass the Catalog to a file instead, simply redirect it to a file:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --discover > catalog.json

Sync Locally

Running a tap in Sync mode will extract data from the various Streams. In order to run a tap in Sync mode, pass a configuration file and catalog file:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --catalog=catalog.json

The tap will emit occasional State messages. You can persist State between runs by redirecting State to a file:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --catalog=catalog.json >> state.json
$ tail -1 state.json > state.json.tmp
$ mv state.json.tmp state.json

To pick up from where the tap left off on subsequent runs, simply supply the State file at runtime:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --catalog=catalog.json --state=state.json >> state.json
$ tail -1 state.json > state.json.tmp
$ mv state.json.tmp state.json

Sync to Stitch

You can also send the output of the tap to Stitch Data for loading into the data warehouse. To do this, first create a JSON-formatted configuration for Stitch. This configuration file has two required fields:

  1. client_id: The ID associated with the Stitch Data account you'll be sending data to.
  2. token The token associated with the specific Import API integration within the Stitch Data account.

An example configuration file will look as follows:

{
  "client_id": 1234,
  "token": "foobarfoobar"
}

Once the configuration file is created, simply pipe the output of the tap to the Stitch Data target and supply the target with the newly created configuration file:

$ ./.venvs/tap-statuspage/bin/tap-statuspage --config=config/config.json --catalog=catalog.json --state=state.json | ./.venvs/target-stitch/bin/target-stitch --config=config/stitch.config.json >> state.json
$ tail -1 state.json > state.json.tmp
$ mv state.json.tmp state.json

Contributing

Required Tools [Pipenv] (https://docs.pipenv.org/en/latest/) and Direnv

The first step to contributing is getting a copy of the source code, and setting up your environment. First, fork tap-statuspage on GitHub. Then, cd into the directory where you want your copy of the source code to live and clone the source code enabling direnv:

$ git clone [email protected]:YourGitHubName/tap-statuspage.git
$ direnv allow

For example, to format your code using isort and flake8 before commiting changes, run the following commands:

$ make isort
$ make flake8

You can also run the entire testing suite before committing using tox:

$ make lint

Finally, you can run your local version of the tap within the virtual environment using a command like the following:

$ tap-statuspage --config=config/config.json --catalog=catalog.json

There's also a few useful shortcuts avainable in the Makefile take a look!

Once you've confirmed that your changes work and the testing suite passes, feel free to put out a PR!

About

Singer tap for extracting data from the Statuspage API

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •