Skip to content

Commit ed4163f

Browse files
committed
Updates docs
1. Adds information about metrics 2. Adds information about webhooks 3. How to setup dev environment 4. How to contribute into docs
1 parent 405b164 commit ed4163f

File tree

8 files changed

+348
-85
lines changed

8 files changed

+348
-85
lines changed

docs/.vitepress/config.mts

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {defineConfig} from 'vitepress'
1+
import { defineConfig } from 'vitepress'
22

33
// https://vitepress.dev/reference/site-config
44
export default defineConfig({
@@ -8,7 +8,7 @@ export default defineConfig({
88
themeConfig: {
99
// https://vitepress.dev/reference/default-theme-config
1010
nav: [
11-
{text: 'Docs', link: '/'},
11+
{ text: 'Docs', link: '/' },
1212
],
1313

1414
sidebar: [
@@ -38,22 +38,31 @@ export default defineConfig({
3838
{
3939
text: 'Integrations',
4040
items: [
41-
{text: 'XHProf', link: '/config/xhprof'},
42-
{text: 'VarDumper', link: '/config/var-dumper'},
43-
{text: 'Ray', link: '/config/ray'},
44-
{text: 'Sentry', link: '/config/sentry'},
45-
{text: 'SMTP server', link: '/config/smtp'},
46-
{text: 'Monolog', link: '/config/monolog'},
47-
{text: 'Inspector', link: '/config/inspector'},
48-
{text: 'Http Dumps', link: '/config/http-dumps'},
41+
{ text: 'XHProf', link: '/config/xhprof' },
42+
{ text: 'VarDumper', link: '/config/var-dumper' },
43+
{ text: 'Ray', link: '/config/ray' },
44+
{ text: 'Sentry', link: '/config/sentry' },
45+
{ text: 'SMTP server', link: '/config/smtp' },
46+
{ text: 'Monolog', link: '/config/monolog' },
47+
{ text: 'Inspector', link: '/config/inspector' },
48+
{ text: 'Http Dumps', link: '/config/http-dumps' },
4949
]
5050
},
5151

5252
{
5353
text: 'Configuration',
5454
items: [
55-
{text: 'Single Sign On (SSO)', link: '/config/sso'},
56-
{text: 'External Database', link: '/config/external-db'},
55+
{ text: 'Webhooks', link: '/config/webhooks' },
56+
{ text: 'Single Sign On (SSO)', link: '/config/sso' },
57+
{ text: 'External Database', link: '/config/external-db' },
58+
{ text: 'Metrics', link: '/config/metrics' },
59+
]
60+
},
61+
62+
{
63+
text: 'Cookbook',
64+
items: [
65+
{ text: 'Dev environment', link: '/cookbook/dev-env' }
5766
]
5867
},
5968

@@ -64,10 +73,6 @@ export default defineConfig({
6473
text: 'Getting Started',
6574
link: '/contributing',
6675
},
67-
{
68-
text: 'Architecture',
69-
link: '/contributing/architecture',
70-
},
7176
{
7277
text: 'Server',
7378
link: '/contributing/server',
@@ -76,14 +81,18 @@ export default defineConfig({
7681
text: 'Frontend',
7782
link: '/contributing/frontend',
7883
},
84+
{
85+
text: 'Documentation',
86+
link: '/contributing/docs',
87+
},
7988
]
8089
},
8190
],
8291

8392
socialLinks: [
84-
{icon: 'github', link: 'https://github.com/buggregator/server'},
85-
{icon: 'discord', link: 'https://discord.gg/vDsCD3EKUB'},
86-
{icon: 'twitter', link: 'https://twitter.com/buggregator'},
93+
{ icon: 'github', link: 'https://github.com/buggregator/server' },
94+
{ icon: 'discord', link: 'https://discord.gg/vDsCD3EKUB' },
95+
{ icon: 'twitter', link: 'https://twitter.com/buggregator' },
8796
]
8897
}
8998
})

docs/config/metrics.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Configuration — Metrics
2+
3+
Buggregator has a new feature that collects metrics on how many events we receive. This feature lets you use tools like
4+
Prometheus and Grafana to check on event trends, find issues, and set up alerts.
5+
6+
This new feature will keep track of how many events Buggregator gets. It will sort these events by their types like
7+
sentry, monolog, var-dumper, ray, inspector, http-dump, profiler, and smtp.
8+
9+
### How It Works
10+
11+
1. **Event Counting:** Each time an event is received, it’s counted and sorted into its type.
12+
2. **Metric Updating:** The system updates the metrics to show the latest counts for each event type.
13+
14+
## Prometheus Endpoint
15+
16+
Buggregator has a built-in Prometheus friendly endpoint that you can use to collect metrics. Metrics are available at
17+
`2112` port inside the container. To access the metrics outside the container, you need to expose the port.
18+
19+
```bash
20+
docker run --pull always \
21+
... \
22+
-p 2112:2112 \
23+
ghcr.io/buggregator/server:latest
24+
```
25+
26+
> **Note:** Read more about server configuration [here](../getting-started.md).
27+
28+
After starting the server, you can access the metrics at `http://<server_address>:2112` address.
29+
30+
## Metric Format
31+
32+
Here is what the metric format looks like:
33+
34+
```plaintext
35+
# HELP events The total number of received events.
36+
# TYPE events counter
37+
events{type="sentry"} 10
38+
events{type="smtp"} 1
39+
```
40+
41+
Each line shows how many events of a specific type we have received.
42+
43+
## Grafana Integration
44+
45+
You can use these metrics to make dashboards in Grafana. This helps you see the data in a way that makes sense for you.
46+
We will provide steps on how to connect Buggregator’s metrics to Grafana.
47+
48+
### Setting Up Grafana
49+
50+
1. **Add Prometheus as a Data Source:** First, connect Prometheus (which has your Buggregator metrics) to Grafana.
51+
2. **Create Dashboards:** Next, create dashboards in Grafana to show the metrics. You can make graphs and charts that
52+
help you understand the event trends.

docs/config/webhooks.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Configuration — Webhooks
2+
3+
Webhooks are a useful way to help Buggregator communicate in real-time with other applications when certain events
4+
happen. This guide simplifies setting up and managing webhooks for enhancing automation and integration with other
5+
tools.
6+
7+
This guide will help you understand how to set up and use webhooks.
8+
9+
### What is a Webhook?
10+
11+
A webhook allows applications to share information as soon as specific events occur. Unlike regular APIs that require
12+
checking for updates periodically, webhooks provide this information automatically, saving time and resources.
13+
14+
### Why Use Webhooks in Buggregator?
15+
16+
- **Automate Tasks:** Automatically trigger actions in other services like [n8n](https://n8n.io/) when events happen in
17+
Buggregator.
18+
- **Integrate with Other Tools:** Connect Buggregator with various tools like messaging apps, issue tracking software,
19+
or custom apps effortlessly.
20+
21+
## Docker Configuration
22+
23+
Currently, Buggregator does not have an admin interface for managing webhooks. Instead, you manage them through
24+
configuration files within a Docker container.
25+
26+
**Here's how you can mount a volume containing webhook configurations:**
27+
28+
```bash
29+
docker run --pull always \
30+
-v /path/to/webhooks:/app/runtime/webhooks \
31+
ghcr.io/buggregator/server:latest
32+
```
33+
34+
or using `docker-compose`:
35+
36+
```yaml
37+
buggregator-server:
38+
...
39+
volumes:
40+
- /path/to/webhooks:/app/runtime/webhooks
41+
```
42+
43+
## Configuring a Webhook
44+
45+
Place each webhook configuration in a YAML file within the `runtime/webhooks` directory. Each configuration file should
46+
contain one webhook setup.
47+
48+
Here’s what a typical webhook configuration looks like:
49+
50+
```yaml
51+
webhook:
52+
event: sentry.received
53+
url: http://example.com/webhook
54+
headers:
55+
Content-Type: application/json
56+
Secret-Key: my-secret-key
57+
verify_ssl: false
58+
retry_on_failure: true
59+
```
60+
61+
**Key Components of a Webhook Configuration:**
62+
63+
- **Event:** The specific event in Buggregator that will trigger the webhook.
64+
- **URL:** Where the webhook sends data.
65+
- **Headers:** Any additional headers needed for the webhook request.
66+
- **Verify SSL:** Choose whether to check SSL certificates during the webhook call.
67+
- **Retry on Failure:** If the webhook should retry sending data if the first attempt fails. (3 retries with exponential
68+
backoff)
69+
70+
> **Note:** You can test webhooks using tools like https://webhook.site.
71+
72+
### Types of Events Supported:
73+
74+
Buggregator can currently handle the following events:
75+
76+
- sentry.received
77+
- monolog.received
78+
- var-dumper.received
79+
- ray.received
80+
- inspector.received
81+
- http-dump.received
82+
- profiler.received
83+
- smtp.received

docs/contributing.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ label. This makes it easier for you to find ways to participate.
1212
Additionally, we use labels such as `c:easy`, `c:medium`, and `c:difficult` to indicate the complexity level of issues,
1313
helping you choose tasks that match your skill level.
1414

15-
## The Benefits of Contributing to Open Source for Developers
15+
## Benefits
1616

1717
Contributing to open source projects offers a wealth of benefits, particularly for junior developers.
1818

@@ -31,13 +31,20 @@ Contributing to open source projects offers a wealth of benefits, particularly f
3131
5. **Making a Real-World Impact:** Your contributions can significantly influence the project and its users. The
3232
satisfaction of seeing your code being used and appreciated by others is incredibly rewarding.
3333

34-
**Remember, every expert was once a beginner. Contributing to open source is a valuable step in your development
35-
journey. So, dive in and start making your mark!**
34+
**Help us enhance Buggregator and make a real difference!**
3635

3736
**We appreciate any contributions to help make Buggregator better!**
3837

39-
Buggregator consist of two repositories
38+
## Repositories
4039

41-
1. Server part. This is the places where an application will send events which will be handled by server and sent to the client browser. Server also is REST API endpoint where a client requests received events
40+
There are the following repositories in the Buggregator project:
4241

43-
2. Frontend part. This is the place where a client can observe incomming events such as var dumps and
42+
1. [Server](https://github.com/buggregator/server). Manages and sends events to the client. It also serves as a REST API
43+
endpoint for event requests.
44+
2. [Frontend](https://github.com/buggregator/frontend). Allows clients to view incoming events like variable dumps.
45+
3. [Trap](https://github.com/buggregator/trap). A lightweight alternative to the full Buggregator server, designed for
46+
local debugging.
47+
4. [Documentation](https://github.com/buggregator/docs). Contains all the documentation for the Buggregator project.
48+
5. [Site](https://github.com/buggregator/buggregator.dev). The official website for Buggregator.
49+
6. [PHPStorm Plugin](https://github.com/buggregator/phpstorm-plugin). A plugin for PHPStorm that integrates with
50+
Buggregator.

docs/contributing/architecture.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/contributing/docs.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Contributing — Documentation
2+
3+
Buggregator uses [VitePress](https://vitepress.dev/) for its documentation. This makes it easy to contribute to the
4+
project's documentation by following the steps below.
5+
6+
## Getting Started
7+
8+
### Clone the Repository
9+
10+
First of all you need to clone the repository to your local machine.
11+
12+
```bash
13+
git clone [email protected]:buggregator/docs.git
14+
```
15+
16+
> **Note**: If you don't have access to the repository, you can fork it and clone your forked repository.
17+
18+
### Install Dependencies
19+
20+
After cloning the repository, navigate to the project directory and install the dependencies.
21+
22+
```bash
23+
npm install
24+
```
25+
26+
### Start the Development Server
27+
28+
To start the development server and preview the documentation, run the following command:
29+
30+
```bash
31+
npm run docs:dev
32+
```
33+
34+
This command will start a local development server and open the documentation in your default browser.
35+
36+
## Structure
37+
38+
The documentation is structured as follows:
39+
40+
- `docs/`: Contains the documentation files.
41+
- `docs/.vitepress/config.mts`: Site configuration and navigation.
42+
43+
All you need is to edit the markdown files in the `docs/` directory. If you want to add a new page, create a new
44+
markdown file in the `docs/` directory and add it to the navigation in the `docs/.vitepress/config.mts` file.
45+
46+
---
47+
48+
That's it! You're now ready to contribute to the Buggregator documentation.

docs/contributing/server.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@ crucial for handling the information that flows through Buggregator.
1010

1111
## Key Technologies:
1212

13-
It's built on a foundation of robust and reliable technologies, including the Spiral Framework, RoadRunner, and
14-
Centrifugo.
13+
It's built on a foundation of robust and reliable technologies, including the Spiral Framework, RoadRunner, Centrifugo
14+
and Doltdb.
1515

1616
- [Spiral Framework](https://spiral.dev/) - A PHP framework that's the foundation of our server.
1717
- [RoadRunner](https://roadrunner.dev/) - Manages different server tasks like HTTP, TCP, queues, and caching.
1818
- [Centrifugo](https://centrifugal.dev/) - Handles real-time messaging through WebSockets.
19+
- [Doltdb](https://github.com/dolthub/dolt) - A SQL database that's built on top of a Git repository.
1920

2021
## Server requirements
2122

2223
1. Minimum PHP version: 8.2
2324

2425
## Installation
2526

26-
1. Clone repository `git clone https://github.com/buggregator/server.git`
27-
2. Install backend dependencies `composer install`
28-
3. Download RoadRunner binary `vendor/bin/rr get-binary`
29-
4. Install Centrifugo server `cd bin && ./get-binaries.sh`
30-
5. Run RoadRunner server `./rr serve`
27+
To set up environment for local development read the [development environment setup guide](../cookbook/dev-env.md).

0 commit comments

Comments
 (0)