Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix total_count error and support uptime performance #26

Merged
merged 4 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.github/
.vscode/
chart/
examples/
.gitignore
.editorconfig
.precommit-config.yaml
CHANGELOG.md
LICENSE
Makefile
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ jobs:
- name: "install dependencies"
run: poetry install

- name: "build"
run: |
source $VENV
make build

- name: "get version"
id: "get_version"
run: |
Expand Down
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM python:3.10-alpine
FROM python:3.10-alpine as build

COPY dist/ /tmp/
RUN pip install --no-cache-dir /tmp/status_cake_exporter*.whl
RUN pip install poetry

EXPOSE 8000
WORKDIR /build
COPY . .
RUN poetry install
RUN poetry build

FROM python:3.10-alpine
COPY --from=build /build/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/status_cake_exporter*.whl
RUN pip install -U python-dateutil
EXPOSE 8000
ENTRYPOINT ["status-cake-exporter"]
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ http://status-cake-exporter.default.svc:8000

## Usage

| Setting | Required | Default |
|--------------------------------------|----------|---------|
| API_KEY | Yes | Null |
| TAGS | No | Null |
| LOG_LEVEL | No | info |
| PORT | No | 8000 |
| Setting | Required | Default |
|--------------------------------------|----------|--------- |
| HOST | No | https://api.statuscake.com/v1 |
| API_KEY | Yes | Null |
| TAGS | No | Null |
| LOG_LEVEL | No | info |
| PORT | No | 8000 |
| ITEMS_PER_PAGE | No | 25 |

### Docker

Expand All @@ -45,14 +47,16 @@ Otherwise, you can use the Helm Chart provided in [chart/status-cake-exporter](c

### Grafana

To get up and running quickly, use [examples/grafana-example.json](examples/grafana-example.json) as an example.
To get up and running quickly, use [examples/grafana-example.json](examples/grafana-example.json) as an example.

### Terminal

```sh
Usage: status-cake-exporter [OPTIONS]

Options:
--host TEXT The host of the statuscake api. [env var: HOST;
default: https://api.statuscake.com/v1]
--api-key TEXT API Key for the account. [env var: API_KEY;
required]
--tags TEXT A comma separated list of tags used to filter tests
Expand All @@ -73,6 +77,7 @@ Options:
|-----|------|-------------|
| status_cake_test_info | Gauge |A basic listing of the tests under the current account. |
| status_cake_test_uptime_percent | Gauge | Tests and their uptime percentage |
| status_cake_test_performance | Gauge | Tests and their performance percentage |

## Prometheus

Expand Down Expand Up @@ -107,6 +112,8 @@ status_cake_test_info * on(test_id) group_right(test_name) status_cake_test_upti

## Development

### Tilt

This repository uses [Tilt](https://tilt.dev) for rapid development on Kubernetes.

To use this, run:
Expand All @@ -119,3 +126,13 @@ tilt up
Tilt will reload your environment when it detects changes to your code.

Note: You will need to provide valid credentials for StatusCake in your `Tiltfile` for this to work.

### Docker compose

You can use the provided `docker-compose.yml` to run the exporter locally.

```sh
docker-compose watch
```

This will start the exporter along with a mocked statuscake api server.
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
exporter:
build: .
environment:
- HOST=http://prism:4010
- API_KEY=123
- LOG_LEVEL=debug
ports:
- "8000:8000"
develop:
watch:
- action: rebuild
path: .
prism:
image: stoplight/prism:4
command: 'mock -h 0.0.0.0 https://developers.statuscake.com/redocusaurus/plugin-redoc-0.yaml'
ports:
- '8080:4010'
Loading
Loading