Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarektouati/gcp-synthetic-monitoring
Example of GCP synthetic monitor with puppeter
https://github.com/tarektouati/gcp-synthetic-monitoring
gcp javascript monitoring puppeteer testing-library
Last synced: 23 days ago
JSON representation
Example of GCP synthetic monitor with puppeter
- Host: GitHub
- URL: https://github.com/tarektouati/gcp-synthetic-monitoring
- Owner: Tarektouati
- Created: 2024-04-05T22:05:59.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-06T02:01:42.000Z (9 months ago)
- Last Synced: 2024-10-28T10:45:08.911Z (2 months ago)
- Topics: gcp, javascript, monitoring, puppeteer, testing-library
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GCP-synthetic-monitoring
## Intro
This repo demos a synthetic monitor on GCP, i've used as example [https://training.zenika.com](https://training.zenika.com/).
The business use-case i'm monitoring :
1. Navigate on the homepage
2. Type in the search bar for a CKA training
3. Consult a search result page and chose the first result
4. Show be redirected to the training detail page.## Requirements
- [Node.js](https://nodejs.org) 18 or higer
- GCP CLI [`gcloud`](https://cloud.google.com/sdk/gcloud/)## Getting started
make sure dependencies are installed `npm install`
try executing the monitor locally:
```bash
npx functions-framework --target=
```next:
- Authenticate to GCP with the gcloud cli: `gcloud auth login`
- Define the correct project: `gcloud set-project `
- Deploy your cloud function :```bash
gcloud functions deploy --gen2 --runtime=nodejs18 --region= --source=. --entry-point= --memory=2G --timeout=60 --trigger-http
```- Create monitor that relies on our cloud function:
```bash
gcloud monitoring uptime create --synthetic-target=projects//locations//functions/ --period=5
```You should be good to go with monitor setup
### Note
The cloud function relies on puppeteer to run headless browser, to be as close as possible to the user behavior and to match the web best practices it relied on [pptr-testing-library](https://github.com/testing-library/pptr-testing-library) which is an wrapper around puppeteer that provides a set of useful queries.
Feel free to chose to use it or not.