Coder Social home page Coder Social logo

paas-compose-scraper's Introduction

Compose cluster metrics scraper

A scraper for the webpage of our Compose cluster, logging metrics to Datadog. An app in main.py runs this scraper at regular intervals. This app is then deployed on the GOV.UK PaaS.

How to run

Use Python 3. Install pip packages with pip3 install -r requirements.txt.

You can run the app with python3 main.py but will need to provide several environment variables:

  • DATADOG_API_KEY: Datadog account api key
  • DATADOG_APP_KEY: Datadog application key
  • DATADOG_TAGS: [OPTIONAL] Comma seperated list of tags to mark the metrics with (ie: deployment:prod,host:metrics
  • COMPOSE_EMAIL: Compose account login with suitable access
  • COMPOSE_PASSWORD: Compose password for above
  • COMPOSE_ACCOUNT_NAME: Compose account name
  • COMPOSE_CLUSTER_ID: Id of the cluster to query
  • CHECK_INTERVAL_SECONDS: [OPTIONAL] number of seconds between scraping attempts (default=600)

How to work on the scraper

python3 -m unittest test_cluster_scraper runs the scraper against a HTML file. It does not log to Datadog and does not require the above credentials.

If Datadog alerting tells you the scraper is no longer functioning, the suggested path is:

  1. Manually update the responses/fixtures/compose.html HTML file and the test expectations;
  2. Alter the scraper until those tests pass;
  3. Run the app locally and ensure it is reporting correctly to Datadog.
  4. Have your changes reviewed and manually create a new tagged release once they are merged.

paas-compose-scraper's People

Contributors

bandesz avatar chrisfarms avatar dcarley avatar timmow avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.